: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
feat(nav): label each second-level nav panel with a data-attr (#95573)
Paul D'Ambra755c440dfa08
diff --git a/frontend/src/layout/panel-layout/PanelLayoutPanel.tsx b/frontend/src/layout/panel-layout/PanelLayoutPanel.tsxindex 8ae37050fd40..a53a26a7fcb5 100644--- a/frontend/src/layout/panel-layout/PanelLayoutPanel.tsx+++ b/frontend/src/layout/panel-layout/PanelLayoutPanel.tsx@@ -20,6 +20,8 @@ import { panelLayoutLogic } from '~/layout/panel-layout/panelLayoutLogic'import { navigation3000Logic } from '../navigation-3000/navigationLogic'interface PanelLayoutPanelProps {+ /** Names the panel in the DOM, so click maps and analytics can scope to one second-level nav. */+ panelName: stringsearchPlaceholder?: stringpanelActionsNewSceneLayout?: (ButtonPrimitiveProps | null | undefined)[]children: React.ReactNode@@ -57,6 +59,7 @@ const panelLayoutPanelVariants = cva({})export function PanelLayoutPanel({+ panelName,searchField,panelActionsNewSceneLayout,children,@@ -84,6 +87,7 @@ export function PanelLayoutPanel({}))}ref={containerRef}+ data-attr={`nav-panel-${panelName}`}><divclassName={cn(diff --git a/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.stories.tsx b/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.stories.tsxindex 13f4816df78f..f15a8cbbb3c9 100644--- a/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.stories.tsx+++ b/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.stories.tsx@@ -4,7 +4,7 @@ import { FEATURE_FLAGS } from 'lib/constants'import { ProjectTree, ProjectTreeProps } from './ProjectTree'-interface StoryProps extends ProjectTreeProps {+type StoryProps = ProjectTreeProps & {enableCustomProductsFlag?: boolean}diff --git a/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx b/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsxindex b20932aec7c7..e07ae80f0e85 100644--- a/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx+++ b/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx@@ -39,10 +39,9 @@ import { TreeSearchField } from './TreeSearchField'import { TreeSortDropdownMenu } from './TreeSortDropdownMenu'import { calculateMovePath } from './utils'-export interface ProjectTreeProps {+interface ProjectTreeBaseProps {logicKey?: string // key override?root?: string- onlyTree?: booleanshowRecents?: boolean // whether to show recents in the treesearchPlaceholder?: stringtreeSize?: LemonTreeSize@@ -61,6 +60,17 @@ export interface ProjectTreeProps {isActiveInPanel?: boolean}+/** A bare tree has no panel to label, so `panelName` is only required when the panel renders. */+export type ProjectTreeProps = ProjectTreeBaseProps &+ (+ | { onlyTree: true; panelName?: string }+ | {+ onlyTree?: false+ /** Names the panel in the DOM. Pin it at the call site; a `data-attr` value is API and must not change. */+ panelName: string+ }+ )+export const PROJECT_TREE_KEY = 'project-tree'let counter = 0@@ -95,19 +105,20 @@ const isItemActive = (item: TreeDataItem): boolean => {return false}-export function ProjectTree({- logicKey,- root,- onlyTree = false,- searchPlaceholder,- treeSize = 'default',- showRecents,- selectModeOverride,- checkedItemsOverride,- onItemCheckedOverride,- onItemClicked,- isActiveInPanel,-}: ProjectTreeProps): JSX.Element {+export function ProjectTree(props: ProjectTreeProps): JSX.Element {+ const {+ logicKey,+ root,+ onlyTree = false,+ searchPlaceholder,+ treeSize = 'default',+ showRecents,+ selectModeOverride,+ checkedItemsOverride,+ onItemCheckedOverride,+ onItemClicked,+ isActiveInPanel,+ } = propsconst [uniqueKey] = useState(() => `project-tree-${counter++}`)const { viableItems, shortcutEntryIdMap } = useValues(projectTreeDataLogic)const { reorderShortcutByDrag } = useActions(projectTreeDataLogic)@@ -588,12 +599,13 @@ export function ProjectTree({/>)- if (onlyTree) {+ if (props.onlyTree) {return tree}return (<PanelLayoutPanel+ panelName={props.panelName}searchField={<BindLogic logic={projectTreeLogic} props={projectTreeLogicProps}><TreeSearchFielddiff --git a/frontend/src/layout/panel-layout/navbar/PanelLayoutPanels.tsx b/frontend/src/layout/panel-layout/navbar/PanelLayoutPanels.tsxindex bba8a915dd3d..8a3a83942a65 100644--- a/frontend/src/layout/panel-layout/navbar/PanelLayoutPanels.tsx+++ b/frontend/src/layout/panel-layout/navbar/PanelLayoutPanels.tsx@@ -34,6 +34,7 @@ export function PanelLayoutPanels(): JSX.Element | null {() => ({DataAndPeople: (<ProjectTree+ panelName="data-and-people"root="data-and-people://"searchPlaceholder="Search data"isActiveInPanel={activePanelIdentifier === 'DataAndPeople'}@@ -41,6 +42,7 @@ export function PanelLayoutPanels(): JSX.Element | null {),Project: (<ProjectTree+ panelName="project"root="project://"logicKey={PROJECT_TREE_KEY}searchPlaceholder="Search files"@@ -50,6 +52,7 @@ export function PanelLayoutPanels(): JSX.Element | null {),Products: (<ProjectTree+ panelName="products"root="products://"searchPlaceholder="Search tools"isActiveInPanel={activePanelIdentifier === 'Products'}@@ -57,13 +60,17 @@ export function PanelLayoutPanels(): JSX.Element | null {),Shortcuts: (<ProjectTree+ panelName="shortcuts"root="shortcuts://"searchPlaceholder="Search starred items"isActiveInPanel={activePanelIdentifier === 'Shortcuts'}/>),Chat: (- <div className="pointer-events-auto flex flex-col h-full min-h-screen max-h-screen bg-surface-tertiary border-r overflow-hidden w-[var(--project-panel-width)]">+ <div+ className="pointer-events-auto flex flex-col h-full min-h-screen max-h-screen bg-surface-tertiary border-r overflow-hidden w-[var(--project-panel-width)]"+ data-attr="nav-panel-chat"+ ><Suspensefallback={<div className="flex flex-col gap-px px-1 pt-2">diff --git a/frontend/src/lib/components/NotificationsMenu/NotificationsPanel.tsx b/frontend/src/lib/components/NotificationsMenu/NotificationsPanel.tsxindex a8240661e4cf..09846697a16d 100644--- a/frontend/src/lib/components/NotificationsMenu/NotificationsPanel.tsx+++ b/frontend/src/lib/components/NotificationsMenu/NotificationsPanel.tsx@@ -119,7 +119,7 @@ export function NotificationsPanel(): JSX.Element {]return (- <PanelLayoutPanel searchField={header} panelActionsNewSceneLayout={panelActions}>+ <PanelLayoutPanel panelName="notifications" searchField={header} panelActionsNewSceneLayout={panelActions}><ScrollableShadowsdirection="vertical"styledScrollbars