:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { MakeLogicType, connect, kea, path, selectors } from 'kea'
import { isEmbeddedPageFrame } from 'lib/utils/embeddedPageFrame'
import { organizationLogic } from 'scenes/organizationLogic'
import { projectLogic } from 'scenes/projectLogic'
import { sceneLogic } from 'scenes/sceneLogic'
import { Scene } from 'scenes/sceneTypes'
import type { SceneConfig } from '../../scenes/sceneTypes'
import type { ProjectType } from '../../types'
import { navigationLogic } from '../navigation/navigationLogic'
export type Navigation3000Mode = 'none' | 'minimal' | 'embedded' | 'full'
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface navigation3000LogicValues {
mobileLayout: boolean // navigationLogic
isCurrentOrganizationUnavailable: boolean // organizationLogic
currentProject: ProjectType | null // projectLogic
activeSceneId: string | null // sceneLogic
sceneConfig: SceneConfig | null // sceneLogic
mode: Navigation3000Mode
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface navigation3000LogicMeta {
__keaTypeGenInternalSelectorTypes: {
mode: (
sceneConfig: SceneConfig | null,
isCurrentOrganizationUnavailable: boolean,
currentProject: ProjectType | null,
activeSceneId: string | null
) => Navigation3000Mode
}
}
export type navigation3000LogicType = MakeLogicType<
navigation3000LogicValues,
{},
Record<string, any>,
navigation3000LogicMeta
>
export const navigation3000Logic = kea<navigation3000LogicType>([
path(['layout', 'navigation-3000', 'navigationLogic']),
connect(() => ({
values: [
sceneLogic,
['sceneConfig', 'activeSceneId'],
navigationLogic,
['mobileLayout'],
organizationLogic,
['isCurrentOrganizationUnavailable'],
projectLogic,
['currentProject'],
],
})),
selectors({
mode: [
(s) => [s.sceneConfig, s.isCurrentOrganizationUnavailable, s.currentProject, s.activeSceneId],
(
sceneConfig: null | import('scenes/sceneTypes').SceneConfig,
isCurrentOrganizationUnavailable: boolean,
currentProject: import('~/types').ProjectType | null,
activeSceneId: string | null
): Navigation3000Mode => {
// An embedded page frame sits inside another app page, so it shows the scene alone.
if (isEmbeddedPageFrame()) {
return 'embedded'
}
// My tickets stays open on a project pending deletion, so hide the links into the rest of the app.
if (isCurrentOrganizationUnavailable || currentProject?.is_pending_deletion) {
return 'minimal'
}
if (sceneConfig?.layout === 'plain' && !sceneConfig.allowUnauthenticated) {
// Onboarding owns the whole viewport, so it gets no navbar.
return activeSceneId === Scene.Onboarding ? 'none' : 'minimal'
}
return sceneConfig?.layout !== 'plain' ? 'full' : 'none'
},
],
}),
])