: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(today): breadcrumb title row and menu bar below scene title (#114327)
Adam Leithb8c63ac2cb02
diff --git a/frontend/src/layout/navigation-3000/sidepanel/AGENTS.md b/frontend/src/layout/navigation-3000/sidepanel/AGENTS.mdnew file mode 100644index 000000000000..1674b4ecf687--- /dev/null+++ b/frontend/src/layout/navigation-3000/sidepanel/AGENTS.md@@ -0,0 +1,16 @@+# Side panel agent guide (`frontend/src/layout/navigation-3000/sidepanel`)++The side panel is the right-hand panel with tabs for PostHog AI, Info, Notebooks, Discussion, Activity, Access control and Support.+`sidePanelLogic.tsx` decides which tabs a scene gets.++## Under `today-rail-nav`, several tabs are on their way out++The `today-rail-nav` flag gates a redesign of the whole web app UI.+Under that flag the side panel shrinks, and its tabs move to other surfaces:++- **Info** renders the scene's `ScenePanel`. It is deprecated and will be removed, and the `SceneMenuBar` takes over its actions. See [`layout/scenes/AGENTS.md`](../../scenes/AGENTS.md) when you change a scene's actions.+- **Support** opens from the menu bar's Help menu instead of a tab bar button.+- **Notebooks** and **Discussion** are hidden from the tab bar (`visibleTabs`). Their panels still open from their existing entry points, such as a comment button or "Add to notebook". They will be removed from the side panel or moved; the new home is not decided yet.++Do not build new features on the Info, Notebooks or Discussion tabs.+A change to them must keep working with the flag off, because the current UI still ships them.diff --git a/frontend/src/layout/navigation-3000/sidepanel/CLAUDE.md b/frontend/src/layout/navigation-3000/sidepanel/CLAUDE.mdnew file mode 120000index 000000000000..47dc3e3d863c--- /dev/null+++ b/frontend/src/layout/navigation-3000/sidepanel/CLAUDE.md@@ -0,0 +1 @@+AGENTS.md\ No newline at end of filediff --git a/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsx b/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsxindex 714e0f28c4e9..c6f1a6501c5d 100644--- a/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsx+++ b/frontend/src/layout/navigation-3000/sidepanel/sidePanelLogic.tsx@@ -109,7 +109,11 @@ export interface sidePanelLogicMeta {hasAvailableFeature: (feature: AvailableFeature, currentUsage?: number | undefined) => boolean, // userLogicisAccessControlSettings: boolean) => SidePanelTab[]- visibleTabs: (enabledTabs: SidePanelTab[], sceneSidePanelContext: SidePanelSceneContext) => SidePanelTab[]+ visibleTabs: (+ enabledTabs: SidePanelTab[],+ sceneSidePanelContext: SidePanelSceneContext,+ featureFlags: FeatureFlagsSet+ ) => SidePanelTab[]}}@@ -232,12 +236,20 @@ export const sidePanelLogic = kea<sidePanelLogicType>([/** Tabs shown in the navigation bar */visibleTabs: [- (s) => [s.enabledTabs, s.sceneSidePanelContext],- (enabledTabs: SidePanelTab[], sceneSidePanelContext: SidePanelSceneContext): SidePanelTab[] => {+ (s) => [s.enabledTabs, s.sceneSidePanelContext, s.featureFlags],+ (+ enabledTabs: SidePanelTab[],+ sceneSidePanelContext: SidePanelSceneContext,+ featureFlags: FeatureFlagsSet+ ): SidePanelTab[] => {// Some tabs are openable programmatically but not shown in the nav barconst hiddenTabs: SidePanelTab[] = sceneSidePanelContext.canvas_id? [SidePanelTab.Exports, SidePanelTab.Support]: [SidePanelTab.Exports]+ // The Today layout has no home for these tabs yet. They stay openable from their entry points.+ if (featureFlags[FEATURE_FLAGS.TODAY_RAIL_NAV]) {+ hiddenTabs.push(SidePanelTab.Discussion, SidePanelTab.Notebooks)+ }return enabledTabs.filter((tab) => !hiddenTabs.includes(tab))},],diff --git a/frontend/src/layout/scenes/AGENTS.md b/frontend/src/layout/scenes/AGENTS.mdindex 047e52852114..a6e90603d5b5 100644--- a/frontend/src/layout/scenes/AGENTS.md+++ b/frontend/src/layout/scenes/AGENTS.md@@ -7,11 +7,16 @@ This directory owns the **scene action surfaces**:This is the **legacy** action surface.- **`SceneMenuBar`** (`components/SceneMenuBar.tsx`): the Mac-style menu bar above `<SceneTitleSection>`that consolidates those actions into File / Edit / View / Metadata / Staff only menus. This is the- **new** action surface, gated behind the `SCENE_MENU_BAR` feature flag.+ **new** action surface, gated behind the `SCENE_MENU_BAR` feature flag. Under the `today-rail-nav` flag+ the bar moves itself below the title row, so scenes still render it above `<SceneTitleSection>`.We are mid-migration (`ScenePanel` to `SceneMenuBar`). Until the flag ships everywhere, **both surfacesmust stay in sync**.+**`ScenePanel` is deprecated under `today-rail-nav`.** That redesign will remove the side panel's Info tab,+which renders `ScenePanel`, and the `SceneMenuBar` takes over every action. Keep the dual-write while+the flag-off UI still ships, but build no new surface on `ScenePanel` and treat it as scheduled for removal.+## Rule: every scene action goes in the SceneMenuBarWhen you add, edit, or remove any action/feature on a scene's `ScenePanel` (a button, toggle, link,diff --git a/frontend/src/layout/scenes/SceneLayout.tsx b/frontend/src/layout/scenes/SceneLayout.tsxindex e826da5488d2..2cef94b16d7b 100644--- a/frontend/src/layout/scenes/SceneLayout.tsx+++ b/frontend/src/layout/scenes/SceneLayout.tsx@@ -11,6 +11,7 @@ import { Label, LabelProps } from 'lib/ui/Label/Label'import { cn } from 'lib/utils/css-classes'import { SceneConfig } from 'scenes/sceneTypes'+import { SceneMenuBarSlotProvider } from './components/SceneMenuBarSlotProvider'import { sceneLayoutLogic } from './sceneLayoutLogic'type SceneLayoutProps = {@@ -78,10 +79,10 @@ export function SceneLayout({ children, sceneConfig }: SceneLayoutProps): JSX.El}, [sceneConfig, setSceneLayoutConfig])return (- <>+ <SceneMenuBarSlotProvider>{children}<ShortcutMenu />- </>+ </SceneMenuBarSlotProvider>)}diff --git a/frontend/src/layout/scenes/components/QuillSceneHeader.tsx b/frontend/src/layout/scenes/components/QuillSceneHeader.tsxindex 6fcef799a378..5448d8bfad7f 100644--- a/frontend/src/layout/scenes/components/QuillSceneHeader.tsx+++ b/frontend/src/layout/scenes/components/QuillSceneHeader.tsx@@ -19,8 +19,8 @@ export function QuillSceneHeader({ back, icon, title, actions, className }: Quil<headerdata-quillclassName={cn(- 'flex h-12 shrink-0 items-center gap-1 border-b border-[var(--border)] px-4',- '@max-xl/main-content:h-auto @max-xl/main-content:min-h-12 @max-xl/main-content:flex-wrap @max-xl/main-content:gap-y-2 @max-xl/main-content:py-2',+ 'flex h-10.5 shrink-0 items-center gap-1 border-b border-[var(--border)] px-4',+ '@max-xl/main-content:h-auto @max-xl/main-content:min-h-10.5 @max-xl/main-content:flex-wrap @max-xl/main-content:gap-y-2 @max-xl/main-content:py-2',className)}>diff --git a/frontend/src/layout/scenes/components/QuillSceneName.tsx b/frontend/src/layout/scenes/components/QuillSceneName.tsxindex 43cabce765b9..5d8be8f9e4f8 100644--- a/frontend/src/layout/scenes/components/QuillSceneName.tsx+++ b/frontend/src/layout/scenes/components/QuillSceneName.tsx@@ -21,7 +21,7 @@ export interface QuillSceneNameProps {}// The name and its editor share one box (height, padding and a 1px border), so opening the editor moves nothing.-const NAME_BOX = 'h-7 rounded-md border px-1.5 text-sm leading-6.5 font-semibold'+const NAME_BOX = 'h-7 rounded-md border px-1.5 text-[length:var(--text-ui,0.8125rem)] leading-6.5 font-semibold'export function QuillSceneName({name: initialName,diff --git a/frontend/src/layout/scenes/components/QuillSceneTitleSection.tsx b/frontend/src/layout/scenes/components/QuillSceneTitleSection.tsxindex 30f6c99f94c8..b27278a73d53 100644--- a/frontend/src/layout/scenes/components/QuillSceneTitleSection.tsx+++ b/frontend/src/layout/scenes/components/QuillSceneTitleSection.tsx@@ -1,5 +1,5 @@import { useActions, useValues } from 'kea'-import { useMemo } from 'react'+import { useMemo, useState } from 'react'import { IconCollapse, IconExpand } from '@posthog/icons'import { Button, cn } from '@posthog/quill'@@ -11,15 +11,18 @@ import { sceneLogic } from 'scenes/sceneLogic'import { breadcrumbsLogic } from '~/layout/navigation/Breadcrumbs/breadcrumbsLogic'import { todayShellLogic } from '~/layout/today/todayShellLogic'+import { TodaySidebarBreadcrumb } from '~/layout/today/TodaySidebarBreadcrumb'import { sceneLayoutLogic } from '../sceneLayoutLogic'import { QuillSceneHeader } from './QuillSceneHeader'import { QuillSceneName } from './QuillSceneName'-import { SceneBreadcrumbBackButton } from './SceneBreadcrumbs'+import { QuillSceneTrail } from './QuillSceneTrail'import { SceneDescription } from './SceneDescription'+import { useRegisterSceneMenuBarSlot, useSceneMenuBarSlotMarginTop } from './SceneMenuBarSlotProvider'import { sceneResourceIcon } from './sceneResourceIcon'import { SceneTitlePanelButton } from './SceneTitlePanelButton'import type { SceneMainTitleProps } from './SceneTitleSection'+import { SceneTitleSettingsButton } from './SceneTitleSettingsButton'export function QuillSceneTitleSection({name,@@ -51,7 +54,7 @@ export function QuillSceneTitleSection({const { activeSceneId } = useValues(sceneLogic)const { showDescription } = useValues(sceneLayoutLogic)const { toggleShowDescription } = useActions(sceneLayoutLogic)- const { phoneHeaderShown } = useValues(todayShellLogic)+ const { phoneHeaderShown, sidebarBreadcrumbShown } = useValues(todayShellLogic)// The phone header shows the title, so this row keeps only the actions. A new resource keeps its name field.const titleInPhoneHeader = phoneHeaderShown && !forceEditconst releaseStageSceneId = sceneId ?? activeSceneId@@ -62,22 +65,33 @@ export function QuillSceneTitleSection({const hasDescription = description != null && (description || canEdit)const descriptionShown =hasDescription && (descriptionAlwaysVisible || (showDescription && !titleInPhoneHeader) || forceEdit)+ const backTo = forceBackTo || (breadcrumbs.length > 2 ? breadcrumbs[breadcrumbs.length - 2] : undefined)+ const backPath = !titleInPhoneHeader && backTo && 'path' in backTo ? backTo.path : undefined+ const resourceIcon = name !== null && !titleInPhoneHeader ? sceneResourceIcon(resourceType) : undefined+ const [menuBarSlot, setMenuBarSlot] = useState<HTMLDivElement | null>(null)+ useRegisterSceneMenuBarSlot(menuBarSlot)+ const menuBarSlotMarginTop = useSceneMenuBarSlotMarginTop(menuBarSlot)return (<><QuillSceneHeaderclassName={cn('z-30 bg-[var(--scene-layout-background)] @2xl/main-content:sticky -top-[calc(var(--spacing)*4)]',- !noPadding && '-mx-4 -mt-4',+ !noPadding && '-mx-4',titleInPhoneHeader && 'hidden has-[>div>*]:flex',- className+ className,+ // Last, so a caller's spacing cannot move the row. The sidebar toggle must sit on the same spot in+ // every scene. The menu bar portals below the row, so callers that make room for it above need not.+ 'px-4',+ !noPadding && '-mt-4')}back={- !titleInPhoneHeader && (forceBackTo || breadcrumbs.length > 2) ? (- <SceneBreadcrumbBackButton forceBackTo={forceBackTo} />- ) : undefined+ <QuillSceneTrail+ lead={sidebarBreadcrumbShown && <TodaySidebarBreadcrumb />}+ parent={backTo && backPath ? { name: backTo.name, path: backPath } : undefined}+ icon={resourceIcon}+ />}- icon={name !== null && !titleInPhoneHeader ? sceneResourceIcon(resourceType) : undefined}title={name !== null &&!titleInPhoneHeader && (@@ -119,10 +133,17 @@ export function QuillSceneTitleSection({<>{!hideProductSetupButton && <ProductSetupButton />}{actions}+ <SceneTitleSettingsButton /><SceneTitlePanelButton maxToolProps={maxToolProps} maxButtonLabel={maxButtonLabel} /></>}/>+ {/* The scene menu bar portals in here. It sits outside the sticky header, so it scrolls away. */}+ <div+ ref={setMenuBarSlot}+ className={cn('empty:hidden', !noPadding && '-mx-4')}+ style={{ marginTop: menuBarSlotMarginTop }}+ />{descriptionShown && (<div className={cn('[&_svg]:size-6', noPadding && cn('pl-4 pr-2', className))}><SceneDescriptiondiff --git a/frontend/src/layout/scenes/components/QuillSceneTrail.tsx b/frontend/src/layout/scenes/components/QuillSceneTrail.tsxnew file mode 100644index 000000000000..6014906607a8--- /dev/null+++ b/frontend/src/layout/scenes/components/QuillSceneTrail.tsx@@ -0,0 +1,65 @@+import { ReactNode } from 'react'++import { Button, cn } from '@posthog/quill'++import { LinkPrimitive } from 'lib/lemon-ui/Link'++export interface QuillSceneTrailParent {+ name: ReactNode+ path: string+}++// Every offset in the trail lives here. Each one cancels padding so the gaps read evenly and nothing moves when the+// trail changes shape: link buttons pad 8px, and `QuillSceneName`'s box pads its text by 7px (6px plus a 1px border).+const SLASH = 'shrink-0 text-muted-foreground'+const SLASH_AFTER_LINK = cn(SLASH, '-ms-1 me-1')+const SLASH_BEFORE_NAME = cn(SLASH, '-ms-1 -me-[3px]')+const TITLE_ICON = '-me-1.5 flex size-4 shrink-0 items-center justify-center text-sm [&_svg]:size-4'+const LINK_ICON = '-me-[3px] flex size-4 shrink-0 items-center justify-center [&_svg]:size-4'++export interface QuillSceneTrailProps {+ /** A crumb before the parent, such as the hidden sidebar's pane. It must render as a link-sized button. */+ lead?: ReactNode+ parent?: QuillSceneTrailParent+ icon?: ReactNode+}++export function QuillSceneTrail({ lead, parent, icon }: QuillSceneTrailProps): JSX.Element {+ return (+ <>+ {lead && (+ <>+ {lead}+ <span className={SLASH_AFTER_LINK} aria-hidden>+ /+ </span>+ </>+ )}+ {parent ? (+ <>+ <Button+ className="-ms-2 min-w-0 max-w-48 text-muted-foreground"+ render={<LinkPrimitive to={parent.path} />}+ data-attr="scene-title-breadcrumb-back"+ >+ {icon && (+ <span className={LINK_ICON} aria-hidden>+ {icon}+ </span>+ )}+ <span className="truncate">{parent.name}</span>+ </Button>+ <span className={SLASH_BEFORE_NAME} aria-hidden>+ /+ </span>+ </>+ ) : (+ icon && (+ <span className={TITLE_ICON} aria-hidden>+ {icon}+ </span>+ )+ )}+ </>+ )+}diff --git a/frontend/src/layout/scenes/components/SceneMenuBar.tsx b/frontend/src/layout/scenes/components/SceneMenuBar.tsxindex a587c989747d..d76192b3f30c 100644--- a/frontend/src/layout/scenes/components/SceneMenuBar.tsx+++ b/frontend/src/layout/scenes/components/SceneMenuBar.tsx@@ -1,6 +1,7 @@import { useActions, useValues } from 'kea'import posthog from 'posthog-js'import { Children, ComponentProps, MouseEvent, ReactNode, useContext, useEffect } from 'react'+import { createPortal } from 'react-dom'import { IconExternal, IconGear, IconSidePanel, IconSparkles } from '@posthog/icons'import {@@ -29,16 +30,15 @@ import { IconBlank } from 'lib/lemon-ui/icons'import { LinkPrimitive } from 'lib/lemon-ui/Link'import { cn } from 'lib/utils/css-classes'import { sceneLogic } from 'scenes/sceneLogic'-import type { SettingSectionId } from 'scenes/settings/types'-import { urls } from 'scenes/urls'import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'import { sceneLayoutLogic } from '~/layout/scenes/sceneLayoutLogic'import { todayShellLogic } from '~/layout/today/todayShellLogic'-import { ProductKey } from '~/queries/schema/schema-general'import { SidePanelTab } from '~/types'import { SceneContentContext } from './SceneContent'+import { useSceneMenuBarSlot } from './SceneMenuBarSlotProvider'+import { getSceneSettingsUrl } from './sceneSettingsUrl'/*** Central instrumentation for the SceneMenuBar experiment (`SCENE_MENU_BAR` flag). Capturing@@ -64,27 +64,14 @@ type SceneMenuBarProps = {className?: string}-const SETTINGS_SECTION_BY_PRODUCT: Partial<Record<ProductKey, SettingSectionId>> = {- [ProductKey.PRODUCT_ANALYTICS]: 'environment-product-analytics',- [ProductKey.WEB_ANALYTICS]: 'environment-web-analytics',- [ProductKey.SESSION_REPLAY]: 'environment-replay',- [ProductKey.FEATURE_FLAGS]: 'environment-feature-flags',- [ProductKey.EXPERIMENTS]: 'environment-experiments',- [ProductKey.SURVEYS]: 'environment-surveys',- [ProductKey.AI_OBSERVABILITY]: 'environment-ai-observability',- [ProductKey.LOGS]: 'environment-logs',- [ProductKey.WORKFLOWS]: 'environment-workflows',-}--function getSettingsUrl(productKey: ProductKey | null): string | null {- const section = productKey ? SETTINGS_SECTION_BY_PRODUCT[productKey] : undefined- return section ? urls.settings(section) : null-}-export function SceneMenuBar({ children, className }: SceneMenuBarProps): JSX.Element {const { sceneLayoutConfig } = useValues(sceneLayoutLogic)const layout = sceneLayoutConfig?.layout ?? 'app'const isPaddedLayout = PADDED_LAYOUTS.has(layout)+ const { todayRailEnabled } = useValues(todayShellLogic)+ const titleSlot = useSceneMenuBarSlot()+ // Under the Today layout the bar sits below the scene title. A scene without a title keeps it inline.+ const slot = todayRailEnabled ? titleSlot : null// A skipped product empty state parks its "isn't receiving data yet" reminder here so it// sits just below the bar. Null for every other scene, so nothing extra renders.@@ -94,23 +81,26 @@ export function SceneMenuBar({ children, className }: SceneMenuBarProps): JSX.ElcaptureSceneMenuBar('scene menu bar shown')}, [])- return (+ const content = (<><divdata-attr="scene-menu-bar"data-scene-layout={layout}className={cn('scene-menu-bar px-0.5 py-0.5 border-b border-primary flex items-center justify-between',- // Below `lg` the navigation toggle floats over the top-left corner of the scene.- 'max-lg:pl-10',- // Bleed past the scene container's padding so the bar feels full-width — only- // safe when the layout actually has padding to cancel. Unpadded layouts- // (app-raw, plain, etc.) would overflow.- isPaddedLayout && '-mx-4 -mt-4',- // When LemonTabs is the immediately preceding sibling it already bleeds with- // its own -mt-6, leaving the menu bar floating in the flex `gap-y-*`. Pull the- // bar up so they sit flush.- '[.LemonTabs+&]:-mt-6',+ // The title slot places the bar itself. These offsets only fit the bar inline at the scene top.+ !slot && [+ // Below `lg` the navigation toggle floats over the top-left corner of the scene.+ 'max-lg:pl-10',+ // Bleed past the scene container's padding so the bar feels full-width — only+ // safe when the layout actually has padding to cancel. Unpadded layouts+ // (app-raw, plain, etc.) would overflow.+ isPaddedLayout && '-mx-4 -mt-4',+ // When LemonTabs is the immediately preceding sibling it already bleeds with+ // its own -mt-6, leaving the menu bar floating in the flex `gap-y-*`. Pull the+ // bar up so they sit flush.+ '[.LemonTabs+&]:-mt-6',+ ],className)}>@@ -119,14 +109,44 @@ export function SceneMenuBar({ children, className }: SceneMenuBarProps): JSX.ElCompositeRoot — that's what coordinates ArrowLeft/Right navigation andhover-to-switch between menus.*/}- <Menubar className="gap-0 border-0">{children}</Menubar>+ <Menubar className="gap-0 border-0">+ {children}+ {todayRailEnabled && <SceneMenuBarHelpMenu />}+ </Menubar>- <Badge className="hidden @[800px]:flex">OS-like menu (alpha)</Badge>- <SceneMenuBarRightLinks />+ <Badge className={cn('hidden @[800px]:flex', todayRailEnabled && 'me-1')}>OS-like menu (alpha)</Badge>+ {!todayRailEnabled && <SceneMenuBarRightLinks />}</div>{setupReminder}</>)++ return slot ? createPortal(content, slot) : content+}++/** The last menu, as in macOS. Every scene gets it, so scenes never add their own. */+function SceneMenuBarHelpMenu(): JSX.Element {+ const { openSidePanel } = useActions(sidePanelStateLogic)++ return (+ <SceneMenuBarMenu label="Help" dataAttr="scene-menu-bar-help">+ <SceneMenuBarItem+ data-attr="scene-menu-bar-docs"+ onClick={() => window.open('https://posthog.com/docs', '_blank', 'noopener')}+ >+ <IconExternal />+ Docs+ </SceneMenuBarItem>+ <SceneMenuBarItem+ data-attr="scene-menu-bar-support"+ opensFloatingUi+ onClick={() => openSidePanel(SidePanelTab.Support)}+ >+ <IconSidePanel />+ Support+ </SceneMenuBarItem>+ </SceneMenuBarMenu>+ )}const RIGHT_TRIGGER_CLASSES = 'px-2 h-7 rounded-sm text-xs font-medium inline-flex items-center gap-1 text-foreground'@@ -135,9 +155,8 @@ const RIGHT_TRIGGER_LABEL_CLASSES = 'hidden @min-[36rem]/main-content:inline'function SceneMenuBarRightLinks(): JSX.Element {const { openSidePanel } = useActions(sidePanelStateLogic)- const { todayRailEnabled } = useValues(todayShellLogic)const { productKey } = useContext(SceneContentContext)- const settingsUrl = getSettingsUrl(productKey)+ const settingsUrl = getSceneSettingsUrl(productKey)return (<div className="flex items-center gap-px pr-1">@@ -176,22 +195,20 @@ function SceneMenuBarRightLinks(): JSX.Element {<span className={RIGHT_TRIGGER_LABEL_CLASSES}>Support</span><IconSidePanel /></Button>- {!todayRailEnabled && (- <Button- type="button"- onClick={() => {- captureSceneMenuBar('scene menu bar right link clicked', { link: 'ai' })- openSidePanel(SidePanelTab.Max)- }}- data-attr="scene-menu-bar-ai"- aria-label="PostHog AI"- className={RIGHT_TRIGGER_CLASSES}- variant="outline"- >- <IconSparkles className="text-ai group-hover/button-primitive:animate-hue-rotate" />- <span className={RIGHT_TRIGGER_LABEL_CLASSES}>PostHog AI</span>- </Button>- )}+ <Button+ type="button"+ onClick={() => {+ captureSceneMenuBar('scene menu bar right link clicked', { link: 'ai' })+ openSidePanel(SidePanelTab.Max)+ }}+ data-attr="scene-menu-bar-ai"+ aria-label="PostHog AI"+ className={RIGHT_TRIGGER_CLASSES}+ variant="outline"+ >+ <IconSparkles className="text-ai group-hover/button-primitive:animate-hue-rotate" />+ <span className={RIGHT_TRIGGER_LABEL_CLASSES}>PostHog AI</span>+ </Button></div>)}@@ -200,7 +217,7 @@ function SceneMenuBarRightLinks(): JSX.Element {* Canonical menu set for SceneMenuBar. Use these labels in this order so the bar feels* consistent across PostHog scenes. Render only the menus your scene actually needs.*- * Order: File → Edit → View → Metadata → Staff only+ * Order: File → Edit → View → Metadata → Staff only (→ Help, added by the bar itself under the Today layout)** - **File** — `<SceneMenuBarSubMenu label="Create">` at the top, then file/project ops,* Export sub-menu, ──, **Delete / Archive / Restore** (destructive, at the bottom).@@ -214,7 +231,8 @@ function SceneMenuBarRightLinks(): JSX.Element {* Activity indicator, ExternalReferences.* - **Staff only** *(conditional)* — Debug panels, internal toggles.*- * Right cluster includes PostHog AI, Docs, Support, and Settings when configured for the scene's product.+ * Right cluster includes PostHog AI, Docs, Support, and Settings when configured for the scene's product. Under the+ * Today layout Docs and Support move to the Help menu and Settings moves to the scene title row.** Full conventions: `.agents/skills/scene-menu-bar/SKILL.md`.*/@@ -248,6 +266,9 @@ function hasNoRenderableChildren(children: ReactNode): boolean {return Children.toArray(children).length === 0}+const MENU_TRIGGER_CLASSES =+ 'flex items-center outline-hidden select-none px-2 h-7 rounded-sm text-xs font-medium hover:bg-fill-hover data-[popup-open]:bg-fill-selected disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent'+export function SceneMenuBarMenu({label,children,@@ -265,11 +286,7 @@ export function SceneMenuBarMenu({}}}>- <MenubarTrigger- data-attr={dataAttr}- disabled={isDisabled}- className="px-2 h-7 rounded-sm text-xs font-medium hover:bg-fill-hover data-[popup-open]:bg-fill-selected disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent"- >+ <MenubarTrigger data-attr={dataAttr} disabled={isDisabled} className={MENU_TRIGGER_CLASSES}>{label}</MenubarTrigger><MenubarContent@@ -415,7 +432,7 @@ export function SceneMenuBarPopover({}: SceneMenuBarPopoverProps): JSX.Element {return (<Popover>- <PopoverTrigger data-attr={dataAttr} render={<Button />}>+ <PopoverTrigger data-attr={dataAttr} className={MENU_TRIGGER_CLASSES}>{label}</PopoverTrigger><PopoverContent align={align} className={cn('w-80 p-2', contentClassName)}>diff --git a/frontend/src/layout/scenes/components/SceneMenuBarSlotProvider.tsx b/frontend/src/layout/scenes/components/SceneMenuBarSlotProvider.tsxnew file mode 100644index 000000000000..d69857b1d036--- /dev/null+++ b/frontend/src/layout/scenes/components/SceneMenuBarSlotProvider.tsx@@ -0,0 +1,50 @@+import { PropsWithChildren, createContext, useContext, useLayoutEffect, useState } from 'react'++/**+ * Under the Today layout the scene title section exposes a slot below its header, and the scene menu bar portals into+ * it. Scenes render the bar and the title as unrelated siblings, so each scene shares the slot element through this+ * context.+ */+interface SceneMenuBarSlotContextValue {+ slot: HTMLElement | null+ setSlot: (slot: HTMLElement | null) => void+}++const SceneMenuBarSlotContext = createContext<SceneMenuBarSlotContextValue>({ slot: null, setSlot: () => {} })++export function SceneMenuBarSlotProvider({ children }: PropsWithChildren): JSX.Element {+ const [slot, setSlot] = useState<HTMLElement | null>(null)+ return <SceneMenuBarSlotContext.Provider value={{ slot, setSlot }}>{children}</SceneMenuBarSlotContext.Provider>+}++export function useRegisterSceneMenuBarSlot(element: HTMLElement | null): void {+ const { setSlot } = useContext(SceneMenuBarSlotContext)+ useLayoutEffect(() => {+ if (!element) {+ return+ }+ setSlot(element)+ return () => setSlot(null)+ }, [element, setSlot])+}++export function useSceneMenuBarSlot(): HTMLElement | null {+ return useContext(SceneMenuBarSlotContext).slot+}++/**+ * A negative top margin equal to the parent's flex gap, so the slot sits flush under the header. Scenes nest the title+ * in parents with different gaps, so the gap is read from the DOM instead of assumed.+ */+export function useSceneMenuBarSlotMarginTop(element: HTMLElement | null): number {+ const [marginTop, setMarginTop] = useState(0)+ useLayoutEffect(() => {+ const parent = element?.parentElement+ if (!parent) {+ return+ }+ const gap = parseFloat(getComputedStyle(parent).rowGap)+ setMarginTop(Number.isFinite(gap) ? -gap : 0)+ }, [element])+ return marginTop+}diff --git a/frontend/src/layout/scenes/components/SceneTitleSettingsButton.tsx b/frontend/src/layout/scenes/components/SceneTitleSettingsButton.tsxnew file mode 100644index 000000000000..6475f46842cd--- /dev/null+++ b/frontend/src/layout/scenes/components/SceneTitleSettingsButton.tsx@@ -0,0 +1,38 @@+import posthog from 'posthog-js'+import { useContext } from 'react'++import { IconGear } from '@posthog/icons'+import { Button, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill'++import { LinkPrimitive } from 'lib/lemon-ui/Link'++import { SceneContentContext } from './SceneContent'+import { getSceneSettingsUrl } from './sceneSettingsUrl'++export function SceneTitleSettingsButton(): JSX.Element | null {+ const { productKey } = useContext(SceneContentContext)+ const settingsUrl = getSceneSettingsUrl(productKey)++ if (!settingsUrl) {+ return null+ }++ return (+ <Tooltip>+ <TooltipTrigger+ render={+ <Button+ size="icon"+ aria-label="Settings"+ data-attr="scene-title-settings"+ onClick={() => posthog.capture('scene title settings clicked', { product: productKey })}+ render={<LinkPrimitive to={settingsUrl} />}+ />+ }+ >+ <IconGear />+ </TooltipTrigger>+ <TooltipContent>Settings</TooltipContent>+ </Tooltip>+ )+}diff --git a/frontend/src/layout/scenes/components/sceneSettingsUrl.ts b/frontend/src/layout/scenes/components/sceneSettingsUrl.tsnew file mode 100644index 000000000000..65cd309e5624--- /dev/null+++ b/frontend/src/layout/scenes/components/sceneSettingsUrl.ts@@ -0,0 +1,21 @@+import type { SettingSectionId } from 'scenes/settings/types'+import { urls } from 'scenes/urls'++import { ProductKey } from '~/queries/schema/schema-general'++const SETTINGS_SECTION_BY_PRODUCT: Partial<Record<ProductKey, SettingSectionId>> = {+ [ProductKey.PRODUCT_ANALYTICS]: 'environment-product-analytics',+ [ProductKey.WEB_ANALYTICS]: 'environment-web-analytics',+ [ProductKey.SESSION_REPLAY]: 'environment-replay',+ [ProductKey.FEATURE_FLAGS]: 'environment-feature-flags',+ [ProductKey.EXPERIMENTS]: 'environment-experiments',+ [ProductKey.SURVEYS]: 'environment-surveys',+ [ProductKey.AI_OBSERVABILITY]: 'environment-ai-observability',+ [ProductKey.LOGS]: 'environment-logs',+ [ProductKey.WORKFLOWS]: 'environment-workflows',+}++export function getSceneSettingsUrl(productKey: ProductKey | null): string | null {+ const section = productKey ? SETTINGS_SECTION_BY_PRODUCT[productKey] : undefined+ return section ? urls.settings(section) : null+}diff --git a/frontend/src/layout/today/TodayNewChatButton.tsx b/frontend/src/layout/today/TodayNewChatButton.tsxindex 9cbdcf11775b..8f1d2488167f 100644--- a/frontend/src/layout/today/TodayNewChatButton.tsx+++ b/frontend/src/layout/today/TodayNewChatButton.tsx@@ -7,11 +7,8 @@ import { Button, Tooltip, TooltipContent, TooltipTrigger, cn } from '@posthog/quimport { LinkPrimitive } from 'lib/lemon-ui/Link'import { urls } from 'scenes/urls'-import { todayShellLogic } from './todayShellLogic'-export function TodayNewChatButton(): JSX.Element {const { location } = useValues(router)- const { phoneLayout } = useValues(todayShellLogic)const starting = location.pathname.endsWith(urls.taskNewSession())return (@@ -20,7 +17,7 @@ export function TodayNewChatButton(): JSX.Element {delay={0}render={<Button- size={phoneLayout ? 'icon-lg' : 'icon'}+ size="icon"render={<LinkPrimitive to={urls.taskNewSession()} />}aria-current={starting ? 'page' : undefined}className={cn('-me-2 text-muted-foreground', starting && 'bg-fill-selected text-foreground')}diff --git a/frontend/src/layout/today/TodayNewViewButton.tsx b/frontend/src/layout/today/TodayNewViewButton.tsxnew file mode 100644index 000000000000..dc85780510f3--- /dev/null+++ b/frontend/src/layout/today/TodayNewViewButton.tsx@@ -0,0 +1,21 @@+import { IconPlus } from '@posthog/icons'+import { Button } from '@posthog/quill'++import { NewViewMenu } from 'scenes/views/NewViewMenu'++export function TodayNewViewButton(): JSX.Element {+ return (+ <NewViewMenu+ trigger={+ <Button+ size="icon"+ className="-me-2 text-muted-foreground"+ aria-label="New view"+ data-attr="today-new-view-header"+ />+ }+ >+ <IconPlus />+ </NewViewMenu>+ )+}diff --git a/frontend/src/layout/today/TodayPhoneHeader.tsx b/frontend/src/layout/today/TodayPhoneHeader.tsxindex c54a3db24c8d..5a6943fa092a 100644--- a/frontend/src/layout/today/TodayPhoneHeader.tsx+++ b/frontend/src/layout/today/TodayPhoneHeader.tsx@@ -1,14 +1,15 @@import { useActions, useValues } from 'kea'import { useEffect, useState } from 'react'-import { IconChevronLeft, IconSidePanel, IconSidebarOpen } from '@posthog/icons'-import { Button, Text } from '@posthog/quill'+import { IconChevronLeft, IconSidePanel } from '@posthog/icons'+import { Button } from '@posthog/quill'import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'import { breadcrumbsLogic } from '~/layout/navigation/Breadcrumbs/breadcrumbsLogic'import { sceneLayoutLogic } from '~/layout/scenes/sceneLayoutLogic'import { SidePanelTab } from '~/types'+import { IconShowSidebar } from './todayRailItems'import { todayShellLogic } from './todayShellLogic'export function TodayPhoneHeader(): JSX.Element {@@ -34,25 +35,23 @@ export function TodayPhoneHeader(): JSX.Element {return (<header className="TodayPhoneHeader" data-scrolled={scrolled} data-quill>{phoneCanGoBack ? (- <Button size="icon-lg" aria-label="Back" data-attr="today-phone-back" onClick={goBackOnPhone}>+ <Button size="icon" aria-label="Back" data-attr="today-phone-back" onClick={goBackOnPhone}><IconChevronLeft /></Button>) : (<Button- size="icon-lg"+ size="icon"aria-label="Open sidebar"data-attr="today-phone-sidebar"onClick={() => setMobileSidebarOpen(true)}>- <IconSidebarOpen />+ <IconShowSidebar /></Button>)}- <Text render={<span />} weight="semibold" className="min-w-0 flex-1 truncate">- {title}- </Text>+ <h2 className="m-0 min-w-0 flex-1 truncate text-base font-bold text-foreground">{title}</h2>{!onAiPage && (<Button- size="icon-lg"+ size="icon"aria-label="Open context panel"data-attr="today-phone-context-panel"onClick={() => openSidePanel(scenePanelIsPresent ? SidePanelTab.Info : SidePanelTab.Max)}diff --git a/frontend/src/layout/today/TodayRail.tsx b/frontend/src/layout/today/TodayRail.tsxindex ae35ca2929f9..e76c2ca8c991 100644--- a/frontend/src/layout/today/TodayRail.tsx+++ b/frontend/src/layout/today/TodayRail.tsx@@ -1,25 +1,24 @@import { useActions, useValues } from 'kea'import { ComponentPropsWithoutRef, forwardRef } from 'react'-import { IconSearch, IconSidebarClose, IconSidebarOpen } from '@posthog/icons'-import { Button, Kbd, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill'+import { IconSearch } from '@posthog/icons'+import { Button, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill'import { NewAccountMenu } from 'lib/components/Account/NewAccountMenu'import { pendingInvitesLogic } from 'lib/components/Account/pendingInvitesLogic'import { PendingInviteDot } from 'lib/components/Account/ProjectMenu'import { commandLogic } from 'lib/components/Command/commandLogic'import { UploadedLogo } from 'lib/lemon-ui/UploadedLogo/UploadedLogo'-import { isMac } from 'lib/utils/dom'import { organizationLogic } from 'scenes/organizationLogic'-import { TODAY_RAIL_ITEMS } from './todayRailItems'+import { TODAY_PANES, TODAY_RAIL_PANES } from './todayRailItems'import { TodayRailTile } from './TodayRailTile'import { TODAY_RAIL_WIDTH, railPaneHref, todayShellLogic } from './todayShellLogic'const RailUtility = forwardRef<HTMLButtonElement,- { label: string; children: JSX.Element; shortcut?: string } & ComponentPropsWithoutRef<typeof Button>->(function RailUtility({ label, children, shortcut, ...props }, ref): JSX.Element {+ { label: string; children: JSX.Element } & ComponentPropsWithoutRef<typeof Button>+>(function RailUtility({ label, children, ...props }, ref): JSX.Element {return (<Tooltip><TooltipTrigger@@ -37,17 +36,14 @@ const RailUtility = forwardRef<>{children}</TooltipTrigger>- <TooltipContent side="right">- {label}- {shortcut && <Kbd>{shortcut}</Kbd>}- </TooltipContent>+ <TooltipContent side="right">{label}</TooltipContent></Tooltip>)})export function TodayRail(): JSX.Element {const { activePane, sidebarVisible } = useValues(todayShellLogic)- const { pickPane, toggleSidebar } = useActions(todayShellLogic)+ const { clickRailPane } = useActions(todayShellLogic)const { toggleCommand } = useActions(commandLogic)const { currentOrganization } = useValues(organizationLogic)const { pendingInvites } = useValues(pendingInvitesLogic)@@ -59,14 +55,14 @@ export function TodayRail(): JSX.Element {// eslint-disable-next-line react/forbid-dom-propsstyle={{ width: TODAY_RAIL_WIDTH }}>- {TODAY_RAIL_ITEMS.map(({ pane, label, icon }) => (+ {TODAY_RAIL_PANES.map((pane) => (<TodayRailTilekey={pane}- label={label}- icon={icon}+ label={TODAY_PANES[pane].label}+ icon={TODAY_PANES[pane].icon}active={activePane === pane}to={railPaneHref(pane)}- onClick={() => pickPane(pane)}+ onClick={() => clickRailPane(pane)}dataAttr={`today-rail-${pane}`}/>))}@@ -99,14 +95,6 @@ export function TodayRail(): JSX.Element {><IconSearch /></RailUtility>- <RailUtility- label={sidebarVisible ? 'Hide sidebar' : 'Show sidebar'}- shortcut={isMac() ? '⌘B' : 'Ctrl+B'}- data-attr="today-rail-toggle-sidebar"- onClick={toggleSidebar}- >- {sidebarVisible ? <IconSidebarClose /> : <IconSidebarOpen />}- </RailUtility></div></nav>)diff --git a/frontend/src/layout/today/TodayShell.scss b/frontend/src/layout/today/TodayShell.scssindex c4a740552c05..c14c4e030c9c 100644--- a/frontend/src/layout/today/TodayShell.scss+++ b/frontend/src/layout/today/TodayShell.scss@@ -27,9 +27,20 @@.TodayShell__sidebar--framed {height: auto;margin-top: var(--today-frame-inset);- border: 1px solid var(--border);- border-bottom: 0;border-top-left-radius: var(--today-frame-radius);++ // An overlay, like the content frame, so the border takes no space. The pane header then starts at the same+ // point as the scene header, and the sidebar toggle stays under the pointer when the sidebar hides.+ &::after {+ position: absolute;+ inset: 0;+ z-index: var(--z-layout-navbar-under);+ pointer-events: none;+ content: '';+ border: 1px solid var(--border);+ border-bottom: 0;+ border-radius: inherit;+ }}.TodayAppLayout__backdrop {@@ -80,14 +91,16 @@.TodayShell__drawer {position: fixed;- top: 0;- bottom: 0;+ top: var(--today-frame-inset);+ bottom: var(--today-frame-inset);left: var(--today-rail-width);z-index: var(--z-layout-navbar);max-width: calc(100vw - var(--today-rail-width) - 3rem);+ height: auto;+ overflow: hidden;visibility: hidden;background: var(--today-paper);- border-right: 1px solid var(--today-line);+ border-radius: 0 var(--today-frame-radius) var(--today-frame-radius) 0;box-shadow: 24px 0 48px -24px rgb(0 0 0 / 28%);opacity: 0;transition:@@ -101,10 +114,22 @@opacity: 1;transform: none;}++ // An overlay border, like the docked frame, so the pane header starts where the scene header does.+ &::after {+ position: absolute;+ inset: 0;+ z-index: 1;+ pointer-events: none;+ content: '';+ border: 1px solid var(--border);+ border-radius: inherit;+ }}.TodayAppLayout--phone {- --today-phone-header-height: 52px;+ // Matches the pane header, so the top bar and the sidebar page share one height.+ --today-phone-header-height: 42px;--today-tab-bar-height: calc(76px + env(safe-area-inset-bottom));padding-top: var(--today-phone-header-height);@@ -125,7 +150,7 @@gap: 4px;align-items: center;height: var(--today-phone-header-height);- padding: 0 12px 0 8px;+ padding: 0 8px;color: var(--today-ink);background: var(--today-paper);border-bottom: 1px solid transparent;diff --git a/frontend/src/layout/today/TodayShell.tsx b/frontend/src/layout/today/TodayShell.tsxindex bb766cad432b..ad9faa2b7ca6 100644--- a/frontend/src/layout/today/TodayShell.tsx+++ b/frontend/src/layout/today/TodayShell.tsx@@ -3,7 +3,7 @@ import './TodayShell.scss'import { useActions, useMountedLogic, useValues } from 'kea'import { Suspense, useEffect, useRef } from 'react'-import { Heading, Skeleton, ToastProvider } from '@posthog/quill'+import { Skeleton, ToastProvider } from '@posthog/quill'import 'scenes/project-homepage/today/Today.scss'import { Resizer } from 'lib/components/Resizer/Resizer'@@ -16,13 +16,15 @@ import { TodayHomeSidebar } from 'scenes/project-homepage/today/TodayHomeSidebarimport { QuillSceneHeader } from '~/layout/scenes/components/QuillSceneHeader'-import { TodayNewChatButton } from './TodayNewChatButton'import { TodayPhoneHeader } from './TodayPhoneHeader'import { TodayPreviewCardProvider } from './TodayPreviewCardProvider'import { TodayRail } from './TodayRail'+import { TODAY_PANES } from './todayRailItems'import { todayRecentsLogic } from './todayRecentsLogic'import { TODAY_RAIL_WIDTH, TODAY_SIDEBAR_CLOSE_THRESHOLD, clampSidebarWidth, todayShellLogic } from './todayShellLogic'+import { TodaySidebarCollapseButton } from './TodaySidebarCollapseButton'import { TodaySidebarFooter } from './TodaySidebarFooter'+import { TodaySidebarPinButton } from './TodaySidebarPinButton'import { TodayTabBar } from './TodayTabBar'const TodaySpacesPane = lazyWithRetry(() => import('./TodaySpacesPane').then((m) => ({ default: m.TodaySpacesPane })))@@ -36,13 +38,6 @@ const NewSpaceDialog = lazyWithRetry(() =>import('products/tasks/frontend/spaces/NewSpaceDialog').then((m) => ({ default: m.NewSpaceDialog })))-const PANE_LABELS = {- home: 'Today',- spaces: 'Chats',- views: 'Views',- products: 'Products',-}-/** The left navigation under the Today layout: the rail, then the sidebar for the pane the rail has open. */export function TodayShell({ className }: { className?: string }): JSX.Element {const { activePane, mobileLayout, phoneLayout, sidebarVisible, sidebarWidth, phoneHeaderHidden } =@@ -55,7 +50,7 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {keybind: [keyBinds.toggleLeftNav, keyBinds.toggleLeftNavFallback],intent: 'Toggle collapse left navigation',interaction: 'function',- callback: toggleSidebar,+ callback: () => toggleSidebar('shortcut'),ignoreInEditable: true,})const sidebarRef = useRef<HTMLDivElement | null>(null)@@ -70,7 +65,7 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {persistent: true,closeThreshold: TODAY_SIDEBAR_CLOSE_THRESHOLD,onToggleClosed: (closed) => setSidebarOpen(!closed),- onDoubleClick: toggleSidebar,+ onDoubleClick: () => toggleSidebar('resizer'),}const { desiredSize } = useValues(resizerLogic(resizerLogicProps))@@ -110,16 +105,21 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {</Suspense>)+ const { title: paneTitle, action: PaneAction } = TODAY_PANES[activePane]const pane = (<div className="TodayShell__pane"><QuillSceneHeader- className="border-b-0"+ // Transparent, not removed: the scene header keeps its border inside the same height, so both headers+ // center their buttons on the same line.+ className="group/header border-b-transparent"+ back={<TodaySidebarCollapseButton />}title={- <h2 className="m-0 min-w-0 truncate text-base font-bold text-foreground">- {PANE_LABELS[activePane]}- </h2>+ <div className="flex min-w-0 items-center gap-1">+ <h2 className="m-0 min-w-0 truncate text-base font-bold text-foreground">{paneTitle}</h2>+ <TodaySidebarPinButton />+ </div>}- actions={activePane === 'spaces' ? <TodayNewChatButton /> : undefined}+ actions={PaneAction && <PaneAction />}/>{paneContent}</div>@@ -139,19 +139,13 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {<asideref={drawerRef}tabIndex={-1}- className="TodayShell__sidebar TodayShell__page outline-none"+ className="group/sidebar TodayShell__sidebar TodayShell__page outline-none"data-open={sidebarVisible}- aria-label={PANE_LABELS[activePane]}+ aria-label={paneTitle}aria-hidden={!sidebarVisible}{...(sidebarVisible ? {} : { inert: '' })}>- <div className="flex min-h-14 shrink-0 items-end gap-1 px-4 pt-3">- <Heading render={<h1 />} size="2xl" className="m-0 flex-1 truncate leading-10">- {PANE_LABELS[activePane]}- </Heading>- {activePane === 'spaces' && <TodayNewChatButton />}- </div>- <div className="TodayShell__pane">{paneContent}</div>+ {pane}<TodaySidebarFooter /></aside><TodayTabBar />@@ -181,9 +175,9 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {<asideref={drawerRef}tabIndex={-1}- className="TodayShell__sidebar TodayShell__drawer outline-none"+ className="group/sidebar TodayShell__sidebar TodayShell__drawer outline-none"data-open={sidebarVisible}- aria-label={PANE_LABELS[activePane]}+ aria-label={paneTitle}aria-hidden={!sidebarVisible}{...(sidebarVisible ? {} : { inert: '' })}// eslint-disable-next-line react/forbid-dom-props@@ -197,8 +191,8 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {sidebarVisible && (<asideref={sidebarRef}- className="TodayShell__sidebar TodayShell__sidebar--framed relative"- aria-label={PANE_LABELS[activePane]}+ className="group/sidebar TodayShell__sidebar TodayShell__sidebar--framed relative"+ aria-label={paneTitle}// eslint-disable-next-line react/forbid-dom-propsstyle={{ width: sidebarWidth }}>diff --git a/frontend/src/layout/today/TodaySidebarBreadcrumb.tsx b/frontend/src/layout/today/TodaySidebarBreadcrumb.tsxnew file mode 100644index 000000000000..95a9e70bcfab--- /dev/null+++ b/frontend/src/layout/today/TodaySidebarBreadcrumb.tsx@@ -0,0 +1,37 @@+import { useActions, useValues } from 'kea'++import { Button, Kbd, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill'++import { IconShowSidebar, TODAY_PANES, todaySidebarShortcutLabel } from './todayRailItems'+import { todayShellLogic } from './todayShellLogic'++/** The hidden sidebar's pane title as a button that opens the sidebar again. `QuillSceneTrail` decides when it shows. */+export function TodaySidebarBreadcrumb(): JSX.Element {+ const { activePane } = useValues(todayShellLogic)+ const { toggleSidebar } = useActions(todayShellLogic)+ const { title } = TODAY_PANES[activePane]++ return (+ <Tooltip>+ <TooltipTrigger+ delay={0}+ render={+ <Button+ className="-ms-2 shrink-0 text-muted-foreground"+ aria-label={`Show ${title} sidebar`}+ data-attr="today-scene-show-sidebar"+ onClick={() => toggleSidebar('scene_breadcrumb')}+ />+ }+ >+ {/* The hide button centers this icon 7.5px from its edge. This button pads it by 8px, so pull it back. */}+ <IconShowSidebar className="-ms-[0.5px]" />+ {title}+ </TooltipTrigger>+ <TooltipContent>+ Show sidebar+ <Kbd>{todaySidebarShortcutLabel()}</Kbd>+ </TooltipContent>+ </Tooltip>+ )+}diff --git a/frontend/src/layout/today/TodaySidebarCollapseButton.tsx b/frontend/src/layout/today/TodaySidebarCollapseButton.tsxnew file mode 100644index 000000000000..1c0cddca5cc3--- /dev/null+++ b/frontend/src/layout/today/TodaySidebarCollapseButton.tsx@@ -0,0 +1,54 @@+import { useActions, useValues } from 'kea'++import { Button, Kbd, Tooltip, TooltipContent, TooltipTrigger, cn } from '@posthog/quill'++import { IconHideSidebar, TODAY_PANES, todaySidebarShortcutLabel } from './todayRailItems'+import { todayShellLogic } from './todayShellLogic'++// Both icons share one grid cell and cross-fade. Touch screens have no hover, so they show the hide icon.+const ICON =+ 'col-start-1 row-start-1 flex transition-[opacity,scale] duration-150 ease-[ease] motion-reduce:transition-none'+const SHOWN_ON_HOVER = cn(+ 'pointer-fine:scale-90 pointer-fine:opacity-0',+ 'pointer-fine:group-hover/sidebar:scale-100 pointer-fine:group-hover/sidebar:opacity-100',+ 'pointer-fine:group-has-[:focus-visible]/sidebar:scale-100 pointer-fine:group-has-[:focus-visible]/sidebar:opacity-100'+)+const HIDDEN_ON_HOVER = cn(+ 'scale-90 opacity-0 pointer-fine:scale-100 pointer-fine:opacity-100',+ 'pointer-fine:group-hover/sidebar:scale-90 pointer-fine:group-hover/sidebar:opacity-0',+ 'pointer-fine:group-has-[:focus-visible]/sidebar:scale-90 pointer-fine:group-has-[:focus-visible]/sidebar:opacity-0'+)++/** Hides the sidebar from its own title row. The scene header then shows the pane title to open it again. */+export function TodaySidebarCollapseButton(): JSX.Element {+ const { activePane } = useValues(todayShellLogic)+ const { toggleSidebar } = useActions(todayShellLogic)++ return (+ <Tooltip>+ <TooltipTrigger+ delay={0}+ render={+ <Button+ size="icon"+ className="-ms-2 shrink-0 text-muted-foreground"+ aria-label="Hide sidebar"+ data-attr="today-pane-hide-sidebar"+ onClick={() => toggleSidebar('pane_header')}+ />+ }+ >+ <span className="grid">+ <span className={cn(ICON, HIDDEN_ON_HOVER)}>{TODAY_PANES[activePane].icon}</span>+ <span className={cn(ICON, SHOWN_ON_HOVER)}>+ <IconHideSidebar />+ </span>+ </span>+ </TooltipTrigger>+ <TooltipContent>+ Hide sidebar+ <Kbd>{todaySidebarShortcutLabel()}</Kbd>+ </TooltipContent>+ </Tooltip>+ )+}diff --git a/frontend/src/layout/today/TodaySidebarPinButton.tsx b/frontend/src/layout/today/TodaySidebarPinButton.tsxnew file mode 100644index 000000000000..c33d35df1a33--- /dev/null+++ b/frontend/src/layout/today/TodaySidebarPinButton.tsx@@ -0,0 +1,44 @@+import { useActions, useValues } from 'kea'++import { IconPin, IconPinFilled } from '@posthog/icons'+import { Button, Tooltip, TooltipContent, TooltipTrigger, cn } from '@posthog/quill'++import { todayShellLogic } from './todayShellLogic'++export function TodaySidebarPinButton(): JSX.Element | null {+ const { sidebarPinned, mobileLayout } = useValues(todayShellLogic)+ const { toggleSidebarPinned } = useActions(todayShellLogic)++ // The drawer always closes when a page opens, so pinning has no effect there.+ if (mobileLayout) {+ return null+ }++ return (+ <Tooltip>+ <TooltipTrigger+ delay={0}+ render={+ <Button+ size="icon-sm"+ className={cn(+ 'shrink-0 text-muted-foreground',+ // Pinned is the default, so the pin hides until the header is hovered. Unpinned stays in view.+ sidebarPinned &&+ 'opacity-0 transition-opacity duration-150 ease-[ease] group-hover/header:opacity-100 focus-visible:opacity-100 motion-reduce:transition-none'+ )}+ aria-label="Pin sidebar"+ aria-pressed={sidebarPinned}+ data-attr="today-pane-pin-sidebar"+ onClick={toggleSidebarPinned}+ />+ }+ >+ {sidebarPinned ? <IconPinFilled /> : <IconPin />}+ </TooltipTrigger>+ <TooltipContent>+ {sidebarPinned ? 'Unpin to hide the sidebar after you open a page' : 'Pin to keep the sidebar open'}+ </TooltipContent>+ </Tooltip>+ )+}diff --git a/frontend/src/layout/today/TodayTabBar.tsx b/frontend/src/layout/today/TodayTabBar.tsxindex 2c56ed7e328b..0e55a79c91c2 100644--- a/frontend/src/layout/today/TodayTabBar.tsx+++ b/frontend/src/layout/today/TodayTabBar.tsx@@ -5,7 +5,7 @@ import { cn } from '@posthog/quill'import { commandLogic } from 'lib/components/Command/commandLogic'-import { TODAY_RAIL_ITEMS } from './todayRailItems'+import { TODAY_PANES, TODAY_RAIL_PANES } from './todayRailItems'import { todayShellLogic } from './todayShellLogic'const TAB_CLASS =@@ -13,13 +13,14 @@ const TAB_CLASS =export function TodayTabBar(): JSX.Element {const { activePane } = useValues(todayShellLogic)- const { pickPane } = useActions(todayShellLogic)+ const { clickRailPane } = useActions(todayShellLogic)const { toggleCommand } = useActions(commandLogic)return (<div className="TodayTabBar" data-quill><nav aria-label="Main" className="flex h-14 min-w-0 flex-1 gap-1">- {TODAY_RAIL_ITEMS.map(({ pane, label, icon }) => {+ {TODAY_RAIL_PANES.map((pane) => {+ const { label, icon } = TODAY_PANES[pane]const active = activePane === panereturn (<button@@ -27,7 +28,7 @@ export function TodayTabBar(): JSX.Element {type="button"aria-current={active ? 'page' : undefined}data-attr={`today-rail-${pane}`}- onClick={() => pickPane(pane)}+ onClick={() => clickRailPane(pane)}className={cn(TAB_CLASS,active ? 'bg-fill-selected text-foreground' : 'text-muted-foreground'diff --git a/frontend/src/layout/today/todayRailItems.tsx b/frontend/src/layout/today/todayRailItems.tsxindex e0c489ab7f07..cdc71f982046 100644--- a/frontend/src/layout/today/todayRailItems.tsx+++ b/frontend/src/layout/today/todayRailItems.tsx@@ -1,16 +1,41 @@-import { IconApps, IconChat, IconGridMasonry, IconHome } from '@posthog/icons'+import { IconApps, IconChat, IconGridMasonry, IconHome, IconSidebarClose, IconSidebarOpen } from '@posthog/icons'-import { TodayRailPane } from './todayShellLogic'+import { isMac } from 'lib/utils/dom'+import { urls } from 'scenes/urls'-export interface TodayRailItem {- pane: TodayRailPane+import { TodayNewChatButton } from './TodayNewChatButton'+import { TodayNewViewButton } from './TodayNewViewButton'+import type { TodayRailPane } from './todayShellLogic'++export interface TodayPane {label: string+ /** The title on top of the pane. The scene header shows it too while the sidebar is hidden. */+ title: stringicon: JSX.Element+ /** The page a rail pick opens. Without one, a pick only opens the sidebar and the open page stays. */+ home?: () => string+ action?: () => JSX.Element+}++export const TODAY_PANES: Record<TodayRailPane, TodayPane> = {+ home: { label: 'Home', title: 'Today', icon: <IconHome />, home: () => urls.projectHomepage() },+ spaces: {+ label: 'Chats',+ title: 'Chats',+ icon: <IconChat />,+ home: () => urls.taskNewSession(),+ action: TodayNewChatButton,+ },+ views: { label: 'Views', title: 'Views', icon: <IconGridMasonry />, action: TodayNewViewButton },+ products: { label: 'Products', title: 'Products', icon: <IconApps /> },+}++export const TODAY_RAIL_PANES: TodayRailPane[] = ['home', 'spaces', 'views', 'products']++export function todaySidebarShortcutLabel(): string {+ return isMac() ? '⌘B' : 'Ctrl+B'}-export const TODAY_RAIL_ITEMS: TodayRailItem[] = [- { pane: 'home', label: 'Home', icon: <IconHome /> },- { pane: 'spaces', label: 'Chats', icon: <IconChat /> },- { pane: 'views', label: 'Views', icon: <IconGridMasonry /> },- { pane: 'products', label: 'Products', icon: <IconApps /> },-]+// The icon names describe the panel, not the click: IconSidebarOpen's arrow points in, so it reads as hide.+export const IconHideSidebar = IconSidebarOpen+export const IconShowSidebar = IconSidebarClosediff --git a/frontend/src/layout/today/todayShellLogic.test.ts b/frontend/src/layout/today/todayShellLogic.test.tsindex 609768db60df..35fa929b244c 100644--- a/frontend/src/layout/today/todayShellLogic.test.ts+++ b/frontend/src/layout/today/todayShellLogic.test.ts@@ -80,8 +80,8 @@ describe('todayShellLogic', () => {test.each([['home', '/home'],['spaces', '/spaces/new'],- ['views', '/views'],- ['products', '/tools'],+ ['views', '/airplane'],+ ['products', '/airplane'],] as const)('opens the %s section when its rail item is picked', (pane, pathname) => {const logic = todayShellLogic()logic.mount()@@ -92,6 +92,21 @@ describe('todayShellLogic', () => {expect(logic.values.activePane).toBe(pane)})+ test.each(['home', 'spaces', 'views', 'products'] as const)(+ 'a second rail click on %s hides the sidebar it opened',+ (pane) => {+ const logic = todayShellLogic()+ logic.mount()++ logic.actions.setSidebarOpen(false)+ logic.actions.clickRailPane(pane)+ expect(logic.values.sidebarVisible).toBe(true)++ logic.actions.clickRailPane(pane)+ expect(logic.values.sidebarVisible).toBe(false)+ }+ )+it('keeps the last pane open on pages that belong to no pane', () => {const logic = todayShellLogic()logic.mount()@@ -115,6 +130,24 @@ describe('todayShellLogic', () => {logic.actions.setSidebarOpen(false)expect(logic.values.leftNavWidth).toBe(TODAY_RAIL_WIDTH)})++ it('keeps the pinned sidebar open on a page change, and hides it once unpinned unless the rail picked the page', () => {+ const logic = todayShellLogic()+ logic.mount()++ logic.actions.setSidebarOpen(true)+ router.actions.push('/project/1/insights')+ expect(logic.values.sidebarVisible).toBe(true)++ logic.actions.toggleSidebarPinned()+ router.actions.push('/project/1/insights?tab=all')+ expect(logic.values.sidebarVisible).toBe(true)+ router.actions.push('/project/1/cohorts')+ expect(logic.values.sidebarVisible).toBe(false)++ logic.actions.pickPane('home')+ expect(logic.values.sidebarVisible).toBe(true)+ })it('keeps the rail on narrow windows and opens the sidebar as a drawer that closes on navigation', () => {const originalWidth = window.innerWidthObject.defineProperty(window, 'innerWidth', { configurable: true, value: 800 })diff --git a/frontend/src/layout/today/todayShellLogic.ts b/frontend/src/layout/today/todayShellLogic.tsindex 746c54e20429..def0654fb656 100644--- a/frontend/src/layout/today/todayShellLogic.ts+++ b/frontend/src/layout/today/todayShellLogic.ts@@ -14,8 +14,19 @@ import { urls } from 'scenes/urls'import { navigationLogic } from '~/layout/navigation/navigationLogic'+import { TODAY_PANES } from './todayRailItems'+export type TodayRailPane = 'home' | 'spaces' | 'views' | 'products'+/** What showed or hid the sidebar. `navigation` is a page change that hides the unpinned sidebar. */+export type TodaySidebarToggleSource =+ | 'rail'+ | 'shortcut'+ | 'resizer'+ | 'pane_header'+ | 'scene_breadcrumb'+ | 'navigation'+export const TODAY_RAIL_WIDTH = 60export const TODAY_PHONE_MAX_WIDTH = 768export const TODAY_SIDEBAR_DEFAULT_WIDTH: number = 312@@ -35,16 +46,9 @@ function isUnder(path: string, root: string): boolean {return path === root || path.startsWith(`${root}/`)}-const RAIL_PANE_HOME: Record<TodayRailPane, () => string> = {- home: () => urls.projectHomepage(),- spaces: () => urls.taskNewSession(),- views: () => urls.views(),- products: () => urls.tools(),-}--/** The page a rail pane opens. */-export function railPaneHref(pane: TodayRailPane): string {- return RAIL_PANE_HOME[pane]()+/** The page a rail pane opens, or undefined when the pane only opens the sidebar. */+export function railPaneHref(pane: TodayRailPane): string | undefined {+ return TODAY_PANES[pane].home?.()}const PHONE_PAGE_LIMIT = 50@@ -112,7 +116,9 @@ export interface todayShellLogicValues {phonePages: TodayPhonePage[]pickedPane: TodayRailPane | nullroutePane: TodayRailPane | null+ sidebarBreadcrumbShown: booleansidebarOpen: boolean+ sidebarPinned: booleansidebarVisible: booleansidebarWidth: numbertodayRailEnabled: boolean@@ -141,6 +147,9 @@ export interface todayShellLogicActions {searchParams: Record<string, any>url: string} // router+ clickRailPane: (pane: TodayRailPane) => {+ pane: TodayRailPane+ }goBackOnPhone: () => {value: true}@@ -159,7 +168,10 @@ export interface todayShellLogicActions {setSidebarWidth: (width: number) => {width: number}- toggleSidebar: () => {+ toggleSidebar: (source: TodaySidebarToggleSource) => {+ source: TodaySidebarToggleSource+ }+ toggleSidebarPinned: () => {value: true}}@@ -186,6 +198,12 @@ export interface todayShellLogicMeta {) => booleanphoneHeaderShown: (todayRailEnabled: boolean, phoneLayout: boolean, phoneHeaderHidden: boolean) => booleanphoneCanGoBack: (phonePages: TodayPhonePage[]) => boolean+ sidebarBreadcrumbShown: (+ todayRailEnabled: boolean,+ phoneLayout: boolean,+ mobileLayout: boolean,+ sidebarVisible: boolean+ ) => boolean}}@@ -209,7 +227,9 @@ export const todayShellLogic = kea<todayShellLogicType>([setMobileSidebarOpen: (open: boolean) => ({ open }),setSidebarOpen: (open: boolean) => ({ open }),setSidebarWidth: (width: number) => ({ width }),- toggleSidebar: true,+ toggleSidebar: (source: TodaySidebarToggleSource) => ({ source }),+ toggleSidebarPinned: true,+ clickRailPane: (pane: TodayRailPane) => ({ pane }),}),windowValues(() => ({phoneLayout: (window: Window) => window.innerWidth < TODAY_PHONE_MAX_WIDTH,@@ -230,6 +250,13 @@ export const todayShellLogic = kea<todayShellLogicType>([setSidebarOpen: (_, { open }) => open,},],+ sidebarPinned: [+ true,+ { persist: true },+ {+ toggleSidebarPinned: (state) => !state,+ },+ ],mobileSidebarOpen: [false,{@@ -296,17 +323,53 @@ export const todayShellLogic = kea<todayShellLogicType>([todayRailEnabled && phoneLayout && !phoneHeaderHidden,],phoneCanGoBack: [(s) => [s.phonePages], (phonePages: TodayPhonePage[]): boolean => phonePages.length > 1],+ // The scene title row names the hidden sidebar's pane, so a click there opens it again. A floating sidebar+ // covers the button instead of replacing it, so it stays and the title never shifts. Phones open the+ // sidebar from the phone header.+ sidebarBreadcrumbShown: [+ (s) => [s.todayRailEnabled, s.phoneLayout, s.mobileLayout, s.sidebarVisible],+ (+ todayRailEnabled: boolean,+ phoneLayout: boolean,+ mobileLayout: boolean,+ sidebarVisible: boolean+ ): boolean => todayRailEnabled && !phoneLayout && (mobileLayout || !sidebarVisible),+ ],}),subscriptions(({ actions }) => ({mobileLayout: () => actions.setMobileSidebarOpen(false),})),listeners(({ actions, values, cache }) => ({- toggleSidebar: () => {+ toggleSidebar: ({ source }) => {if (values.mobileLayout) {actions.setMobileSidebarOpen(!values.mobileSidebarOpen)} else {actions.setSidebarOpen(!values.sidebarOpen)}+ // pinned: analytics event name and properties. Renaming them breaks dashboards.+ posthog.capture('today sidebar toggled', {+ source,+ open: values.sidebarVisible,+ mobile_layout: values.mobileLayout,+ })+ },+ locationChanged: ({ method, pathname }) => {+ const pageChanged = method === 'PUSH' && pathname !== cache.lastPathname+ cache.lastPathname = pathname+ // An unpinned sidebar gives the new page room. The drawer closes on its own, and a rail pick wants it open.+ if (+ pageChanged &&+ !values.sidebarPinned &&+ !values.mobileLayout &&+ values.sidebarOpen &&+ !cache.pickingPane+ ) {+ actions.toggleSidebar('navigation')+ }+ },+ toggleSidebarPinned: () => {+ // pinned: analytics event name and property. Renaming them breaks dashboards.+ posthog.capture('today sidebar pin toggled', { pinned: values.sidebarPinned })},setMobileSidebarOpen: ({ open }) => {if (!open) {@@ -332,10 +395,22 @@ export const todayShellLogic = kea<todayShellLogicType>([actions.setPhonePages(values.phonePages.slice(0, -1))router.actions.replace(previous.url)},+ clickRailPane: ({ pane }) => {+ if (values.activePane === pane && values.sidebarVisible) {+ actions.toggleSidebar('rail')+ return+ }+ actions.pickPane(pane)+ },pickPane: ({ pane }) => {// pinned: analytics event name and property. Renaming them breaks dashboards.posthog.capture('today rail pane picked', { pane, phone_layout: values.phoneLayout })- router.actions.push(railPaneHref(pane))+ const href = railPaneHref(pane)+ if (href) {+ cache.pickingPane = true+ router.actions.push(href)+ cache.pickingPane = false+ }if (values.mobileLayout) {actions.setMobileSidebarOpen(true)} else {@@ -343,8 +418,9 @@ export const todayShellLogic = kea<todayShellLogicType>([}},})),- afterMount(({ actions }) => {+ afterMount(({ actions, cache }) => {const { pathname, search, hash } = router.values.location+ cache.lastPathname = pathnameactions.setPhonePages([{ pathname, url: `${pathname}${search}${hash}` }])}),])diff --git a/frontend/src/scenes/activity/ActivitySceneHeader.tsx b/frontend/src/scenes/activity/ActivitySceneHeader.tsxnew file mode 100644index 000000000000..0e264f3f9382--- /dev/null+++ b/frontend/src/scenes/activity/ActivitySceneHeader.tsx@@ -0,0 +1,63 @@+import { useValues } from 'kea'+import { ReactNode } from 'react'++import { sceneConfigurations } from 'scenes/scenes'+import { Scene } from 'scenes/sceneTypes'+import { urls } from 'scenes/urls'++import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'+import { todayShellLogic } from '~/layout/today/todayShellLogic'+import { FileSystemIconType } from '~/queries/schema/schema-general'+import { ActivityTab } from '~/types'++import { ActivitySceneTabs } from './ActivitySceneTabs'+import { activitySceneTabsLogic } from './activitySceneTabsLogic'++const ACTIVITY_BREADCRUMB = {+ key: Scene.Activity,+ name: sceneConfigurations[Scene.Activity].name,+ path: urls.activity(),+}++export function ActivitySceneHeader({+ activeKey,+ name,+ description,+ iconType,+ banner,+}: {+ activeKey: ActivityTab+ name: string | undefined+ description?: string+ iconType: FileSystemIconType | undefined+ /** A notice for the scene. It sits between the tabs and the title, or below the tabs under the Today layout. */+ banner?: ReactNode+}): JSX.Element {+ const { todayRailEnabled } = useValues(todayShellLogic)+ const { activityTabs } = useValues(activitySceneTabsLogic)+ const resourceType = { type: iconType || 'default_icon_type' }++ if (!todayRailEnabled) {+ return (+ <>+ <ActivitySceneTabs activeKey={activeKey} />+ {banner}+ <SceneTitleSection name={name} description={description} resourceType={resourceType} />+ </>+ )+ }++ const tabLabel = activityTabs.find((tab) => tab.key === activeKey)?.label ?? name+ return (+ <>+ <SceneTitleSection+ name={tabLabel}+ description={description}+ resourceType={resourceType}+ forceBackTo={ACTIVITY_BREADCRUMB}+ />+ <ActivitySceneTabs activeKey={activeKey} />+ {banner}+ </>+ )+}diff --git a/frontend/src/scenes/activity/explore/EventsScene.tsx b/frontend/src/scenes/activity/explore/EventsScene.tsxindex 0be180f84313..9d4c1a0e9987 100644--- a/frontend/src/scenes/activity/explore/EventsScene.tsx+++ b/frontend/src/scenes/activity/explore/EventsScene.tsx@@ -4,14 +4,13 @@ import { LiveUserCount } from 'lib/components/LiveUserCount'import { FEATURE_FLAGS } from 'lib/constants'import { LemonBanner } from 'lib/lemon-ui/LemonBanner'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'-import { ActivitySceneTabs } from 'scenes/activity/ActivitySceneTabs'+import { ActivitySceneHeader } from 'scenes/activity/ActivitySceneHeader'import { FLAG_EVALUATIONS_RETENTION_DAYS } from 'scenes/feature-flags/flagEvaluationsTable'import { sceneConfigurations } from 'scenes/scenes'import { Scene, SceneExport } from 'scenes/sceneTypes'import { LiveRecordingsCount } from 'scenes/session-recordings/components/LiveRecordingsCount'import { SceneContent } from '~/layout/scenes/components/SceneContent'-import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import { QueryFeature } from '~/queries/nodes/DataTable/queryFeatures'import { Query } from '~/queries/Query/Query'import { ProductKey } from '~/queries/schema/schema-general'@@ -31,13 +30,11 @@ export function EventsScene(): JSX.Element {return (<SceneContent>- <ActivitySceneTabs activeKey={ActivityTab.ExploreEvents} />- <SceneTitleSection+ <ActivitySceneHeader+ activeKey={ActivityTab.ExploreEvents}name={sceneConfigurations[Scene.Activity].name}description={sceneConfigurations[Scene.Activity].description}- resourceType={{- type: sceneConfigurations[Scene.ExploreEvents].iconType || 'default_icon_type',- }}+ iconType={sceneConfigurations[Scene.ExploreEvents].iconType}/>{featureFlags[FEATURE_FLAGS.LIVESTREAM_HOGQL] && (<div className="flex flex-wrap gap-2 mb-2">diff --git a/frontend/src/scenes/activity/explore/SessionsScene.tsx b/frontend/src/scenes/activity/explore/SessionsScene.tsxindex 7fb55c73f92c..867da0ed42f0 100644--- a/frontend/src/scenes/activity/explore/SessionsScene.tsx+++ b/frontend/src/scenes/activity/explore/SessionsScene.tsx@@ -1,12 +1,11 @@import { useActions, useValues } from 'kea'import { useMemo } from 'react'-import { ActivitySceneTabs } from 'scenes/activity/ActivitySceneTabs'+import { ActivitySceneHeader } from 'scenes/activity/ActivitySceneHeader'import { sceneConfigurations } from 'scenes/scenes'import { Scene, SceneExport } from 'scenes/sceneTypes'import { SceneContent } from '~/layout/scenes/components/SceneContent'-import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import { QueryFeature } from '~/queries/nodes/DataTable/queryFeatures'import { Query } from '~/queries/Query/Query'import { DataTableNode, ProductKey } from '~/queries/schema/schema-general'@@ -29,13 +28,11 @@ export function SessionsScene(): JSX.Element {return (<SceneContent>- <ActivitySceneTabs activeKey={ActivityTab.ExploreSessions} />- <SceneTitleSection+ <ActivitySceneHeader+ activeKey={ActivityTab.ExploreSessions}name={sceneConfigurations[Scene.ExploreSessions].name}description={sceneConfigurations[Scene.ExploreSessions].description}- resourceType={{- type: sceneConfigurations[Scene.ExploreSessions].iconType || 'default_icon_type',- }}+ iconType={sceneConfigurations[Scene.ExploreSessions].iconType}/><QueryattachTo={sessionsSceneLogic()}diff --git a/frontend/src/scenes/activity/live/LiveEventsTable.tsx b/frontend/src/scenes/activity/live/LiveEventsTable.tsxindex 554d6136a130..b519856539ba 100644--- a/frontend/src/scenes/activity/live/LiveEventsTable.tsx+++ b/frontend/src/scenes/activity/live/LiveEventsTable.tsx@@ -11,13 +11,12 @@ import { FEATURE_FLAGS } from 'lib/constants'import { usePageVisibility } from 'lib/hooks/usePageVisibility'import { LemonBanner } from 'lib/lemon-ui/LemonBanner'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'-import { ActivitySceneTabs } from 'scenes/activity/ActivitySceneTabs'+import { ActivitySceneHeader } from 'scenes/activity/ActivitySceneHeader'import { sceneConfigurations } from 'scenes/scenes'import { Scene, SceneExport } from 'scenes/sceneTypes'import { LiveRecordingsCount } from 'scenes/session-recordings/components/LiveRecordingsCount'import { SceneContent } from '~/layout/scenes/components/SceneContent'-import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import { ProductKey } from '~/queries/schema/schema-general'import { ActivityTab, PropertyOperator } from '~/types'@@ -56,19 +55,24 @@ export function LiveEventsTable(): JSX.Element {return (<SceneContent data-attr="manage-events-table">- <ActivitySceneTabs activeKey={ActivityTab.LiveEvents} />- <LemonBanner type="info" className="mb-4" icon={<IconTerminal />} dismissKey="livestream-tui-banner">- Stream live events directly in your terminal with <code>posthog-live</code>.{' '}- <Link to="https://posthog.com/docs/activity#terminal-live-events-posthog-live" target="_blank">- Learn more- </Link>- </LemonBanner>- <SceneTitleSection+ <ActivitySceneHeader+ activeKey={ActivityTab.LiveEvents}name={sceneConfigurations[Scene.Activity].name}description={sceneConfigurations[Scene.Activity].description}- resourceType={{- type: sceneConfigurations[Scene.LiveEvents].iconType || 'default_icon_type',- }}+ iconType={sceneConfigurations[Scene.LiveEvents].iconType}+ banner={+ <LemonBanner+ type="info"+ className="mb-4"+ icon={<IconTerminal />}+ dismissKey="livestream-tui-banner"+ >+ Stream live events directly in your terminal with <code>posthog-live</code>.{' '}+ <Link to="https://posthog.com/docs/activity#terminal-live-events-posthog-live" target="_blank">+ Learn more+ </Link>+ </LemonBanner>+ }/><div className="mb-4 flex w-full justify-between items-center"><div className="flex gap-2">diff --git a/frontend/src/scenes/dashboard/dashboards/Dashboards.tsx b/frontend/src/scenes/dashboard/dashboards/Dashboards.tsxindex f6860836b4df..0d0cc90f0315 100644--- a/frontend/src/scenes/dashboard/dashboards/Dashboards.tsx+++ b/frontend/src/scenes/dashboard/dashboards/Dashboards.tsx@@ -32,6 +32,7 @@ import { CrossProjectDashboardsList } from 'products/cross_project_dashboards/frimport { NewCrossProjectDashboardButton } from 'products/cross_project_dashboards/frontend/NewCrossProjectDashboardButton'import { dashboardsEmptyState } from 'products/dashboards/frontend/emptyState/dashboardsEmptyState'+import { DashboardsSceneMenuBar } from './DashboardsSceneMenuBar'import { DashboardsTableContainer } from './DashboardsTable'import { NewDashboardMenu } from './NewDashboardMenu'@@ -84,6 +85,7 @@ export function Dashboards(): JSX.Element {<DashboardTemplateEditor /><DashboardTemplateModal />+ <DashboardsSceneMenuBar /><SceneTitleSectionname={sceneConfigurations[Scene.Dashboards].name}description={sceneConfigurations[Scene.Dashboards].description}diff --git a/frontend/src/scenes/dashboard/dashboards/DashboardsSceneMenuBar.tsx b/frontend/src/scenes/dashboard/dashboards/DashboardsSceneMenuBar.tsxnew file mode 100644index 000000000000..4611f6d789ae--- /dev/null+++ b/frontend/src/scenes/dashboard/dashboards/DashboardsSceneMenuBar.tsx@@ -0,0 +1,54 @@+import { useActions, useValues } from 'kea'+import { combineUrl, router } from 'kea-router'++import { IconPencil, IconPlusSmall } from '@posthog/icons'++import { FEATURE_FLAGS } from 'lib/constants'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'+import { newDashboardLogic } from 'scenes/dashboard/newDashboardLogic'+import { urls } from 'scenes/urls'++import { SceneMenuBar, SceneMenuBarItem, SceneMenuBarMenu } from '~/layout/scenes/components/SceneMenuBar'+import { AccessControlLevel, AccessControlResourceType } from '~/types'++export function DashboardsSceneMenuBar(): JSX.Element | null {+ const { featureFlags } = useValues(featureFlagLogic)+ if (!featureFlags[FEATURE_FLAGS.SCENE_MENU_BAR]) {+ return null+ }+ return <DashboardsSceneMenuBarInner />+}++function DashboardsSceneMenuBarInner(): JSX.Element {+ const { showNewDashboardModal } = useActions(newDashboardLogic)+ const { searchParams } = useValues(router)+ const newDashboardDisabledReason = getAccessControlDisabledReason(+ AccessControlResourceType.Dashboard,+ AccessControlLevel.Editor+ )++ return (+ <SceneMenuBar>+ <SceneMenuBarMenu label="File" dataAttr="dashboards-menubar-file">+ <SceneMenuBarItem+ data-attr="dashboards-menubar-new-dashboard"+ opensFloatingUi+ disabled={!!newDashboardDisabledReason}+ tooltip={newDashboardDisabledReason ?? undefined}+ onClick={showNewDashboardModal}+ >+ <IconPlusSmall />+ New dashboard+ </SceneMenuBarItem>+ <SceneMenuBarItem+ data-attr="dashboards-menubar-manage-templates"+ onClick={() => router.actions.push(combineUrl(urls.dashboardTemplates(), searchParams).url)}+ >+ <IconPencil />+ Manage templates+ </SceneMenuBarItem>+ </SceneMenuBarMenu>+ </SceneMenuBar>+ )+}diff --git a/frontend/src/scenes/notebooks/NotebookScene.tsx b/frontend/src/scenes/notebooks/NotebookScene.tsxindex 041a48f34976..26e00e8d8a70 100644--- a/frontend/src/scenes/notebooks/NotebookScene.tsx+++ b/frontend/src/scenes/notebooks/NotebookScene.tsx@@ -16,6 +16,8 @@ import { cn } from 'lib/utils/css-classes'import { SceneExport } from 'scenes/sceneTypes'import { SceneBreadcrumbBackButton } from '~/layout/scenes/components/SceneBreadcrumbs'+import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'+import { todayShellLogic } from '~/layout/today/todayShellLogic'import { Notebook } from './Notebook/Notebook'import { NotebookLoadingState } from './Notebook/NotebookLoadingState'@@ -60,6 +62,7 @@ export function NotebookScene(): JSX.Element {const [isMarkdownSourceOpen, setIsMarkdownSourceOpen] = useState(false)const { featureFlags } = useValues(featureFlagLogic)const sceneMenuBarEnabled = !!featureFlags[FEATURE_FLAGS.SCENE_MENU_BAR]+ const { todayRailEnabled } = useValues(todayShellLogic)useEffect(() => {if (notebookId === 'new') {@@ -131,9 +134,17 @@ export function NotebookScene(): JSX.Element {return (<><NotebookSceneMenuBar shortId={notebookId} />+ {/* Under the Today layout the title row carries the breadcrumbs, as on every other scene. */}+ {todayRailEnabled && (+ <SceneTitleSection+ name={notebook?.title || 'Unnamed'}+ isLoading={!notebook}+ resourceType={{ type: 'notebook' }}+ />+ )}<div className={cn('flex items-center justify-between', sceneMenuBarEnabled && 'mt-2')}><div className="flex gap-2 items-center">- <SceneBreadcrumbBackButton />+ {!todayRailEnabled && <SceneBreadcrumbBackButton />}{isTemplate && <LemonTag type="highlight">TEMPLATE</LemonTag>}<UserActivityIndicator at={notebook?.last_modified_at} by={notebook?.last_modified_by} /><BindLogic logic={notebookLogic} props={{ shortId: notebookId, target: NotebookTarget.Scene }}>diff --git a/frontend/src/styles/base.scss b/frontend/src/styles/base.scssindex 367edf2690a4..476ec19776ba 100644--- a/frontend/src/styles/base.scss+++ b/frontend/src/styles/base.scss@@ -1231,6 +1231,14 @@}}+ // Icons that use a clip path share its id across every copy on the page, and the browser uses the first copy.+ // If that copy sits in a `visibility: hidden` container (a closed drawer), the clip path inherits it and every+ // copy of the icon goes blank. A clip path is never drawn by itself, so keeping it visible changes nothing else.+ clipPath,+ clipPath * {+ visibility: visible;+ }+a:focus-visible,button:focus-visible,[data-highlighted]:not(:hover) {diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsxindex 987db9491df8..291424a83622 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx@@ -13,6 +13,7 @@ import { urls } from 'scenes/urls'import { QuillSceneHeader } from '~/layout/scenes/components/QuillSceneHeader'import { QuillSceneName } from '~/layout/scenes/components/QuillSceneName'+import { QuillSceneTrail } from '~/layout/scenes/components/QuillSceneTrail'import { SceneContent } from '~/layout/scenes/components/SceneContent'import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import {@@ -23,6 +24,7 @@ import {} from '~/layout/scenes/SceneLayout'import { TodaySessionIcon } from '~/layout/today/TodaySessionIcon'import { todayShellLogic } from '~/layout/today/todayShellLogic'+import { TodaySidebarBreadcrumb } from '~/layout/today/TodaySidebarBreadcrumb'import { sessionIconFields } from '~/layout/today/todayWorkItems'import type { TaskRunDetailDTOApi } from 'products/tasks/frontend/generated/api.schemas'@@ -76,7 +78,7 @@ export function TaskRunSceneShell({children,}: TaskRunSceneShellProps): JSX.Element {const skin = useThreadSkin()- const { todayRailEnabled, phoneLayout, phoneHeaderHidden } = useValues(todayShellLogic)+ const { todayRailEnabled, phoneLayout, phoneHeaderHidden, sidebarBreadcrumbShown } = useValues(todayShellLogic)const { goBackOnPhone } = useActions(todayShellLogic)const todayPhone = todayRailEnabled && phoneLayoutreturn (@@ -152,28 +154,31 @@ export function TaskRunSceneShell({<QuillSceneHeaderclassName={cn(taskError && 'mt-4')}back={- isMobile && !todayPhone ? (- <Button- variant="default"- size="icon"- nativeButton={false}- render={<LinkPrimitive to={urls.ai()} />}- aria-label="Back to PostHog AI"- >- <IconChevronLeft />- </Button>- ) : phoneHeaderHidden ? (- <Button- variant="default"- size="icon-lg"- className="-ml-2"- aria-label="Back"- onClick={goBackOnPhone}- data-attr="today-phone-back"- >- <IconChevronLeft />- </Button>- ) : undefined+ <>+ <QuillSceneTrail lead={sidebarBreadcrumbShown && <TodaySidebarBreadcrumb />} />+ {isMobile && !todayPhone ? (+ <Button+ variant="default"+ size="icon"+ nativeButton={false}+ render={<LinkPrimitive to={urls.ai()} />}+ aria-label="Back to PostHog AI"+ >+ <IconChevronLeft />+ </Button>+ ) : phoneHeaderHidden ? (+ <Button+ variant="default"+ size="icon-lg"+ className="-ml-2"+ aria-label="Back"+ onClick={goBackOnPhone}+ data-attr="today-phone-back"+ >+ <IconChevronLeft />+ </Button>+ ) : undefined}+ </>}icon={<TodaySessionIcon item={sessionIconFields(task?.latest_run)} />}title={