Skip to content

: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.

feat(navigation): share the nav shell and prep the flat-nav experiment (#94726)

Rafael Audibert0c6928bfe7b7
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 08ec0c3ea37f..159459d5d461 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -3280,10 +3280,10 @@ snapshots:
hash: v1.k794b7964.33dac53a2c2f3c8945bb52917b010f00a24b8d8b213106939af1037022d4ed5e.QNBv_MCq5SJyqzj3G7AuQxGF1qLYQLIQotnO3MfqpRE
insights-worldmap--default--light:
hash: v1.k794b7964.a4f523dbe2e78f12ddf6c95d6e1e0b1da4457008aa42a9b83fb5e21bc4519915.sRV9jpfMOemd-Hss7Y7z4hMMwHYzM7l8Dq9i4uoJBiE
- layout-flat-nav--default--dark:
- hash: v1.k794b7964.03613ec62699fc27a750adf012f4225aa584569ea3efe9998858d68c85397902.PFmiNHfyolZNauCpMSOgyJTs42J32h-GlFBxyCUvgVA
- layout-flat-nav--default--light:
- hash: v1.k794b7964.bc199653ab101a8f2e6ef2ddc0c9d9d66b0872b48b3e4407819c85d7d1d92253.peo-D7OiW3tooIMVAqjs5IHu9cpaT_bD9AZoXj5lpG4
+ layout-flat-nav-browse--default--dark:
+ hash: v1.k794b7964.5d1f1b535bb3492e1ecdfa3e1acac30e856bcacb109136cf4b88654a8fa2bfcb.N4pOX84PDiTGfw5A6cgk634GGZ5U2Z-1QQNM82ZTp8Y
+ layout-flat-nav-browse--default--light:
+ hash: v1.k794b7964.58d96f8a2cf0909da2fee6730ca62968503d17c4985f8ef5c0955c1a5d6d0cfc.jRiRZjbhssutoU8Tl2MTPRK606wz2E-HQ7eRugf-2Dc
layout-impersonation-reason-modal--loading--dark:
hash: v1.k794b7964.56bc03177fcbe93f212232c9025d90ec672e9043881ce4e9a3dbbb612b501066.mkYeZ8C0UhPLy7CKjURxERYeFMjyvXrOyEpykdHmmrM
layout-impersonation-reason-modal--loading--light:
diff --git a/frontend/src/layout/panel-layout/PanelLayout.tsx b/frontend/src/layout/panel-layout/PanelLayout.tsx
index cb6e972695da..4524b2943e9f 100644
--- a/frontend/src/layout/panel-layout/PanelLayout.tsx
+++ b/frontend/src/layout/panel-layout/PanelLayout.tsx
@@ -3,7 +3,6 @@ import { useActions, useMountedLogic, useValues } from 'kea'
import { IconX } from '@posthog/icons'
-import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { IconMenu } from 'lib/lemon-ui/icons'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
import { cn } from 'lib/utils/css-classes'
@@ -11,9 +10,8 @@ import { cn } from 'lib/utils/css-classes'
import { supportTicketCounterLogic } from 'products/conversations/frontend/supportTicketCounterLogic'
import { navigation3000Logic } from '../navigation-3000/navigationLogic'
-import { Nav as AiFirstNavBar } from './ai-first/Nav'
-import { PanelLayoutPanels } from './ai-first/PanelLayoutPanels'
-import { FlatNav } from './flat-nav/FlatNav'
+import { NavBar } from './navbar/NavBar'
+import { PanelLayoutPanels } from './navbar/PanelLayoutPanels'
import { panelLayoutLogic } from './panelLayoutLogic'
import { PROJECT_TREE_KEY } from './ProjectTree/ProjectTree'
import { projectTreeLogic } from './ProjectTree/projectTreeLogic'
@@ -85,7 +83,6 @@ export function PanelLayout({ className }: { className?: string }): JSX.Element
const { showLayoutPanel, clearActivePanelIdentifier, showLayoutNavBar } = useActions(panelLayoutLogic)
useMountedLogic(projectTreeLogic({ key: PROJECT_TREE_KEY }))
useMountedLogic(supportTicketCounterLogic) // Start polling for unread tickets on app load
- const isFlatNavEnabled = useFeatureFlag('FLAT_NAV')
return (
<>
@@ -132,7 +129,7 @@ export function PanelLayout({ className }: { className?: string }): JSX.Element
: {}
}
>
- {isFlatNavEnabled ? <FlatNav /> : <AiFirstNavBar />}
+ <NavBar />
</div>
{/* Mobile-only positioning anchor for panel content. Decoupled from #project-panel-layout
diff --git a/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx b/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx
index ccb158da96fc..b20932aec7c7 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx
@@ -7,7 +7,6 @@ import { IconCheckbox, IconChevronRight, IconEllipsis, IconFolderPlus, IconPlusS
import { itemSelectModalLogic } from 'lib/components/FileSystem/ItemSelectModal/itemSelectModalLogic'
import { dayjs } from 'lib/dayjs'
-import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useLocalStorage } from 'lib/hooks/useLocalStorage'
import { LemonTag } from 'lib/lemon-ui/LemonTag'
import {
@@ -53,6 +52,11 @@ export interface ProjectTreeProps {
checkedItemsOverride?: Record<string, boolean>
/** Override the onItemChecked handler from the internal logic */
onItemCheckedOverride?: (id: string, checked: boolean) => void
+ /**
+ * Runs in addition to the tree's own click handling, not instead of it. A caller that renders
+ * the tree inside a larger surface uses this to report the click in that surface's own terms.
+ */
+ onItemClicked?: (item: TreeDataItem | undefined) => void
/** True while this tree's nav panel is active — refocuses search on panel re-activation. */
isActiveInPanel?: boolean
}
@@ -101,6 +105,7 @@ export function ProjectTree({
selectModeOverride,
checkedItemsOverride,
onItemCheckedOverride,
+ onItemClicked,
isActiveInPanel,
}: ProjectTreeProps): JSX.Element {
const [uniqueKey] = useState(() => `project-tree-${counter++}`)
@@ -156,8 +161,6 @@ export function ProjectTree({
const showFilterDropdown = root === 'project://'
const showSortDropdown = root === 'project://'
- const isStarredReorderEnabled = useFeatureFlag('STARRED_REORDER')
-
let treeData: TreeDataItem[] = [...fullFileSystemFiltered]
// Apply checked items override for external control (e.g. product selection)
@@ -248,6 +251,8 @@ export function ProjectTree({
name: item?.name ?? null,
})
+ onItemClicked?.(item)
+
if (item?.record?.href) {
router.actions.push(
typeof item.record.href === 'function' ? item.record.href(item.record.ref) : item.record.href
@@ -303,7 +308,6 @@ export function ProjectTree({
// Sibling reorder within the Starred (shortcuts://) list. All the index/position
// math lives in the kea logic so the component can stay focused on rendering.
if (
- isStarredReorderEnabled &&
typeof oldId === 'string' &&
typeof newId === 'string' &&
shortcutEntryIdMap.has(oldId) &&
@@ -343,7 +347,7 @@ export function ProjectTree({
}}
isItemDraggable={(item) => {
if (shortcutEntryIdMap.has(item.id)) {
- return isStarredReorderEnabled
+ return true
}
return (item.id.startsWith('project/') || item.id.startsWith('project://')) && item.record?.path
}}
@@ -353,7 +357,7 @@ export function ProjectTree({
// Allow dropping onto other top-level starred items to reorder them.
if (shortcutEntryIdMap.has(item.id)) {
- return isStarredReorderEnabled
+ return true
}
// disable dropping for these IDS
diff --git a/frontend/src/layout/panel-layout/flat-nav/FlatNav.stories.tsx b/frontend/src/layout/panel-layout/flat-nav/FlatNav.stories.tsx
deleted file mode 100644
index 8d0ee6979490..000000000000
--- a/frontend/src/layout/panel-layout/flat-nav/FlatNav.stories.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import type { Meta, StoryObj } from '@storybook/react'
-
-import { FEATURE_FLAGS } from 'lib/constants'
-
-import { FlatNav } from './FlatNav'
-
-type Story = StoryObj<typeof FlatNav>
-
-const meta: Meta<typeof FlatNav> = {
- title: 'Layout/Flat Nav',
- component: FlatNav,
- parameters: {
- layout: 'fullscreen',
- viewMode: 'story',
- featureFlags: [FEATURE_FLAGS.FLAT_NAV],
- },
- render: () => (
- <div className="h-screen w-fit">
- <FlatNav />
- </div>
- ),
-}
-
-export default meta
-
-export const Default: Story = {}
diff --git a/frontend/src/layout/panel-layout/flat-nav/FlatNav.tsx b/frontend/src/layout/panel-layout/flat-nav/FlatNav.tsx
deleted file mode 100644
index 85fb0fa5cb8b..000000000000
--- a/frontend/src/layout/panel-layout/flat-nav/FlatNav.tsx
+++ /dev/null
@@ -1,256 +0,0 @@
-import './FlatNav.scss'
-
-import { cva } from 'cva'
-import { useActions, useMountedLogic, useValues } from 'kea'
-import { router } from 'kea-router'
-import posthog from 'posthog-js'
-import { useEffect, useRef } from 'react'
-
-import { IconChat, IconClock, IconHome, IconNotification, IconPlusSmall } from '@posthog/icons'
-
-import { NewAccountMenu } from 'lib/components/Account/NewAccountMenu'
-import { commandLogic } from 'lib/components/Command/commandLogic'
-import { NavSearchBar, NavSearchButton } from 'lib/components/NavSearchButton/NavSearchButton'
-import { Resizer } from 'lib/components/Resizer/Resizer'
-import { ResizerLogicProps, resizerLogic } from 'lib/components/Resizer/resizerLogic'
-import { ScrollableShadows } from 'lib/components/ScrollableShadows/ScrollableShadows'
-import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
-import { useShortcut } from 'lib/components/Shortcuts/useShortcut'
-import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
-import { LemonButton } from 'lib/lemon-ui/LemonButton'
-import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from 'lib/ui/DropdownMenu/DropdownMenu'
-import { cn } from 'lib/utils/css-classes'
-import { newDashboardLogic } from 'scenes/dashboard/newDashboardLogic'
-import { urls } from 'scenes/urls'
-
-import { navigation3000Logic } from '~/layout/navigation-3000/navigationLogic'
-import { navigationLogic } from '~/layout/navigation/navigationLogic'
-import { NavLink } from '~/layout/panel-layout/ai-first/NavLink'
-import { PanelLayoutPanels } from '~/layout/panel-layout/ai-first/PanelLayoutPanels'
-import { CreateMenu } from '~/layout/panel-layout/menus/CreateMenu'
-import { NavBarFooter } from '~/layout/panel-layout/NavBarFooter'
-import {
- PANEL_NAVBAR_COLLAPSE_THRESHOLD,
- PANEL_NAVBAR_DEFAULT_WIDTH,
- panelLayoutLogic,
-} from '~/layout/panel-layout/panelLayoutLogic'
-import { uiCustomizationLogic } from '~/layout/uiCustomizationLogic'
-import { ActivityTab } from '~/types'
-
-import { FlatNavPanelButtons } from './FlatNavPanelButtons'
-import { FlatNavProducts } from './FlatNavProducts'
-import { FlatNavRecents } from './FlatNavRecents'
-
-const flatNavStyles = cva({
- base: 'FlatNav flex flex-col max-h-screen min-h-screen bg-surface-tertiary z-[var(--z-layout-navbar)] relative border-r lg:border-r-transparent',
- variants: {
- isLayoutNavCollapsed: {
- true: 'w-[var(--project-navbar-width-collapsed)]',
- false: 'w-[var(--project-navbar-width)]',
- },
- isMobileLayout: {
- true: 'absolute top-0 bottom-0 left-0',
- false: '',
- },
- },
-})
-
-// Keeps newDashboardLogic mounted while the Create button is visible, so the "Start from scratch"
-// flow completes (and redirects) even after the menu closes and unmounts its own logic reference.
-function CreateMenuLogics(): null {
- useMountedLogic(newDashboardLogic)
- return null
-}
-
-export function FlatNav(): JSX.Element {
- const containerRef = useRef<HTMLDivElement | null>(null)
- const { toggleLayoutNavCollapsed, setNavbarWidth } = useActions(panelLayoutLogic)
- const { isLayoutPanelVisible, isLayoutNavCollapsed } = useValues(panelLayoutLogic)
- const { mobileLayout: isMobileLayout } = useValues(navigation3000Logic)
- const { toggleCommand } = useActions(commandLogic)
- const { sidebarDensity, isSidebarSectionShown, isSidebarItemShown, uiCustomizationEnabled } =
- useValues(uiCustomizationLogic)
- const { showConfigureHomeModal } = useActions(navigationLogic)
- const isProductAutonomyEnabled = useFeatureFlag('PRODUCT_AUTONOMY')
- const showCreateButton = useFeatureFlag('CREATE_BUTTON_NAV_EXPERIMENT', 'test')
-
- const resizerLogicProps: ResizerLogicProps = {
- logicKey: 'panel-layout-navbar',
- placement: 'right',
- containerRef,
- persistent: true,
- closeThreshold: PANEL_NAVBAR_COLLAPSE_THRESHOLD,
- onToggleClosed: (shouldBeClosed) => toggleLayoutNavCollapsed(shouldBeClosed),
- onDoubleClick: () => toggleLayoutNavCollapsed(),
- }
- const { desiredSize } = useValues(resizerLogic(resizerLogicProps))
-
- // Grow to any width upward; never render narrower than the collapse snap so the live drag
- // stays in sync with where onToggleClosed flips to collapsed mode.
- const openWidth = Math.max(Math.round(desiredSize ?? PANEL_NAVBAR_DEFAULT_WIDTH), PANEL_NAVBAR_COLLAPSE_THRESHOLD)
-
- useEffect(() => {
- if (!isLayoutNavCollapsed && !isMobileLayout) {
- setNavbarWidth(openWidth)
- }
- }, [openWidth, isLayoutNavCollapsed, isMobileLayout, setNavbarWidth])
-
- useShortcut({
- name: 'ToggleLeftNav',
- keybind: [keyBinds.toggleLeftNav],
- intent: 'Toggle collapse left navigation',
- interaction: 'function',
- callback: toggleLayoutNavCollapsed,
- })
-
- return (
- <div className="flex gap-0 relative">
- <nav
- className={cn(flatNavStyles({ isLayoutNavCollapsed, isMobileLayout }))}
- data-nav-density={sidebarDensity}
- ref={containerRef}
- >
- <div
- className={cn(
- 'flex justify-between items-center',
- isLayoutNavCollapsed ? 'justify-center' : 'h-[var(--scene-layout-header-height)]'
- )}
- >
- <div
- className={cn('flex gap-1 rounded-md w-full px-2 pt-2 pb-1', {
- 'flex-col items-center pt-2 pb-0': isLayoutNavCollapsed,
- })}
- >
- <NewAccountMenu isLayoutNavCollapsed={isLayoutNavCollapsed} />
-
- {/* Collapsed nav has no room for the search bar, so it keeps the icon-only trigger */}
- {isLayoutNavCollapsed && <NavSearchButton toggleCommand={toggleCommand} />}
- </div>
- </div>
-
- {!isLayoutNavCollapsed && (
- <div className="px-2 py-1">
- <NavSearchBar toggleCommand={toggleCommand} />
- </div>
- )}
-
- {showCreateButton && (
- <div className={cn('px-2 py-1', isLayoutNavCollapsed && 'flex justify-center px-0')}>
- <CreateMenuLogics />
- <DropdownMenu
- onOpenChange={(open) => {
- if (open) {
- posthog.capture('nav create button clicked')
- }
- }}
- >
- <DropdownMenuTrigger asChild>
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconPlusSmall />}
- fullWidth={!isLayoutNavCollapsed}
- center={!isLayoutNavCollapsed}
- title={isLayoutNavCollapsed ? 'Create' : undefined}
- data-attr="nav-create-button"
- >
- {!isLayoutNavCollapsed ? 'Create' : null}
- </LemonButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent side="bottom" align="start" className="min-w-[220px]">
- <CreateMenu />
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- )}
-
- <ScrollableShadows
- className="flex-1"
- innerClassName="overflow-y-auto overflow-x-hidden pl-2 pr-0.5 pt-1 focus-visible:outline-accent -outline-offset-2"
- direction="vertical"
- styledScrollbars
- >
- <div className={cn('flex flex-col gap-px', isLayoutNavCollapsed && 'items-center')}>
- {isSidebarItemShown('home') && (
- <NavLink
- to={urls.projectRoot()}
- label="Home"
- icon={<IconHome />}
- isCollapsed={isLayoutNavCollapsed}
- data-attr="nav-item-home"
- onClick={() => posthog.capture('nav item clicked', { item: 'home' })}
- sideAction={{
- onClick: () =>
- uiCustomizationEnabled
- ? router.actions.push(urls.settings('user-navigation', 'homepage'))
- : showConfigureHomeModal(),
- tooltip: 'Configure home',
- 'data-attr': 'nav-configure-home',
- }}
- />
- )}
-
- <NavLink
- to={urls.ai()}
- label="Chat"
- icon={<IconChat className="text-ai" />}
- isCollapsed={isLayoutNavCollapsed}
- data-attr="flat-nav-item-chat"
- onClick={() => posthog.capture('nav item clicked', { item: 'chat' })}
- />
-
- {isProductAutonomyEnabled && isSidebarItemShown('inbox') && (
- <NavLink
- to={urls.inbox()}
- label="Self-driving"
- icon={<IconNotification />}
- isCollapsed={isLayoutNavCollapsed}
- data-attr="nav-item-inbox"
- tag="beta"
- onClick={() => posthog.capture('nav item clicked', { item: 'inbox' })}
- />
- )}
-
- <NavLink
- to={urls.activity(ActivityTab.ExploreEvents)}
- label="Activity"
- icon={<IconClock />}
- isCollapsed={isLayoutNavCollapsed}
- data-attr="nav-item-activity"
- onClick={() => posthog.capture('nav item clicked', { item: 'activity' })}
- />
-
- <FlatNavPanelButtons />
- </div>
-
- {!isLayoutNavCollapsed && isSidebarSectionShown('recents') && <FlatNavRecents />}
- {!isLayoutNavCollapsed && isSidebarSectionShown('my_tools') && <FlatNavProducts />}
- </ScrollableShadows>
-
- <div className="px-2">
- <div className="h-px bg-border-primary" />
- </div>
-
- <div className="p-1">
- <NavBarFooter isLayoutNavCollapsed={isLayoutNavCollapsed} />
- </div>
-
- {!isMobileLayout && (
- <Resizer
- {...resizerLogicProps}
- data-attr="tree-navbar-resizer"
- className={cn('top-3 -right-px bottom-4 z-2', {
- 'top-0': isLayoutPanelVisible,
- })}
- offset={0}
- />
- )}
- </nav>
-
- {/* Desktop renders panel content inline next to the nav (PanelLayoutPanel's
- ResizableElement positions it via left:100% of this flex parent). On mobile the
- panel is lifted out to PanelLayout.tsx for its own stacking context. */}
- {!isMobileLayout && <PanelLayoutPanels />}
- </div>
- )
-}
diff --git a/frontend/src/layout/panel-layout/ai-first/Nav.scss b/frontend/src/layout/panel-layout/navbar/NavBar.scss
similarity index 100%
rename from frontend/src/layout/panel-layout/ai-first/Nav.scss
rename to frontend/src/layout/panel-layout/navbar/NavBar.scss
diff --git a/frontend/src/layout/panel-layout/ai-first/Nav.stories.tsx b/frontend/src/layout/panel-layout/navbar/NavBar.stories.tsx
similarity index 95%
rename from frontend/src/layout/panel-layout/ai-first/Nav.stories.tsx
rename to frontend/src/layout/panel-layout/navbar/NavBar.stories.tsx
index 402d7d899b85..0e481d4ab38e 100644
--- a/frontend/src/layout/panel-layout/ai-first/Nav.stories.tsx
+++ b/frontend/src/layout/panel-layout/navbar/NavBar.stories.tsx
@@ -1,4 +1,4 @@
-import './Nav.scss'
+import './NavBar.scss'
import type { Meta, StoryObj } from '@storybook/react'
import { useActions } from 'kea'
@@ -30,7 +30,7 @@ const MOCK_TOOLS = [
}))
/**
- * Density comes from `data-nav-density`, which `Nav` sets from the user's sidebar setting.
+ * Density comes from `data-nav-density`, which `NavBar` sets from the user's sidebar setting.
* Setting the attribute here keeps the story independent of the user API.
*/
function NavSidebar({ density }: { density: SidebarDensity }): JSX.Element {
diff --git a/frontend/src/layout/panel-layout/ai-first/Nav.tsx b/frontend/src/layout/panel-layout/navbar/NavBar.tsx
similarity index 86%
rename from frontend/src/layout/panel-layout/ai-first/Nav.tsx
rename to frontend/src/layout/panel-layout/navbar/NavBar.tsx
index 2d1cb7f14802..cd2e29402c62 100644
--- a/frontend/src/layout/panel-layout/ai-first/Nav.tsx
+++ b/frontend/src/layout/panel-layout/navbar/NavBar.tsx
@@ -1,13 +1,13 @@
-import './Nav.scss'
+import './NavBar.scss'
import { Tabs } from '@base-ui/react/tabs'
import { cva } from 'cva'
-import { useActions, useMountedLogic, useValues } from 'kea'
+import { useActions, useValues } from 'kea'
import { router } from 'kea-router'
import posthog from 'posthog-js'
import { Suspense, useEffect, useRef } from 'react'
-import { IconApps, IconChat, IconChevronRight, IconPlusSmall } from '@posthog/icons'
+import { IconApps, IconChat, IconChevronRight } from '@posthog/icons'
import { NewAccountMenu } from 'lib/components/Account/NewAccountMenu'
import { commandLogic } from 'lib/components/Command/commandLogic'
@@ -16,15 +16,12 @@ import { ResizerLogicProps, resizerLogic } from 'lib/components/Resizer/resizerL
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
import { useShortcut } from 'lib/components/Shortcuts/useShortcut'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
-import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
import { Collapsible } from 'lib/ui/Collapsible/Collapsible'
-import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from 'lib/ui/DropdownMenu/DropdownMenu'
import { Label } from 'lib/ui/Label/Label'
import { WrappingLoadingSkeleton } from 'lib/ui/WrappingLoadingSkeleton/WrappingLoadingSkeleton'
import { cn } from 'lib/utils/css-classes'
import { lazyWithRetry } from 'lib/utils/retryImport'
-import { newDashboardLogic } from 'scenes/dashboard/newDashboardLogic'
import { urls } from 'scenes/urls'
import {
@@ -38,9 +35,9 @@ import { uiCustomizationLogic } from '~/layout/uiCustomizationLogic'
import { NavSearchBar, NavSearchButton } from '../../../lib/components/NavSearchButton/NavSearchButton'
import { navigation3000Logic } from '../../navigation-3000/navigationLogic'
-import { CreateMenu } from '../menus/CreateMenu'
-import { NavBarFooter } from '../NavBarFooter'
+import { NavBarFooter } from './NavBarFooter'
import { PanelLayoutPanels } from './PanelLayoutPanels'
+import { FlatNavBrowse } from './tabs/flat-nav/FlatNavBrowse'
import { NavTabBrowse } from './tabs/NavTabBrowse'
const NavTabChat = lazyWithRetry(() => import('./tabs/NavTabChat').then((m) => ({ default: m.NavTabChat })))
@@ -106,14 +103,7 @@ const TAB_CONFIG: { id: NavExperimentTab; label: string; icon: JSX.Element }[] =
{ id: 'chat', label: 'Chat', icon: <IconChat className="text-ai" /> },
]
-// Keeps newDashboardLogic mounted while the Create button is visible, so the "Start from scratch"
-// flow completes (and redirects) even after the menu closes and unmounts its own logic reference.
-function CreateMenuLogics(): null {
- useMountedLogic(newDashboardLogic)
- return null
-}
-
-export function Nav(): JSX.Element {
+export function NavBar(): JSX.Element {
const containerRef = useRef<HTMLDivElement | null>(null)
const {
toggleLayoutNavCollapsed,
@@ -133,7 +123,7 @@ export function Nav(): JSX.Element {
const { mobileLayout: isMobileLayout } = useValues(navigation3000Logic)
const { toggleCommand } = useActions(commandLogic)
const { sidebarDensity } = useValues(uiCustomizationLogic)
- const showCreateButton = useFeatureFlag('CREATE_BUTTON_NAV_EXPERIMENT', 'test')
+ const isFlatNavEnabled = useFeatureFlag('FLAT_NAV', 'test')
const resizerLogicProps: ResizerLogicProps = {
logicKey: 'panel-layout-navbar',
@@ -248,36 +238,6 @@ export function Nav(): JSX.Element {
</div>
)}
- {showCreateButton && (
- <div className={cn('px-2 py-1', isLayoutNavCollapsed && 'flex justify-center px-0')}>
- <CreateMenuLogics />
- <DropdownMenu
- onOpenChange={(open) => {
- if (open) {
- posthog.capture('nav create button clicked')
- }
- }}
- >
- <DropdownMenuTrigger asChild>
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconPlusSmall />}
- fullWidth={!isLayoutNavCollapsed}
- center={!isLayoutNavCollapsed}
- title={isLayoutNavCollapsed ? 'Create' : undefined}
- data-attr="nav-create-button"
- >
- {!isLayoutNavCollapsed ? 'Create' : null}
- </LemonButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent side="bottom" align="start" className="min-w-[220px]">
- <CreateMenu />
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- )}
-
<Tabs.Root
className="z-[var(--z-main-nav)] flex flex-col flex-1 overflow-hidden"
value={isLayoutNavCollapsed && navExperimentActiveTab === 'chat' ? 'home' : navExperimentActiveTab}
@@ -331,7 +291,7 @@ export function Nav(): JSX.Element {
<div className="flex-1 overflow-hidden relative">
<Tabs.Panel value="home" className="absolute inset-0 flex flex-col" keepMounted tabIndex={-1}>
- <NavTabBrowse />
+ {isFlatNavEnabled ? <FlatNavBrowse /> : <NavTabBrowse />}
</Tabs.Panel>
{/* Lazy until first activated: the visited list only ever grows, so once
mounted the panel never unmounts — keepMounted then preserves it across
diff --git a/frontend/src/layout/panel-layout/NavBarFooter.tsx b/frontend/src/layout/panel-layout/navbar/NavBarFooter.tsx
similarity index 97%
rename from frontend/src/layout/panel-layout/NavBarFooter.tsx
rename to frontend/src/layout/panel-layout/navbar/NavBarFooter.tsx
index 265f0f117379..42d6c2f9a006 100644
--- a/frontend/src/layout/panel-layout/NavBarFooter.tsx
+++ b/frontend/src/layout/panel-layout/navbar/NavBarFooter.tsx
@@ -14,7 +14,7 @@ import { urls } from 'scenes/urls'
import { uiCustomizationLogic } from '~/layout/uiCustomizationLogic'
-import { InstallationStatusNavButton } from './InstallationStatusNavButton'
+import { InstallationStatusNavButton } from '../InstallationStatusNavButton'
export function NavBarFooter({ isLayoutNavCollapsed }: { isLayoutNavCollapsed: boolean }): JSX.Element {
const isNotificationsEnabled = useFeatureFlag('REAL_TIME_NOTIFICATIONS')
diff --git a/frontend/src/layout/panel-layout/ai-first/NavLink.tsx b/frontend/src/layout/panel-layout/navbar/NavLink.tsx
similarity index 100%
rename from frontend/src/layout/panel-layout/ai-first/NavLink.tsx
rename to frontend/src/layout/panel-layout/navbar/NavLink.tsx
diff --git a/frontend/src/layout/panel-layout/ai-first/NavTabInbox.tsx b/frontend/src/layout/panel-layout/navbar/NavTabInbox.tsx
similarity index 100%
rename from frontend/src/layout/panel-layout/ai-first/NavTabInbox.tsx
rename to frontend/src/layout/panel-layout/navbar/NavTabInbox.tsx
diff --git a/frontend/src/layout/panel-layout/ai-first/PanelLayoutPanels.test.tsx b/frontend/src/layout/panel-layout/navbar/PanelLayoutPanels.test.tsx
similarity index 100%
rename from frontend/src/layout/panel-layout/ai-first/PanelLayoutPanels.test.tsx
rename to frontend/src/layout/panel-layout/navbar/PanelLayoutPanels.test.tsx
diff --git a/frontend/src/layout/panel-layout/ai-first/PanelLayoutPanels.tsx b/frontend/src/layout/panel-layout/navbar/PanelLayoutPanels.tsx
similarity index 100%
rename from frontend/src/layout/panel-layout/ai-first/PanelLayoutPanels.tsx
rename to frontend/src/layout/panel-layout/navbar/PanelLayoutPanels.tsx
diff --git a/frontend/src/layout/panel-layout/ai-first/tabs/NavTabBrowse.tsx b/frontend/src/layout/panel-layout/navbar/tabs/NavTabBrowse.tsx
similarity index 95%
rename from frontend/src/layout/panel-layout/ai-first/tabs/NavTabBrowse.tsx
rename to frontend/src/layout/panel-layout/navbar/tabs/NavTabBrowse.tsx
index a51f551fbcbc..dd9e8f40a53b 100644
--- a/frontend/src/layout/panel-layout/ai-first/tabs/NavTabBrowse.tsx
+++ b/frontend/src/layout/panel-layout/navbar/tabs/NavTabBrowse.tsx
@@ -29,11 +29,12 @@ import { DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator } from 'lib/
import { LinkListItem } from 'lib/ui/LinkListItem/LinkListItem'
import { cn } from 'lib/utils/css-classes'
import { humanFriendlyDetailedTime } from 'lib/utils/datetime'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { urls } from 'scenes/urls'
import { navigationLogic } from '~/layout/navigation/navigationLogic'
-import { NavLink } from '~/layout/panel-layout/ai-first/NavLink'
+import { NavLink } from '~/layout/panel-layout/navbar/NavLink'
import { PanelLayoutNavIdentifier, panelLayoutLogic } from '~/layout/panel-layout/panelLayoutLogic'
import { customProductsLogic } from '~/layout/panel-layout/ProjectTree/customProductsLogic'
import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'
@@ -45,7 +46,7 @@ import { FileSystemEntry, FileSystemIconType } from '~/queries/schema/schema-gen
import { ActivityTab } from '~/types'
import { BrowserLikeMenuItems } from '../../ProjectTree/menus/BrowserLikeMenuItems'
-import { PanelIndicatorIcon, SectionTrigger } from '../Nav'
+import { PanelIndicatorIcon, SectionTrigger } from '../NavBar'
import { editToolsLogic } from './editToolsLogic'
import { navRecentsLogic } from './navRecentsLogic'
@@ -178,6 +179,7 @@ export function NavTabBrowse(): JSX.Element {
const { isEditMode, checkedTools } = useValues(editToolsLogic)
const { enterEditMode, saveAndExitEditMode, toggleTool } = useActions(editToolsLogic)
const { showConfigureHomeModal } = useActions(navigationLogic)
+ const { reportNavItemClicked } = useActions(eventUsageLogic)
const currentPath = removeProjectIdIfPresent(pathname)
function handlePanelTriggerClick(item: PanelLayoutNavIdentifier): void {
@@ -221,7 +223,7 @@ export function NavTabBrowse(): JSX.Element {
icon={<IconHome />}
isCollapsed={isLayoutNavCollapsed}
data-attr="nav-item-home"
- onClick={() => posthog.capture('nav item clicked', { item: 'home' })}
+ onClick={() => reportNavItemClicked('home', 'primary')}
sideAction={{
onClick: () =>
uiCustomizationEnabled
@@ -241,7 +243,7 @@ export function NavTabBrowse(): JSX.Element {
isCollapsed={isLayoutNavCollapsed}
data-attr="nav-item-inbox"
tag="beta"
- onClick={() => posthog.capture('nav item clicked', { item: 'inbox' })}
+ onClick={() => reportNavItemClicked('inbox', 'primary')}
/>
)}
@@ -251,7 +253,7 @@ export function NavTabBrowse(): JSX.Element {
icon={<IconClock />}
isCollapsed={isLayoutNavCollapsed}
data-attr="nav-item-activity"
- onClick={() => posthog.capture('nav item clicked', { item: 'activity' })}
+ onClick={() => reportNavItemClicked('activity', 'primary')}
/>
<div className={cn('flex flex-col gap-px', isLayoutNavCollapsed && 'items-center')}>
@@ -356,6 +358,7 @@ export function NavTabBrowse(): JSX.Element {
className: 'group -outline-offset-2 pr-0',
}}
data-attr={`nav-recent-item-${item.id}`}
+ onClick={() => reportNavItemClicked('recent', 'recents', item.type)}
>
<LinkListItem.Content
icon={iconForType(item.type as FileSystemIconType)}
@@ -450,6 +453,14 @@ export function NavTabBrowse(): JSX.Element {
) : (
<ProjectTree
root={!uiCustomizationEnabled && isEditMode ? 'products://' : 'custom-products://'}
+ onItemClicked={(item) => {
+ // In edit mode a row click toggles a checkbox, which is not navigation
+ if (!uiCustomizationEnabled && isEditMode) {
+ return
+ }
+
+ reportNavItemClicked(item?.record?.path ?? 'unknown', 'tools')
+ }}
onlyTree
treeSize={isLayoutNavCollapsed ? 'narrow' : 'default'}
selectModeOverride={!uiCustomizationEnabled && isEditMode ? 'multi' : undefined}
diff --git a/frontend/src/layout/panel-layout/ai-first/tabs/NavTabChat.test.ts b/frontend/src/layout/panel-layout/navbar/tabs/NavTabChat.test.ts
similarity index 100%
rename from frontend/src/layout/panel-layout/ai-first/tabs/NavTabChat.test.ts
rename to frontend/src/layout/panel-layout/navbar/tabs/NavTabChat.test.ts
diff --git a/frontend/src/layout/panel-layout/ai-first/tabs/NavTabChat.tsx b/frontend/src/layout/panel-layout/navbar/tabs/NavTabChat.tsx
similarity index 100%
rename from frontend/src/layout/panel-layout/ai-first/tabs/NavTabChat.tsx
rename to frontend/src/layout/panel-layout/navbar/tabs/NavTabChat.tsx
diff --git a/frontend/src/layout/panel-layout/ai-first/tabs/editToolsLogic.ts b/frontend/src/layout/panel-layout/navbar/tabs/editToolsLogic.ts
similarity index 100%
rename from frontend/src/layout/panel-layout/ai-first/tabs/editToolsLogic.ts
rename to frontend/src/layout/panel-layout/navbar/tabs/editToolsLogic.ts
diff --git a/frontend/src/layout/panel-layout/flat-nav/FlatNav.scss b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavBrowse.scss
similarity index 58%
rename from frontend/src/layout/panel-layout/flat-nav/FlatNav.scss
rename to frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavBrowse.scss
index 997a93244a5e..44a5d2961655 100644
--- a/frontend/src/layout/panel-layout/flat-nav/FlatNav.scss
+++ b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavBrowse.scss
@@ -1,4 +1,4 @@
-.FlatNav[data-nav-density='compact'] {
+.FlatNavBrowse[data-nav-density='compact'] {
--button-height-base: var(--button-height-xs);
.button-primitive {
@@ -6,7 +6,7 @@
}
}
-.FlatNav .show-scrollbar-on-hover::-webkit-scrollbar {
+.FlatNavBrowse .show-scrollbar-on-hover::-webkit-scrollbar {
width: 6px;
height: 6px;
}
diff --git a/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavBrowse.stories.tsx b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavBrowse.stories.tsx
new file mode 100644
index 000000000000..fc57774d4812
--- /dev/null
+++ b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavBrowse.stories.tsx
@@ -0,0 +1,26 @@
+import type { Meta, StoryObj } from '@storybook/react'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+
+import { FlatNavBrowse } from './FlatNavBrowse'
+
+type Story = StoryObj<typeof FlatNavBrowse>
+
+const meta: Meta<typeof FlatNavBrowse> = {
+ title: 'Layout/Flat Nav Browse',
+ component: FlatNavBrowse,
+ parameters: {
+ layout: 'fullscreen',
+ viewMode: 'story',
+ featureFlags: { [FEATURE_FLAGS.FLAT_NAV]: 'test' },
+ },
+ render: () => (
+ <div className="h-screen w-[var(--project-navbar-width)] flex flex-col">
+ <FlatNavBrowse />
+ </div>
+ ),
+}
+
+export default meta
+
+export const Default: Story = {}
diff --git a/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavBrowse.tsx b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavBrowse.tsx
new file mode 100644
index 000000000000..67556cfd0d07
--- /dev/null
+++ b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavBrowse.tsx
@@ -0,0 +1,89 @@
+import './FlatNavBrowse.scss'
+
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+
+import { IconClock, IconHome, IconNotification } from '@posthog/icons'
+
+import { ScrollableShadows } from 'lib/components/ScrollableShadows/ScrollableShadows'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { cn } from 'lib/utils/css-classes'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
+import { urls } from 'scenes/urls'
+
+import { navigationLogic } from '~/layout/navigation/navigationLogic'
+import { panelLayoutLogic } from '~/layout/panel-layout/panelLayoutLogic'
+import { uiCustomizationLogic } from '~/layout/uiCustomizationLogic'
+import { ActivityTab } from '~/types'
+
+import { NavLink } from '../../NavLink'
+import { FlatNavPanelButtons } from './FlatNavPanelButtons'
+import { FlatNavProducts } from './FlatNavProducts'
+import { FlatNavRecents } from './FlatNavRecents'
+
+export function FlatNavBrowse(): JSX.Element {
+ const { isLayoutNavCollapsed } = useValues(panelLayoutLogic)
+ const { sidebarDensity, isSidebarSectionShown, isSidebarItemShown, uiCustomizationEnabled } =
+ useValues(uiCustomizationLogic)
+ const { showConfigureHomeModal } = useActions(navigationLogic)
+ const { reportNavItemClicked } = useActions(eventUsageLogic)
+ const isProductAutonomyEnabled = useFeatureFlag('PRODUCT_AUTONOMY')
+
+ return (
+ <div className="FlatNavBrowse flex flex-col flex-1 overflow-hidden" data-nav-density={sidebarDensity}>
+ <ScrollableShadows
+ className="flex-1"
+ innerClassName="overflow-y-auto overflow-x-hidden pl-2 pr-0.5 pt-1 focus-visible:outline-accent -outline-offset-2"
+ direction="vertical"
+ styledScrollbars
+ >
+ <div className={cn('flex flex-col gap-px', isLayoutNavCollapsed && 'items-center')}>
+ {isSidebarItemShown('home') && (
+ <NavLink
+ to={urls.projectRoot()}
+ label="Home"
+ icon={<IconHome />}
+ isCollapsed={isLayoutNavCollapsed}
+ data-attr="nav-item-home"
+ onClick={() => reportNavItemClicked('home', 'primary')}
+ sideAction={{
+ onClick: () =>
+ uiCustomizationEnabled
+ ? router.actions.push(urls.settings('user-navigation', 'homepage'))
+ : showConfigureHomeModal(),
+ tooltip: 'Configure home',
+ 'data-attr': 'nav-configure-home',
+ }}
+ />
+ )}
+
+ {isProductAutonomyEnabled && isSidebarItemShown('inbox') && (
+ <NavLink
+ to={urls.inbox()}
+ label="Self-driving"
+ icon={<IconNotification />}
+ isCollapsed={isLayoutNavCollapsed}
+ data-attr="nav-item-inbox"
+ tag="beta"
+ onClick={() => reportNavItemClicked('inbox', 'primary')}
+ />
+ )}
+
+ <NavLink
+ to={urls.activity(ActivityTab.ExploreEvents)}
+ label="Activity"
+ icon={<IconClock />}
+ isCollapsed={isLayoutNavCollapsed}
+ data-attr="nav-item-activity"
+ onClick={() => reportNavItemClicked('activity', 'primary')}
+ />
+
+ <FlatNavPanelButtons />
+ </div>
+
+ {!isLayoutNavCollapsed && isSidebarSectionShown('recents') && <FlatNavRecents />}
+ {!isLayoutNavCollapsed && isSidebarSectionShown('my_tools') && <FlatNavProducts />}
+ </ScrollableShadows>
+ </div>
+ )
+}
diff --git a/frontend/src/layout/panel-layout/flat-nav/FlatNavPanelButtons.tsx b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavPanelButtons.tsx
similarity index 98%
rename from frontend/src/layout/panel-layout/flat-nav/FlatNavPanelButtons.tsx
rename to frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavPanelButtons.tsx
index caa1e657b0ad..05498c4029ca 100644
--- a/frontend/src/layout/panel-layout/flat-nav/FlatNavPanelButtons.tsx
+++ b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavPanelButtons.tsx
@@ -6,10 +6,11 @@ import { IconApps, IconChevronRight, IconDatabase, IconFolderOpen, IconStar } fr
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
import { cn } from 'lib/utils/css-classes'
-import { PanelIndicatorIcon } from '~/layout/panel-layout/ai-first/Nav'
import { PanelLayoutNavIdentifier, panelLayoutLogic } from '~/layout/panel-layout/panelLayoutLogic'
import { SidebarItemKey, uiCustomizationLogic } from '~/layout/uiCustomizationLogic'
+import { PanelIndicatorIcon } from '../../NavBar'
+
const PANEL_TRIGGER_ITEMS: {
identifier: PanelLayoutNavIdentifier
configKey: SidebarItemKey
diff --git a/frontend/src/layout/panel-layout/flat-nav/FlatNavProducts.tsx b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavProducts.tsx
similarity index 91%
rename from frontend/src/layout/panel-layout/flat-nav/FlatNavProducts.tsx
rename to frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavProducts.tsx
index ca1e28ace749..09259689d8a4 100644
--- a/frontend/src/layout/panel-layout/flat-nav/FlatNavProducts.tsx
+++ b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavProducts.tsx
@@ -1,4 +1,4 @@
-import { useValues } from 'kea'
+import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'
import { Fragment } from 'react'
@@ -7,11 +7,12 @@ import { IconGear } from '@posthog/icons'
import { Link } from 'lib/lemon-ui/Link'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
import { WrappingLoadingSkeleton } from 'lib/ui/WrappingLoadingSkeleton/WrappingLoadingSkeleton'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { urls } from 'scenes/urls'
-import { NavLink } from '~/layout/panel-layout/ai-first/NavLink'
import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'
+import { NavLink } from '../../NavLink'
import { flatNavLogic } from './flatNavLogic'
import { FlatNavSection } from './FlatNavSection'
@@ -21,6 +22,7 @@ function slugify(path: string): string {
export function FlatNavProducts(): JSX.Element {
const { productGroups, customProductsLoading } = useValues(flatNavLogic)
+ const { reportNavItemClicked } = useActions(eventUsageLogic)
return (
<FlatNavSection
@@ -66,7 +68,7 @@ export function FlatNavProducts(): JSX.Element {
isCollapsed={false}
tag={item.tag}
data-attr={`flat-nav-tool-${slugify(item.path)}`}
- onClick={() => posthog.capture('nav item clicked', { item: item.path })}
+ onClick={() => reportNavItemClicked(item.path, 'tools')}
/>
))}
</Fragment>
diff --git a/frontend/src/layout/panel-layout/flat-nav/FlatNavRecents.tsx b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavRecents.tsx
similarity index 83%
rename from frontend/src/layout/panel-layout/flat-nav/FlatNavRecents.tsx
rename to frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavRecents.tsx
index be02b69afa97..16727d67b7d0 100644
--- a/frontend/src/layout/panel-layout/flat-nav/FlatNavRecents.tsx
+++ b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavRecents.tsx
@@ -1,13 +1,14 @@
-import { useValues } from 'kea'
+import { useActions, useValues } from 'kea'
import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'
+import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
-import { NavLink } from '~/layout/panel-layout/ai-first/NavLink'
-import { navRecentsLogic } from '~/layout/panel-layout/ai-first/tabs/navRecentsLogic'
import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'
import { splitPath, unescapePath } from '~/layout/panel-layout/ProjectTree/utils'
import { FileSystemEntry, FileSystemIconType } from '~/queries/schema/schema-general'
+import { NavLink } from '../../NavLink'
+import { navRecentsLogic } from '../navRecentsLogic'
import { FlatNavSection } from './FlatNavSection'
function getItemName(item: FileSystemEntry): string {
@@ -17,6 +18,7 @@ function getItemName(item: FileSystemEntry): string {
export function FlatNavRecents(): JSX.Element {
const { recentItems, recentItemsLoading } = useValues(navRecentsLogic)
+ const { reportNavItemClicked } = useActions(eventUsageLogic)
return (
<FlatNavSection label="Recents" info="Items you viewed recently, most recent first.">
@@ -36,6 +38,7 @@ export function FlatNavRecents(): JSX.Element {
icon={iconForType(item.type as FileSystemIconType)}
isCollapsed={false}
data-attr={`nav-recent-item-${item.id}`}
+ onClick={() => reportNavItemClicked('recent', 'recents', item.type)}
/>
))
)}
diff --git a/frontend/src/layout/panel-layout/flat-nav/FlatNavSection.tsx b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavSection.tsx
similarity index 100%
rename from frontend/src/layout/panel-layout/flat-nav/FlatNavSection.tsx
rename to frontend/src/layout/panel-layout/navbar/tabs/flat-nav/FlatNavSection.tsx
diff --git a/frontend/src/layout/panel-layout/flat-nav/flatNavLogic.ts b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/flatNavLogic.ts
similarity index 98%
rename from frontend/src/layout/panel-layout/flat-nav/flatNavLogic.ts
rename to frontend/src/layout/panel-layout/navbar/tabs/flat-nav/flatNavLogic.ts
index c79dbaa0f898..a6646c8118d7 100644
--- a/frontend/src/layout/panel-layout/flat-nav/flatNavLogic.ts
+++ b/frontend/src/layout/panel-layout/navbar/tabs/flat-nav/flatNavLogic.ts
@@ -44,7 +44,7 @@ export interface flatNavLogicMeta {
export type flatNavLogicType = MakeLogicType<flatNavLogicValues, {}, Record<string, any>, flatNavLogicMeta>
export const flatNavLogic = kea<flatNavLogicType>([
- path(['layout', 'panel-layout', 'flat-nav', 'flatNavLogic']),
+ path(['layout', 'panel-layout', 'navbar', 'tabs', 'flat-nav', 'flatNavLogic']),
connect(() => ({
values: [customProductsLogic, ['customProducts', 'customProductsLoading'], featureFlagLogic, ['featureFlags']],
})),
@@ -88,6 +88,7 @@ export const flatNavLogic = kea<flatNavLogicType>([
a.sortOrder - b.sortOrder ||
a.label.localeCompare(b.label, undefined, { sensitivity: 'accent' })
)
+
const groups: FlatNavProductGroup[] = []
for (const { category, sortOrder: _, ...item } of selected) {
const lastGroup = groups[groups.length - 1]
@@ -97,6 +98,7 @@ export const flatNavLogic = kea<flatNavLogicType>([
groups.push({ category, items: [item] })
}
}
+
return groups
},
],
diff --git a/frontend/src/layout/panel-layout/ai-first/tabs/navRecentsLogic.ts b/frontend/src/layout/panel-layout/navbar/tabs/navRecentsLogic.ts
similarity index 100%
rename from frontend/src/layout/panel-layout/ai-first/tabs/navRecentsLogic.ts
rename to frontend/src/layout/panel-layout/navbar/tabs/navRecentsLogic.ts
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index f64ceae3770a..55d631882171 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -180,14 +180,6 @@ export const FEATURE_FLAGS = {
CHRISTMAS_OVERRIDE: 'christmas-override', // owner: #team-growth, overrides the checks for Christmas to return true when this is enabled
HALLOWEEN_OVERRIDE: 'halloween-override', // owner: #team-growth, overrides the checks for Halloween to return true when this is enabled
- // UX flags, used to control the UX of the app
- CREATE_BUTTON_NAV_EXPERIMENT: 'create-button-nav-experiment', // owner: #team-platform-ux multivariate=control,test — adds a Create dropdown to the top of the Browse tab in the left nav
- FLAT_NAV: 'flat-nav', // owner: @rafaeelaudibert #team-growth, swaps the tree-based left nav for the flat sidebar, see FlatNav.tsx
- GITHUB_FIRST_SELF_DRIVING_ONBOARDING: 'github-first-self-driving-onboarding', // owner: #team-self-driving
- INBOX_SELF_DRIVING_EMPTY_STATE: 'inbox-self-driving-empty-state',
- STARRED_REORDER: 'starred-reorder', // owner: #team-platform-ux, drag-and-drop reorder of starred shortcuts in the side panel
- UX_HIDE_PROJECT_NOTICE: 'ux-hide-project-notice', // owner: #team-platform-ux, hides the project notice banner across all scenes
-
// Feature flags used to control opt-in for different behaviors, should not be removed
ACCESS_CONTROL_DETAIL_PANEL: 'access-control-detail-panel', // owner: @a-lider #team-platform-features, gates the member and role access detail side panel
ACCESS_CONTROL_RESOLUTION_PREVIEW: 'access-control-resolution-preview', // owner: @a-lider #team-platform-features, gates the access resolution preview settings section and its banner
@@ -352,12 +344,15 @@ export const FEATURE_FLAGS = {
FIELD_NOTES: 'field-notes', // owner: @adamleith
FLAG_EVALUATION_TAGS: 'flag-evaluation-tags', // owner: @dmarticus #team-feature-flags
FLAGGED_FEATURE_INDICATOR: 'flagged-feature-indicator', // owner: @benjackwhite
+ FLAT_NAV: 'flat-nav', // owner: @rafaeelaudibert #team-growth multivariate=control,test, swaps the tree-based Browse tab for the flat sidebar, see FlatNavBrowse.tsx
+ GITHUB_FIRST_SELF_DRIVING_ONBOARDING: 'github-first-self-driving-onboarding', // owner: #team-self-driving
GITHUB_WORKFLOW_TRIGGERS: 'github-workflow-triggers', // owner: #team-workflows-cdp
GROUP_PROFILE_EXPERIMENT: 'group-profile-experiment', // owner: @arthurdedeus #team-customer-analytics
HEALTH_ASK_AI: 'health-ask-ai', // owner: @jordanm-posthog #team-web-analytics, gates the "Ask PostHog AI" buttons on the Health overview
HOGQL_WAREHOUSE_ACCESS_CONTROL: 'hogql-warehouse-access-control', // owner: @a-lider #team-platform-features, gates per-object access control for warehouse tables and views
IDENTITY_MATCHING: 'identity-matching', // owner: @fercgomes #team-growth, gates new identity matching scene on marketing analytics
INBOX_REDESIGN: 'inbox-redesign', // owner: #team-self-driving, gates the inbox redesign: report sections, triage mode, the Settings tab, and scout cards
+ INBOX_SELF_DRIVING_EMPTY_STATE: 'inbox-self-driving-empty-state',
INBOX_SLACK_NOTIFICATIONS: 'inbox-slack-notifications', // owner: #team-self-driving, gates the Slack notifications config card in the inbox
INSIGHT_DRAG_TO_ZOOM: 'insight-drag-to-zoom', // owner: @sampennington #team-product-analytics, gates x-axis drag-to-zoom on insight charts (trends today, SQL to follow)
INSIGHT_EXPORT_NUDGE: 'insight-export-nudge', // owner: #team-analytics-platform multivariate=control,test, nudges people who just exported an insight toward a recurring subscription
@@ -537,6 +532,7 @@ export const FEATURE_FLAGS = {
UI_CUSTOMIZATION: 'ui-customization-enabled', // owner: @fercgomes #team-self-driving, gates sidebar/homepage UI customization
UNIFIED_APM_PRODUCT: 'unified-apm-product', // owner: #team-apm (@jonmcwest, @frankh), gates the shared APM product backing logs, tracing, and metrics
USER_INTERVIEWS: 'user-interviews', // owner: @Twixes @jurajmajerik
+ UX_HIDE_PROJECT_NOTICE: 'ux-hide-project-notice', // owner: #team-platform-ux, hides the project notice banner across all scenes
UX_REMOVE_SIDEPANEL: 'ux-remove-sidepanel', // owner: #team-surveys
VISION_ENTRYPOINT_EXPERIMENTS: 'vision-entrypoint-experiments', // owner: #team-replay, cross-sell entry points from experiments
VISION_GOAL_BASED_CREATION_FLOW: 'vision-goal-based-creation-flow', // owner: #team-replay multivariate=control,test — gate on === 'test'; a truthy check turns on for control too
diff --git a/frontend/src/lib/utils/eventUsageLogic.ts b/frontend/src/lib/utils/eventUsageLogic.ts
index c072280e224c..ef15d1c0779c 100644
--- a/frontend/src/lib/utils/eventUsageLogic.ts
+++ b/frontend/src/lib/utils/eventUsageLogic.ts
@@ -1773,6 +1773,15 @@ export interface eventUsageLogicActions {
reportMediaPreviewUploaded: (source: string) => {
source: string
}
+ reportNavItemClicked: (
+ item: string,
+ section: string,
+ itemType?: string | null
+ ) => {
+ item: string
+ itemType: string | null | undefined
+ section: string
+ }
reportNavbarStarredItemAdded: (
itemType: string,
itemName: string
@@ -3225,6 +3234,12 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportUsageMetricCreated: () => true,
reportUsageMetricUpdated: () => true,
reportUsageMetricDeleted: () => true,
+ // left nav
+ reportNavItemClicked: (item: string, section: string, itemType?: string | null) => ({
+ item,
+ section,
+ itemType,
+ }),
// navbar starred
reportNavbarStarredItemAdded: (itemType: string, itemName: string) => ({
itemType,
@@ -4900,6 +4915,13 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
const eventName = delay ? 'person profile analyzed' : 'person profile viewed'
posthog.capture(eventName, { delay })
},
+ reportNavItemClicked: ({ item, section, itemType }) => {
+ posthog.capture('nav item clicked', {
+ item,
+ section,
+ item_type: itemType ?? null,
+ })
+ },
reportNavbarStarredItemAdded: ({ itemType, itemName }) => {
posthog.capture('navbar starred item added', {
item_type: itemType,