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(today): drop the phone header on quill posthog ai tasks (#111580)

Shy Alterc53e5c11bb52
diff --git a/frontend/src/layout/navigation-3000/Navigation.tsx b/frontend/src/layout/navigation-3000/Navigation.tsx
index 5663eb9a839a..2b730bdef010 100644
--- a/frontend/src/layout/navigation-3000/Navigation.tsx
+++ b/frontend/src/layout/navigation-3000/Navigation.tsx
@@ -55,6 +55,7 @@ export function Navigation({
todayRailEnabled: todayRail,
sidebarVisible: todaySidebarVisible,
phoneLayout: todayPhoneLayout,
+ phoneHeaderHidden: todayPhoneHeaderHidden,
} = useValues(todayShellLogic)
const todayDrawerOpen = todayRail && mobileLayout && todaySidebarVisible
const todayPhone = todayRail && todayPhoneLayout
@@ -175,6 +176,7 @@ export function Navigation({
'app-layout--mobile': (mobileLayout && !todayRail) || todayPhone,
TodayAppLayout: todayRail,
'TodayAppLayout--phone': todayPhone,
+ 'TodayAppLayout--no-phone-header': todayPhoneHeaderHidden,
})}
style={
{
diff --git a/frontend/src/layout/today/TodayPhoneHeader.tsx b/frontend/src/layout/today/TodayPhoneHeader.tsx
index 6d7191c9b6b4..33f5cc89f1f1 100644
--- a/frontend/src/layout/today/TodayPhoneHeader.tsx
+++ b/frontend/src/layout/today/TodayPhoneHeader.tsx
@@ -16,6 +16,7 @@ const TITLE_SCROLL_THRESHOLD = 56
export function TodayPhoneHeader(): JSX.Element {
const { sceneBreadcrumbs } = useValues(breadcrumbsLogic)
const { scenePanelIsPresent } = useValues(sceneLayoutLogic)
+ const { onAiPage } = useValues(todayShellLogic)
const { goBackOnPhone } = useActions(todayShellLogic)
const { openSidePanel } = useActions(sidePanelStateLogic)
const [scrolled, setScrolled] = useState(false)
@@ -51,15 +52,17 @@ export function TodayPhoneHeader(): JSX.Element {
>
{title}
</Text>
- <Button
- size="icon-lg"
- className="rounded-full"
- aria-label="Open context panel"
- data-attr="today-phone-context-panel"
- onClick={() => openSidePanel(scenePanelIsPresent ? SidePanelTab.Info : SidePanelTab.Max)}
- >
- <IconSidePanel />
- </Button>
+ {!onAiPage && (
+ <Button
+ size="icon-lg"
+ className="rounded-full"
+ aria-label="Open context panel"
+ data-attr="today-phone-context-panel"
+ onClick={() => openSidePanel(scenePanelIsPresent ? SidePanelTab.Info : SidePanelTab.Max)}
+ >
+ <IconSidePanel />
+ </Button>
+ )}
</header>
)
}
diff --git a/frontend/src/layout/today/TodayShell.scss b/frontend/src/layout/today/TodayShell.scss
index fd7aa50865b3..1d31f724ab9b 100644
--- a/frontend/src/layout/today/TodayShell.scss
+++ b/frontend/src/layout/today/TodayShell.scss
@@ -69,6 +69,10 @@
padding-top: var(--today-phone-header-height);
padding-bottom: var(--today-tab-bar-height);
+
+ &.TodayAppLayout--no-phone-header {
+ --today-phone-header-height: 0px;
+ }
}
.TodayPhoneHeader {
diff --git a/frontend/src/layout/today/TodayShell.tsx b/frontend/src/layout/today/TodayShell.tsx
index a2973860a65e..795737b5845e 100644
--- a/frontend/src/layout/today/TodayShell.tsx
+++ b/frontend/src/layout/today/TodayShell.tsx
@@ -57,7 +57,8 @@ const PANE_LABELS = {
/** 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 } = useValues(todayShellLogic)
+ const { activePane, mobileLayout, phoneLayout, sidebarVisible, sidebarWidth, phoneHeaderHidden } =
+ useValues(todayShellLogic)
// Records the tools and sessions visited while other panes are open, so each pane's Recent group is ready.
useMountedLogic(todayRecentsLogic)
const { pickPane, setMobileSidebarOpen, setSidebarOpen, setSidebarWidth, toggleSidebar } =
@@ -141,7 +142,7 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {
return (
<ToastProvider>
<div data-quill className={cn('Today TodayShell TodayShell--phone', className)}>
- {!sidebarVisible && <TodayPhoneHeader />}
+ {!sidebarVisible && !phoneHeaderHidden && <TodayPhoneHeader />}
<aside
ref={drawerRef}
tabIndex={-1}
diff --git a/frontend/src/layout/today/todayShellLogic.test.ts b/frontend/src/layout/today/todayShellLogic.test.ts
index 9047f04d0377..0589f15e3bdb 100644
--- a/frontend/src/layout/today/todayShellLogic.test.ts
+++ b/frontend/src/layout/today/todayShellLogic.test.ts
@@ -133,6 +133,30 @@ describe('todayShellLogic', () => {
}
})
+ test.each([
+ ['/project/1/ai', { task: 'task-1' }, true],
+ ['/project/1/ai', { chat: 'chat-1' }, false],
+ ['/project/1/ai', {}, false],
+ ['/project/1/ai-observability', { task: 'task-1' }, false],
+ ['/project/1/tasks', { task: 'task-1' }, false],
+ ])('on phone widths, %s with %o hides the phone header: %s', (pathname, searchParams, hidden) => {
+ const originalWidth = window.innerWidth
+ Object.defineProperty(window, 'innerWidth', { configurable: true, value: 390 })
+ try {
+ featureFlagLogic.mount()
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.TODAY_RAIL_NAV], {
+ [FEATURE_FLAGS.TODAY_RAIL_NAV]: true,
+ })
+ const logic = todayShellLogic()
+ logic.mount()
+
+ router.actions.push(pathname, searchParams)
+ expect(logic.values.phoneHeaderHidden).toBe(hidden)
+ } finally {
+ Object.defineProperty(window, 'innerWidth', { configurable: true, value: originalWidth })
+ }
+ })
+
it('on phone widths, goes back through pages and then to the pane', () => {
const originalWidth = window.innerWidth
Object.defineProperty(window, 'innerWidth', { configurable: true, value: 390 })
diff --git a/frontend/src/layout/today/todayShellLogic.ts b/frontend/src/layout/today/todayShellLogic.ts
index c2ffa32b117e..ab6e2d17f7e6 100644
--- a/frontend/src/layout/today/todayShellLogic.ts
+++ b/frontend/src/layout/today/todayShellLogic.ts
@@ -100,6 +100,8 @@ export interface todayShellLogicValues {
activePane: TodayRailPane
leftNavWidth: number
mobileSidebarOpen: boolean
+ onAiPage: boolean
+ phoneHeaderHidden: boolean
phoneLayout: boolean
phonePages: TodayPhonePage[]
pickedPane: TodayRailPane | null
@@ -173,6 +175,13 @@ export interface todayShellLogicMeta {
) => number
sidebarVisible: (mobileLayout: boolean, mobileSidebarOpen: boolean, sidebarOpen: boolean) => boolean
todayRailEnabled: (featureFlags: FeatureFlagsSet) => boolean
+ onAiPage: (location: { hash: string; pathname: string; search: string }) => boolean
+ phoneHeaderHidden: (
+ onAiPage: boolean,
+ searchParams: Record<string, any>,
+ todayRailEnabled: boolean,
+ phoneLayout: boolean
+ ) => boolean
}
}
@@ -260,6 +269,22 @@ export const todayShellLogic = kea<todayShellLogicType>([
(s) => [s.featureFlags],
(featureFlags: FeatureFlagsSet): boolean => !!featureFlags[FEATURE_FLAGS.TODAY_RAIL_NAV],
],
+ onAiPage: [
+ () => [router.selectors.location],
+ (location: { pathname: string }): boolean => {
+ const path = removeProjectIdIfPresent(location.pathname)
+ return path === urls.ai() || path.startsWith(`${urls.ai()}/`)
+ },
+ ],
+ phoneHeaderHidden: [
+ (s) => [s.onAiPage, router.selectors.searchParams, s.todayRailEnabled, s.phoneLayout],
+ (
+ onAiPage: boolean,
+ searchParams: Record<string, any>,
+ todayRailEnabled: boolean,
+ phoneLayout: boolean
+ ): boolean => todayRailEnabled && phoneLayout && onAiPage && !!searchParams.task,
+ ],
}),
subscriptions(({ actions }) => ({
mobileLayout: () => actions.setMobileSidebarOpen(false),
diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx
index 4525495a7c0d..8b1aa4c2e3d1 100644
--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx
+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx
@@ -1,4 +1,4 @@
-import { useValues } from 'kea'
+import { useActions, useValues } from 'kea'
import { type ReactNode } from 'react'
import { IconArchive, IconChevronLeft } from '@posthog/icons'
@@ -76,7 +76,8 @@ export function TaskRunSceneShell({
children,
}: TaskRunSceneShellProps): JSX.Element {
const skin = useThreadSkin()
- const { todayRailEnabled, phoneLayout } = useValues(todayShellLogic)
+ const { todayRailEnabled, phoneLayout, phoneHeaderHidden } = useValues(todayShellLogic)
+ const { goBackOnPhone } = useActions(todayShellLogic)
const todayPhone = todayRailEnabled && phoneLayout
return (
<SceneContent className="h-full min-h-0 gap-y-0">
@@ -161,6 +162,17 @@ export function TaskRunSceneShell({
>
<IconChevronLeft />
</Button>
+ ) : phoneHeaderHidden ? (
+ <Button
+ variant="default"
+ size="icon-lg"
+ className="-ml-2 rounded-full"
+ aria-label="Back"
+ onClick={goBackOnPhone}
+ data-attr="today-phone-back"
+ >
+ <IconChevronLeft />
+ </Button>
) : undefined
}
icon={<TodaySessionIcon item={sessionIconFields(task?.latest_run)} />}