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(posthog-ai): session menu as a sheet with a details page on phones (#111554)

Shy Alter2a912cfd95db
diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/QuillTaskMenu.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/QuillTaskMenu.tsx
index f07738d685b9..fd617a9083d6 100644
--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/QuillTaskMenu.tsx
+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/QuillTaskMenu.tsx
@@ -1,7 +1,7 @@
import { useActions, useValues } from 'kea'
-import type { ReactNode } from 'react'
+import { type ReactNode, useState } from 'react'
-import { IconArchive, IconEllipsis } from '@posthog/icons'
+import { IconArchive, IconBug, IconEllipsis, IconInfo } from '@posthog/icons'
import {
Button,
DropdownMenu,
@@ -11,10 +11,15 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
MenuLabel,
+ cn,
} from '@posthog/quill-primitives'
import { dayjs } from 'lib/dayjs'
+import { SHEET_PARTS } from '~/layout/today/todayMenuParts'
+import { TodaySheetMenu } from '~/layout/today/TodaySheetMenu'
+import { todayShellLogic } from '~/layout/today/todayShellLogic'
+
import type { TaskRunDetailDTOApi } from 'products/tasks/frontend/generated/api.schemas'
import { debugLogsLogic } from '../../../logics/debugLogsLogic'
@@ -36,9 +41,15 @@ function RelativeTime({ time }: { time: string }): JSX.Element {
)
}
-function FactList({ facts }: { facts: { label: string; value: ReactNode }[] }): JSX.Element {
+function FactList({
+ facts,
+ className = 'gap-1 px-2 pb-1 text-xs',
+}: {
+ facts: { label: string; value: ReactNode }[]
+ className?: string
+}): JSX.Element {
return (
- <dl className="m-0 flex flex-col gap-1 px-2 pb-1 text-xs">
+ <dl className={cn('m-0 flex flex-col', className)}>
{facts.map((fact) => (
<div key={fact.label} className="flex items-baseline justify-between gap-4">
<dt className="text-muted-foreground">{fact.label}</dt>
@@ -53,6 +64,8 @@ export function QuillTaskMenu({ task, selectedRun, onArchive }: QuillTaskMenuPro
const { catalogue } = useValues(modelCatalogueLogic)
const { canControlDebugLogs, debugLogsEnabled } = useValues(debugLogsLogic)
const { setDebugLogsEnabled } = useActions(debugLogsLogic)
+ const { todayRailEnabled, phoneLayout } = useValues(todayShellLogic)
+ const [sheetOpen, setSheetOpen] = useState(false)
const taskFacts = [
{ label: 'Task ID', value: <span className="font-mono">{task.slug}</span> },
@@ -67,6 +80,61 @@ export function QuillTaskMenu({ task, selectedRun, onArchive }: QuillTaskMenuPro
}))
: []
+ if (todayRailEnabled && phoneLayout) {
+ return (
+ <>
+ <Button
+ variant="default"
+ size="icon-lg"
+ aria-label="Task actions"
+ onClick={() => setSheetOpen(true)}
+ data-attr="run-staff-menu"
+ >
+ <IconEllipsis />
+ </Button>
+ <TodaySheetMenu open={sheetOpen} onOpenChange={setSheetOpen} title={task.title || 'Task'}>
+ <SHEET_PARTS.Sub
+ label={
+ <>
+ <IconInfo />
+ Task details
+ </>
+ }
+ title="Task details"
+ dataAttr="task-details"
+ >
+ <div className="flex flex-col gap-4 px-4 py-3">
+ <section className="flex flex-col gap-2">
+ <MenuLabel className="px-0">Task</MenuLabel>
+ <FactList facts={taskFacts} className="gap-2 text-sm" />
+ </section>
+ {runFacts.length > 0 && (
+ <section className="flex flex-col gap-2">
+ <MenuLabel className="px-0">Run</MenuLabel>
+ <FactList facts={runFacts} className="gap-2 text-sm" />
+ </section>
+ )}
+ </div>
+ </SHEET_PARTS.Sub>
+ {canControlDebugLogs && (
+ <SHEET_PARTS.Item
+ onClick={() => setDebugLogsEnabled(!debugLogsEnabled)}
+ dataAttr="run-toggle-debug-logs"
+ >
+ <IconBug />
+ {debugLogsEnabled ? 'Hide debug logs' : 'Show debug logs'}
+ </SHEET_PARTS.Item>
+ )}
+ <SHEET_PARTS.Separator />
+ <SHEET_PARTS.Item variant="destructive" onClick={onArchive} dataAttr="task-archive">
+ <IconArchive />
+ Archive task
+ </SHEET_PARTS.Item>
+ </TodaySheetMenu>
+ </>
+ )
+ }
+
return (
<DropdownMenu>
<DropdownMenuTrigger