: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): adopt desktop's chrome in the today layout (#110696)
Adam Leith7b55f90a5c36
diff --git a/frontend/src/layout/navigation-3000/Navigation.tsx b/frontend/src/layout/navigation-3000/Navigation.tsxindex d0754c051b8a..9e259a3c995e 100644--- a/frontend/src/layout/navigation-3000/Navigation.tsx+++ b/frontend/src/layout/navigation-3000/Navigation.tsx@@ -20,7 +20,7 @@ import { todayShellLogic } from '~/layout/today/todayShellLogic'import { navigationLogic } from '../navigation/navigationLogic'import { ProjectNotice } from '../navigation/ProjectNotice'-import { SceneTitlePanelButton } from '../scenes/components/SceneTitleSection'+import { SceneTitlePanelButton } from '../scenes/components/SceneTitlePanelButton'import { SceneLayout } from '../scenes/SceneLayout'import { sceneLayoutLogic } from '../scenes/sceneLayoutLogic'import { MinimalNavigation } from './components/MinimalNavigation'@@ -196,8 +196,9 @@ export function Navigation({<divclassName={cn('@container/main-content-container main-content-container flex overflow-hidden border-primary relative',+ // Under the Today layout the shell draws the seam against the content in quill's border.todayRail- ? 'border-l'+ ? null: ['lg:rounded border-t lg:border lg:mr-1 lg:mb-1 lg:mt-1',sidePanelOpen && 'rounded-r-none',@@ -211,8 +212,10 @@ export function Navigation({tabIndex={0}id="main-content"className={cn(- '@container/main-content bg-[var(--scene-layout-background)] overflow-y-auto overflow-x-hidden show-scrollbar-on-hover p-4 pb-0 h-full flex-1 rounded-t focus-visible:outline-none flex flex-col',+ '@container/main-content bg-[var(--scene-layout-background)] overflow-y-auto overflow-x-hidden show-scrollbar-on-hover p-4 pb-0 h-full flex-1 focus-visible:outline-none flex flex-col',{+ // The Today layout's content meets the chrome on straight seams.+ 'rounded-t': !todayRail,'p-0': noPaddingScene,'lg:max-w-[calc(100%-var(--side-panel-width))] rounded-r-none': sidePanelOpen,}diff --git a/frontend/src/layout/scenes/components/QuillSceneHeader.tsx b/frontend/src/layout/scenes/components/QuillSceneHeader.tsxnew file mode 100644index 000000000000..e346a9a45b40--- /dev/null+++ b/frontend/src/layout/scenes/components/QuillSceneHeader.tsx@@ -0,0 +1,33 @@+import type { ReactNode } from 'react'++import { cn } from '@posthog/quill'++export interface QuillSceneHeaderProps {+ back?: ReactNode+ icon?: ReactNode+ title: ReactNode+ actions?: ReactNode+ className?: string+}++/**+ * The title bar under the Today layout, for both a scene and the sidebar pane beside it. One component with a fixed+ * height keeps the two bottom borders in one line across the window.+ */+export function QuillSceneHeader({ back, icon, title, actions, className }: QuillSceneHeaderProps): JSX.Element {+ return (+ <header+ data-quill+ className={cn('flex h-12 shrink-0 items-center gap-1 border-b border-[var(--border)] px-4', className)}+ >+ {back}+ {icon && (+ <span className="flex size-4 shrink-0 items-center justify-center text-sm [&_svg]:size-4" aria-hidden>+ {icon}+ </span>+ )}+ <div className="flex min-w-0 flex-1 items-center gap-1">{title}</div>+ {actions && <div className="ml-auto flex shrink-0 items-center gap-1">{actions}</div>}+ </header>+ )+}diff --git a/frontend/src/layout/scenes/components/QuillSceneName.tsx b/frontend/src/layout/scenes/components/QuillSceneName.tsxnew file mode 100644index 000000000000..43cabce765b9--- /dev/null+++ b/frontend/src/layout/scenes/components/QuillSceneName.tsx@@ -0,0 +1,136 @@+import type { ReactNode } from 'react'++import { IconSparkles } from '@posthog/icons'+import { Button, Input, SkeletonText, Tooltip, TooltipContent, TooltipTrigger, cn } from '@posthog/quill'++import { useSceneNameEditing } from './useSceneNameEditing'++export interface QuillSceneNameProps {+ name?: string+ isLoading?: boolean+ onChange?: (value: string) => void+ canEdit?: boolean+ /** Keeps the field open, for a resource that has no name yet. */+ forceEdit?: boolean+ renameDebounceMs?: number+ saveOnBlur?: boolean+ onGenerateMetadata?: () => void+ isGeneratingMetadata?: boolean+ suffix?: ReactNode+ editDataAttr?: string+}++// 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'++export function QuillSceneName({+ name: initialName,+ isLoading = false,+ onChange,+ canEdit = false,+ forceEdit = false,+ renameDebounceMs,+ saveOnBlur = false,+ onGenerateMetadata,+ isGeneratingMetadata = false,+ suffix,+ editDataAttr = 'scene-name-edit',+}: QuillSceneNameProps): JSX.Element {+ const { name, isEditing, containerRef, startEditing, change, blur, saveFromEnter, cancel } = useSceneNameEditing({+ name: initialName,+ isLoading,+ onChange,+ forceEdit,+ renameDebounceMs,+ saveOnBlur,+ isGeneratingMetadata,+ })+ const editable = !!onChange && canEdit+ const label = name || <span className="text-muted-foreground">Unnamed</span>++ if (isLoading) {+ // Same height as the name, so switching between resources does not shift the bar.+ return (+ <div className="flex h-7 min-w-0 flex-1 items-center">+ <SkeletonText lines={1} className="w-60 max-w-full" />+ </div>+ )+ }++ if (editable && isEditing) {+ return (+ <div ref={containerRef} className="flex min-w-0 flex-1 items-center gap-1" data-attr="scene-name-edit-row">+ <Input+ aria-label="Name"+ name="name"+ value={name || ''}+ readOnly={isGeneratingMetadata}+ placeholder="Enter name"+ onChange={(event: React.ChangeEvent<HTMLInputElement>) => change(event.target.value)}+ onBlur={blur}+ onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {+ if (event.key === 'Enter') {+ event.preventDefault()+ saveFromEnter(event.currentTarget.value)+ if (!forceEdit) {+ event.currentTarget.blur()+ }+ } else if (event.key === 'Escape') {+ event.preventDefault()+ cancel()+ }+ }}+ autoFocus={!forceEdit}+ data-attr="scene-title-textarea"+ className={cn(NAME_BOX, 'max-w-120 min-w-0 flex-1', isGeneratingMetadata && 'opacity-80')}+ />+ {onGenerateMetadata && (+ <Tooltip>+ <TooltipTrigger+ render={+ <Button+ variant="outline"+ size="icon-sm"+ aria-label="Generate name and description"+ disabled={isGeneratingMetadata}+ onClick={onGenerateMetadata}+ />+ }+ >+ <IconSparkles />+ </TooltipTrigger>+ <TooltipContent>+ {isGeneratingMetadata ? 'Thinking...' : 'Generate name and description'}+ </TooltipContent>+ </Tooltip>+ )}+ </div>+ )+ }++ return (+ <div data-attr="scene-name" className="flex min-w-0 items-center gap-1">+ {editable ? (+ <h1 className="m-0 flex min-w-0">+ <button+ type="button"+ onClick={startEditing}+ disabled={isGeneratingMetadata}+ title={isGeneratingMetadata ? 'Finish generating before editing' : 'Edit name'}+ data-attr={editDataAttr}+ className={cn(+ NAME_BOX,+ 'min-w-0 cursor-text truncate border-transparent text-start text-foreground',+ 'hover:bg-fill-hover focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:outline-none disabled:cursor-not-allowed'+ )}+ >+ {label}+ </button>+ </h1>+ ) : (+ <h1 className={cn(NAME_BOX, 'm-0 min-w-0 truncate border-transparent text-foreground')}>{label}</h1>+ )}+ {suffix}+ </div>+ )+}diff --git a/frontend/src/layout/scenes/components/QuillSceneTitleSection.tsx b/frontend/src/layout/scenes/components/QuillSceneTitleSection.tsxnew file mode 100644index 000000000000..f4f7140f4598--- /dev/null+++ b/frontend/src/layout/scenes/components/QuillSceneTitleSection.tsx@@ -0,0 +1,137 @@+import { useActions, useValues } from 'kea'+import { useMemo } from 'react'++import { IconCollapse, IconExpand } from '@posthog/icons'+import { Button, cn } from '@posthog/quill'++import { ProductSetupButton } from 'lib/components/ProductSetup'+import { releaseStageProductForScene } from 'lib/components/ReleaseStageTag/releaseStage'+import { ReleaseStageTag } from 'lib/components/ReleaseStageTag/ReleaseStageTag'+import { sceneLogic } from 'scenes/sceneLogic'++import { breadcrumbsLogic } from '~/layout/navigation/Breadcrumbs/breadcrumbsLogic'++import { sceneLayoutLogic } from '../sceneLayoutLogic'+import { QuillSceneHeader } from './QuillSceneHeader'+import { QuillSceneName } from './QuillSceneName'+import { SceneBreadcrumbBackButton } from './SceneBreadcrumbs'+import { SceneDescription } from './SceneDescription'+import { sceneResourceIcon } from './sceneResourceIcon'+import { SceneTitlePanelButton } from './SceneTitlePanelButton'+import type { SceneMainTitleProps } from './SceneTitleSection'++export function QuillSceneTitleSection({+ name,+ nameSuffix,+ description,+ resourceType,+ markdown = false,+ isLoading = false,+ onNameChange,+ onDescriptionChange,+ canEdit = false,+ forceEdit = false,+ descriptionAlwaysVisible = false,+ renameDebounceMs,+ saveOnBlur = false,+ noPadding = false,+ actions,+ hideProductSetupButton = false,+ forceBackTo,+ className,+ onGenerateMetadata,+ isGeneratingMetadata,+ maxToolProps,+ maxButtonLabel,+ descriptionMaxLength,+ sceneId,+}: SceneMainTitleProps): JSX.Element {+ const { breadcrumbs } = useValues(breadcrumbsLogic)+ const { activeSceneId } = useValues(sceneLogic)+ const { showDescription } = useValues(sceneLayoutLogic)+ const { toggleShowDescription } = useActions(sceneLayoutLogic)+ const releaseStageSceneId = sceneId ?? activeSceneId+ const releaseStageProduct = useMemo(+ () => releaseStageProductForScene(releaseStageSceneId, name),+ [releaseStageSceneId, name]+ )+ const hasDescription = description != null && (description || canEdit)+ const descriptionShown = hasDescription && (descriptionAlwaysVisible || showDescription || forceEdit)++ return (+ <>+ <QuillSceneHeader+ className={cn(+ 'z-30 bg-[var(--scene-layout-background)] @2xl/main-content:sticky -top-[calc(var(--spacing)*4)]',+ !noPadding && '-mx-4 -mt-4',+ className+ )}+ back={+ forceBackTo || breadcrumbs.length > 2 ? (+ <SceneBreadcrumbBackButton forceBackTo={forceBackTo} />+ ) : undefined+ }+ icon={name !== null ? sceneResourceIcon(resourceType) : undefined}+ title={+ name !== null && (+ <QuillSceneName+ name={name}+ isLoading={isLoading}+ onChange={onNameChange}+ canEdit={canEdit}+ forceEdit={forceEdit}+ renameDebounceMs={renameDebounceMs}+ saveOnBlur={saveOnBlur}+ onGenerateMetadata={onGenerateMetadata}+ isGeneratingMetadata={isGeneratingMetadata}+ suffix={+ <>+ {releaseStageProduct && <ReleaseStageTag product={releaseStageProduct} />}+ {nameSuffix}+ {hasDescription && !descriptionAlwaysVisible && (+ <Button+ variant="default"+ size="icon-sm"+ aria-label={showDescription ? 'Hide description' : 'Show description'}+ onClick={toggleShowDescription}+ data-attr={+ showDescription+ ? 'toggle-description-button-collapse'+ : 'toggle-description-button-expand'+ }+ >+ {showDescription || forceEdit ? <IconCollapse /> : <IconExpand />}+ </Button>+ )}+ </>+ }+ />+ )+ }+ actions={+ <>+ {!hideProductSetupButton && <ProductSetupButton />}+ {actions}+ <SceneTitlePanelButton maxToolProps={maxToolProps} maxButtonLabel={maxButtonLabel} />+ </>+ }+ />+ {descriptionShown && (+ <div className={cn('[&_svg]:size-6', noPadding && cn('pl-4 pr-2', className))}>+ <SceneDescription+ description={description}+ markdown={markdown}+ isLoading={isLoading}+ onChange={onDescriptionChange}+ canEdit={canEdit}+ forceEdit={forceEdit}+ renameDebounceMs={renameDebounceMs}+ saveOnBlur={saveOnBlur}+ maxLength={descriptionMaxLength}+ isGeneratingMetadata={isGeneratingMetadata}+ />+ </div>+ )}+ </>+ )+}diff --git a/frontend/src/layout/scenes/components/SceneDescription.tsx b/frontend/src/layout/scenes/components/SceneDescription.tsxnew file mode 100644index 000000000000..6d12aff9e136--- /dev/null+++ b/frontend/src/layout/scenes/components/SceneDescription.tsx@@ -0,0 +1,197 @@+import { useEffect, useRef, useState } from 'react'+import { useDebouncedCallback } from 'use-debounce'++import { IconPencil } from '@posthog/icons'+import { Tooltip } from '@posthog/lemon-ui'++import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'+import { ButtonPrimitive, buttonPrimitiveVariants } from 'lib/ui/Button/ButtonPrimitives'+import { TextareaPrimitive } from 'lib/ui/TextareaPrimitive/TextareaPrimitive'+import { WrappingLoadingSkeleton } from 'lib/ui/WrappingLoadingSkeleton/WrappingLoadingSkeleton'+import { cn } from 'lib/utils/css-classes'++type SceneDescriptionProps = {+ description?: string | null+ markdown?: boolean+ isLoading?: boolean+ onChange?: (value: string) => void+ canEdit?: boolean+ forceEdit?: boolean+ renameDebounceMs?: number+ saveOnBlur?: boolean+ maxLength?: number+ /** When true, description field is read-only (title AI control may be generating body copy too). */+ isGeneratingMetadata?: boolean+}++export function SceneDescription({+ description: initialDescription,+ markdown = false,+ isLoading = false,+ onChange,+ canEdit = false,+ forceEdit = false,+ renameDebounceMs = 100,+ saveOnBlur = false,+ maxLength,+ isGeneratingMetadata = false,+}: SceneDescriptionProps): JSX.Element | null {+ const [description, setDescription] = useState(initialDescription)+ const [prevInitialDescription, setPrevInitialDescription] = useState(initialDescription)+ // See SceneName: keep external updates from clobbering an in-flight local edit.+ const latestDescriptionRef = useRef(initialDescription)+ if (initialDescription !== prevInitialDescription) {+ setPrevInitialDescription(initialDescription)+ if (initialDescription !== latestDescriptionRef.current) {+ setDescription(initialDescription)+ latestDescriptionRef.current = initialDescription+ }+ }++ const [isEditing, setIsEditing] = useState(forceEdit)++ const textClasses = 'text-sm my-0 select-auto'++ const emptyText = canEdit ? 'Enter description (optional)' : 'No description'++ useEffect(() => {+ if (!isLoading && forceEdit) {+ setIsEditing(true)+ } else {+ setIsEditing(false)+ }+ }, [isLoading, forceEdit])++ const debouncedOnBlurSaveDescription = useDebouncedCallback((value: string) => {+ onChange?.(value)+ }, renameDebounceMs)++ const debouncedOnDescriptionChange = useDebouncedCallback((value: string) => {+ onChange?.(value)+ }, renameDebounceMs)++ useEffect(() => {+ return () => {+ debouncedOnBlurSaveDescription.flush()+ debouncedOnDescriptionChange.flush()+ }+ }, [debouncedOnBlurSaveDescription, debouncedOnDescriptionChange])++ const handleBlur = (): void => {+ if (saveOnBlur && !isGeneratingMetadata && description !== initialDescription) {+ debouncedOnBlurSaveDescription(description || '')+ } else if (!saveOnBlur) {+ debouncedOnDescriptionChange.flush()+ }+ if (!forceEdit) {+ setIsEditing(false)+ }+ }++ const Element =+ onChange && canEdit ? (+ <>+ {isEditing ? (+ <TextareaPrimitive+ variant="default"+ name="description"+ value={description || ''}+ maxLength={maxLength}+ readOnly={isGeneratingMetadata}+ onChange={(e) => {+ latestDescriptionRef.current = e.target.value+ setDescription(e.target.value)+ if (forceEdit && !saveOnBlur) {+ onChange?.(e.target.value)+ } else if (!saveOnBlur) {+ debouncedOnDescriptionChange(e.target.value)+ }+ }}+ data-attr="scene-description-textarea"+ className={cn(+ buttonPrimitiveVariants({+ inert: true,+ className: `${textClasses} w-full hover:bg-fill-input px-[var(--button-padding-x-sm)]`,+ autoHeight: true,+ }),+ '[&_.LemonIcon]:size-4 input-like',+ isGeneratingMetadata && 'cursor-not-allowed opacity-80'+ )}+ wrapperClassName="w-full"+ markdown={markdown}+ placeholder={emptyText}+ onBlur={handleBlur}+ autoFocus={!forceEdit}+ />+ ) : (+ <Tooltip+ title={+ isGeneratingMetadata+ ? 'Finish generating before editing'+ : canEdit && !forceEdit+ ? 'Edit description'+ : undefined+ }+ placement="bottom"+ arrowOffset={10}+ >+ <ButtonPrimitive+ onClick={() => {+ if (!isGeneratingMetadata) {+ setIsEditing(true)+ }+ }}+ disabled={isGeneratingMetadata}+ className="flex text-start px-[var(--button-padding-x-sm)] py-[var(--button-padding-y-base)] [&_.LemonIcon]:size-4 focus-visible:z-20"+ autoHeight+ size="base"+ >+ <LemonMarkdown lowKeyHeadings>+ {description || (canEdit ? 'Enter description (optional)' : 'No description')}+ </LemonMarkdown>+ {canEdit && !forceEdit && <IconPencil />}+ </ButtonPrimitive>+ </Tooltip>+ )}+ </>+ ) : (+ <>+ {markdown && description !== null && description !== undefined ? (+ <LemonMarkdown+ lowKeyHeadings+ className={buttonPrimitiveVariants({+ inert: true,+ className: `${textClasses} block px-[var(--button-padding-x-sm)]`,+ autoHeight: true,+ })}+ >+ {description}+ </LemonMarkdown>+ ) : (+ <p+ className={buttonPrimitiveVariants({+ inert: true,+ className: `${textClasses} px-[var(--button-padding-x-sm)]`,+ autoHeight: true,+ })}+ >+ {description !== null ? description : <span className="text-tertiary">{emptyText}</span>}+ </p>+ )}+ </>+ )++ if (isLoading) {+ return (+ <div className="w-full">+ <WrappingLoadingSkeleton fullWidth>{Element}</WrappingLoadingSkeleton>+ </div>+ )+ }++ return (+ <div className="scene-description relative focus-within:z-20">+ <div className="-mx-[var(--button-padding-x-sm)] flex items-center gap-0">{Element}</div>+ </div>+ )+}diff --git a/frontend/src/layout/scenes/components/SceneTitlePanelButton.test.tsx b/frontend/src/layout/scenes/components/SceneTitlePanelButton.test.tsxindex 1a429f20bfe3..e479d7d17eb4 100644--- a/frontend/src/layout/scenes/components/SceneTitlePanelButton.test.tsx+++ b/frontend/src/layout/scenes/components/SceneTitlePanelButton.test.tsx@@ -5,7 +5,7 @@ import posthog from 'posthog-js'import { initKeaTests } from '~/test/init'-import { SceneTitlePanelButton } from './SceneTitleSection'+import { SceneTitlePanelButton } from './SceneTitlePanelButton'describe('SceneTitlePanelButton', () => {beforeEach(() => {diff --git a/frontend/src/layout/scenes/components/SceneTitlePanelButton.tsx b/frontend/src/layout/scenes/components/SceneTitlePanelButton.tsxnew file mode 100644index 000000000000..93004b6e9331--- /dev/null+++ b/frontend/src/layout/scenes/components/SceneTitlePanelButton.tsx@@ -0,0 +1,127 @@+import { useActions, useValues } from 'kea'+import posthog from 'posthog-js'++import { IconBrackets, IconSidePanel, IconSparkles, IconWrench } from '@posthog/icons'++import { RenderKeybind } from 'lib/components/Shortcuts/ShortcutMenu'+import { keyBinds } from 'lib/components/Shortcuts/shortcuts'+import { FEATURE_FLAGS } from 'lib/constants'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'+import { cn } from 'lib/utils/css-classes'+import { UseMaxToolOptions, useMaxTool } from 'scenes/max/useMaxTool'+import { sceneLogic } from 'scenes/sceneLogic'++import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'+import { todayShellLogic } from '~/layout/today/todayShellLogic'+import { SidePanelTab } from '~/types'++import { sceneLayoutLogic } from '../sceneLayoutLogic'++/**+ * The click on the PostHog AI button is the only proof the handler ran. Every route into the+ * panel captures `sidebar opened` afterwards, so a click without that follow-up event marks a+ * click that never reached `openSidePanel`. Scene id is read off `sceneLogic` without+ * subscribing so capture never triggers a re-render.+ */+function captureSceneAiButtonClicked(tool: string | null): void {+ posthog.capture('scene ai button clicked', {+ scene: sceneLogic.findMounted()?.values.activeSceneId ?? null,+ tool,+ })+}++export function SceneTitlePanelButton({+ maxToolProps,+ buttonClassName = 'size-[33px]',+ maxButtonLabel,+}: {+ maxToolProps?: Omit<UseMaxToolOptions, 'active'>+ buttonClassName?: string+ maxButtonLabel?: string+}): JSX.Element | null {+ const { scenePanelIsPresent } = useValues(sceneLayoutLogic)+ const { openSidePanel } = useActions(sidePanelStateLogic)+ const { sidePanelOpen } = useValues(sidePanelStateLogic)++ const inactiveMaxToolProps: UseMaxToolOptions = { identifier: 'read_data', active: false }+ const { openMax, definition } = useMaxTool(maxToolProps ? { ...maxToolProps, active: true } : inactiveMaxToolProps)++ const { featureFlags } = useValues(featureFlagLogic)+ const sceneMenuBarEnabled = !!featureFlags[FEATURE_FLAGS.SCENE_MENU_BAR]+ const { todayRailEnabled } = useValues(todayShellLogic)++ // Open Info tab if scene has panel content, otherwise default to PostHog AI+ const defaultTab = scenePanelIsPresent ? SidePanelTab.Info : SidePanelTab.Max++ if (sidePanelOpen) {+ return null+ }++ return (+ <>+ {!sceneMenuBarEnabled && !todayRailEnabled && (+ <ButtonPrimitive+ className={cn(buttonClassName, maxButtonLabel && 'w-auto px-2')}+ onClick={(e) => {+ e.stopPropagation()+ e.preventDefault()+ captureSceneAiButtonClicked(maxToolProps?.identifier ?? null)+ if (openMax) {+ openMax()+ } else {+ openSidePanel(SidePanelTab.Max)+ }+ }}+ tooltip={+ definition ? (+ <>+ Open PostHog AI+ <br />+ <div className="flex items-center">+ {definition.icon || <IconWrench />}+ <i className="ml-1.5">{definition.name}</i>+ </div>+ </>+ ) : (+ 'Open PostHog AI'+ )+ }+ tooltipPlacement="bottom-end"+ tooltipCloseDelayMs={0}+ iconOnly={!maxButtonLabel}+ data-attr="open-context-panel-ai-button"+ >+ <div className="relative">+ <IconSparkles className="text-ai group-hover/button-primitive:animate-hue-rotate" />+ {maxToolProps && (+ <IconBrackets className="absolute size-2.5 top-0 -right-1 text-black dark:text-white" />+ )}+ </div>+ {maxButtonLabel}+ </ButtonPrimitive>+ )}+ {/* Size to mimic lemon button small */}+ <ButtonPrimitive+ className={cn(buttonClassName, 'group -mr-[2px]')}+ onClick={(e) => {+ e.stopPropagation()+ e.preventDefault()+ openSidePanel(defaultTab)+ }}+ tooltip={+ <>+ Open context panel+ <RenderKeybind className="relative -top-px ml-1" keybind={[keyBinds.toggleRightNav]} />+ </>+ }+ tooltipPlacement="bottom-end"+ tooltipCloseDelayMs={0}+ iconOnly+ data-attr="open-context-panel-button"+ >+ <IconSidePanel className="text-primary group-hover:text-primary z-10" />+ </ButtonPrimitive>+ </>+ )+}diff --git a/frontend/src/layout/scenes/components/SceneTitleSection.tsx b/frontend/src/layout/scenes/components/SceneTitleSection.tsxindex f4a51b799b06..6cc65e8c04aa 100644--- a/frontend/src/layout/scenes/components/SceneTitleSection.tsx+++ b/frontend/src/layout/scenes/components/SceneTitleSection.tsx@@ -1,156 +1,37 @@import '../../panel-layout/ProjectTree/defaultTree'import { useActions, useValues } from 'kea'-import posthog from 'posthog-js'import { useEffect, useMemo, useRef, useState } from 'react'-import { useDebouncedCallback } from 'use-debounce'-import {- IconBrackets,- IconCollapse,- IconExpand,- IconPencil,- IconSidePanel,- IconSparkles,- IconWrench,-} from '@posthog/icons'+import { IconCollapse, IconExpand, IconPencil } from '@posthog/icons'import { Tooltip } from '@posthog/lemon-ui'import { ProductSetupButton } from 'lib/components/ProductSetup'import { releaseStageProductForScene } from 'lib/components/ReleaseStageTag/releaseStage'import { ReleaseStageTag } from 'lib/components/ReleaseStageTag/ReleaseStageTag'-import { RenderKeybind } from 'lib/components/Shortcuts/ShortcutMenu'-import { keyBinds } from 'lib/components/Shortcuts/shortcuts'-import { FEATURE_FLAGS } from 'lib/constants'-import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { ButtonPrimitive, buttonPrimitiveVariants } from 'lib/ui/Button/ButtonPrimitives'import { TextareaPrimitive } from 'lib/ui/TextareaPrimitive/TextareaPrimitive'import { WrappingLoadingSkeleton } from 'lib/ui/WrappingLoadingSkeleton/WrappingLoadingSkeleton'import { cn } from 'lib/utils/css-classes'import { AnimatedSparkles } from 'scenes/max/components/AnimatedSparkles'-import { UseMaxToolOptions, useMaxTool } from 'scenes/max/useMaxTool'+import { UseMaxToolOptions } from 'scenes/max/useMaxTool'import { sceneLogic } from 'scenes/sceneLogic'import { navigation3000Logic } from '~/layout/navigation-3000/navigationLogic'-import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'import { breadcrumbsLogic } from '~/layout/navigation/Breadcrumbs/breadcrumbsLogic'import { todayShellLogic } from '~/layout/today/todayShellLogic'import { FileSystemIconType } from '~/queries/schema/schema-general'-import { Breadcrumb, FileSystemIconColor, SidePanelTab } from '~/types'+import { Breadcrumb, FileSystemIconColor } from '~/types'-import { ProductIconWrapper, iconForType } from '../../panel-layout/ProjectTree/defaultTree'import { sceneLayoutLogic } from '../sceneLayoutLogic'+import { QuillSceneTitleSection } from './QuillSceneTitleSection'import { SceneBreadcrumbBackButton } from './SceneBreadcrumbs'+import { SceneDescription } from './SceneDescription'+import { sceneResourceIcon } from './sceneResourceIcon'+import { SceneTitlePanelButton } from './SceneTitlePanelButton'+import { useSceneNameEditing } from './useSceneNameEditing'-/**- * The click on the PostHog AI button is the only proof the handler ran. Every route into the- * panel captures `sidebar opened` afterwards, so a click without that follow-up event marks a- * click that never reached `openSidePanel`. Scene id is read off `sceneLogic` without- * subscribing so capture never triggers a re-render.- */-function captureSceneAiButtonClicked(tool: string | null): void {- posthog.capture('scene ai button clicked', {- scene: sceneLogic.findMounted()?.values.activeSceneId ?? null,- tool,- })-}--export function SceneTitlePanelButton({- maxToolProps,- buttonClassName = 'size-[33px]',- maxButtonLabel,-}: {- maxToolProps?: Omit<UseMaxToolOptions, 'active'>- buttonClassName?: string- maxButtonLabel?: string-}): JSX.Element | null {- const { scenePanelIsPresent } = useValues(sceneLayoutLogic)- const { openSidePanel } = useActions(sidePanelStateLogic)- const { sidePanelOpen } = useValues(sidePanelStateLogic)-- const inactiveMaxToolProps: UseMaxToolOptions = { identifier: 'read_data', active: false }- const { openMax, definition } = useMaxTool(maxToolProps ? { ...maxToolProps, active: true } : inactiveMaxToolProps)-- const { featureFlags } = useValues(featureFlagLogic)- const sceneMenuBarEnabled = !!featureFlags[FEATURE_FLAGS.SCENE_MENU_BAR]- const { todayRailEnabled } = useValues(todayShellLogic)-- // Open Info tab if scene has panel content, otherwise default to PostHog AI- const defaultTab = scenePanelIsPresent ? SidePanelTab.Info : SidePanelTab.Max-- if (sidePanelOpen) {- return null- }-- return (- <>- {!sceneMenuBarEnabled && !todayRailEnabled && (- <ButtonPrimitive- className={cn(buttonClassName, maxButtonLabel && 'w-auto px-2')}- onClick={(e) => {- e.stopPropagation()- e.preventDefault()- captureSceneAiButtonClicked(maxToolProps?.identifier ?? null)- if (openMax) {- openMax()- } else {- openSidePanel(SidePanelTab.Max)- }- }}- tooltip={- definition ? (- <>- Open PostHog AI- <br />- <div className="flex items-center">- {definition.icon || <IconWrench />}- <i className="ml-1.5">{definition.name}</i>- </div>- </>- ) : (- 'Open PostHog AI'- )- }- tooltipPlacement="bottom-end"- tooltipCloseDelayMs={0}- iconOnly={!maxButtonLabel}- data-attr="open-context-panel-ai-button"- >- <div className="relative">- <IconSparkles className="text-ai group-hover/button-primitive:animate-hue-rotate" />- {maxToolProps && (- <IconBrackets className="absolute size-2.5 top-0 -right-1 text-black dark:text-white" />- )}- </div>- {maxButtonLabel}- </ButtonPrimitive>- )}- {/* Size to mimic lemon button small */}- <ButtonPrimitive- className={cn(buttonClassName, 'group -mr-[2px]')}- onClick={(e) => {- e.stopPropagation()- e.preventDefault()- openSidePanel(defaultTab)- }}- tooltip={- <>- Open context panel- <RenderKeybind className="relative -top-px ml-1" keybind={[keyBinds.toggleRightNav]} />- </>- }- tooltipPlacement="bottom-end"- tooltipCloseDelayMs={0}- iconOnly- data-attr="open-context-panel-button"- >- <IconSidePanel className="text-primary group-hover:text-primary z-10" />- </ButtonPrimitive>- </>- )-}-type ResourceType = {+export type ResourceType = {to?: string/** pass in a value from the FileSystemIconType enum, or a string if not available */type: FileSystemIconType | string@@ -160,7 +41,7 @@ type ResourceType = {forceIconColorOverride?: FileSystemIconColor}-type SceneMainTitleProps = {+export type SceneMainTitleProps = {/*** null to hide the name,* undefined to show the default name@@ -252,7 +133,16 @@ type SceneMainTitleProps = {sceneId?: string | null}-export function SceneTitleSection({+export function SceneTitleSection(props: SceneMainTitleProps): JSX.Element | null {+ const { zenMode } = useValues(navigation3000Logic)+ const { todayRailEnabled } = useValues(todayShellLogic)+ if (zenMode) {+ return null+ }+ return todayRailEnabled ? <QuillSceneTitleSection {...props} /> : <LemonSceneTitleSection {...props} />+}++function LemonSceneTitleSection({name,nameSuffix,description,@@ -280,7 +170,6 @@ export function SceneTitleSection({sceneId,}: SceneMainTitleProps): JSX.Element | null {const { breadcrumbs } = useValues(breadcrumbsLogic)- const { zenMode } = useValues(navigation3000Logic)const { activeSceneId } = useValues(sceneLogic)const releaseStageSceneId = sceneId ?? activeSceneIdconst releaseStageProduct = useMemo(@@ -320,18 +209,25 @@ export function SceneTitleSection({return () => observer.disconnect()}, [noBorder])- const icon = resourceType.forceIcon ? (- <ProductIconWrapper type={resourceType.type} colorOverride={resourceType.forceIconColorOverride}>- {resourceType.forceIcon}- </ProductIconWrapper>- ) : (- iconForType(resourceType.type ? (resourceType.type as FileSystemIconType) : undefined)+ const icon = sceneResourceIcon(resourceType)++ const descriptionBlock = hasDescription && (descriptionAlwaysVisible || showDescription || forceEdit) && (+ <div className={cn('[&_svg]:size-6', noPadding ? cn('pl-4 pr-2', className) : '-mt-4')}>+ <SceneDescription+ description={effectiveDescription}+ markdown={markdown}+ isLoading={isLoading}+ onChange={onDescriptionChange}+ canEdit={canEdit}+ forceEdit={forceEdit}+ renameDebounceMs={renameDebounceMs}+ saveOnBlur={saveOnBlur}+ maxLength={descriptionMaxLength}+ isGeneratingMetadata={isGeneratingMetadata}+ />+ </div>)- if (zenMode) {- return null- }-return (<>{!noBorder && (@@ -440,22 +336,7 @@ export function SceneTitleSection({</div>{/* Border is handled by the outer container's border-b */}</div>- {hasDescription && (descriptionAlwaysVisible || showDescription || forceEdit) && (- <div className={cn('[&_svg]:size-6', noPadding ? cn('pl-4 pr-2', className) : '-mt-4')}>- <SceneDescription- description={effectiveDescription}- markdown={markdown}- isLoading={isLoading}- onChange={onDescriptionChange}- canEdit={canEdit}- forceEdit={forceEdit}- renameDebounceMs={renameDebounceMs}- saveOnBlur={saveOnBlur}- maxLength={descriptionMaxLength}- isGeneratingMetadata={isGeneratingMetadata}- />- </div>- )}+ {descriptionBlock}</>)}@@ -485,73 +366,19 @@ export function SceneName({isGeneratingMetadata = false,suffix,}: SceneNameProps): JSX.Element {- const [name, setName] = useState(initialName)- const [prevInitialName, setPrevInitialName] = useState(initialName)- // Mirror of the value currently held in the local field. Lets us tell a genuine- // external update (loading a resource, an AI-generated name) apart from an echo of- // the user's own edit arriving back through the form, so the render-phase- // reconciliation below can't overwrite a keystroke that hasn't round-tripped yet.- const latestNameRef = useRef(initialName)- // What the last Enter press saved, held only until the next blur. `initialName` catches up- // when the save round-trips, so the blur straight after Enter still sees a changed field and- // would save the same value a second time.- const savedByEnterRef = useRef<string | null>(null)- if (initialName !== prevInitialName) {- setPrevInitialName(initialName)- if (initialName !== latestNameRef.current) {- setName(initialName)- latestNameRef.current = initialName- }- }-- const [isEditing, setIsEditing] = useState(forceEdit)- const containerRef = useRef<HTMLDivElement>(null)+ const { name, isEditing, containerRef, startEditing, change, blur, saveFromEnter } = useSceneNameEditing({+ name: initialName,+ isLoading,+ onChange,+ forceEdit,+ renameDebounceMs,+ saveOnBlur,+ isGeneratingMetadata,+ })const textClasses ='text-lg font-semibold my-0 pl-[var(--button-padding-x-sm)] min-h-[var(--button-height-sm)] leading-[1.4] select-auto'- useEffect(() => {- if (!isLoading && forceEdit) {- setIsEditing(true)- } else {- setIsEditing(false)- }- }, [isLoading, forceEdit])-- const debouncedOnBlurSave = useDebouncedCallback((value: string) => {- onChange?.(value)- }, renameDebounceMs)-- const debouncedOnChange = useDebouncedCallback((value: string) => {- onChange?.(value)- }, renameDebounceMs)-- useEffect(() => {- return () => {- debouncedOnBlurSave.flush()- debouncedOnChange.flush()- }- }, [debouncedOnBlurSave, debouncedOnChange])-- const handleBlur = (e: React.FocusEvent): void => {- const relatedTarget = e.relatedTarget as HTMLElement | null- if (relatedTarget && containerRef.current && containerRef.current.contains(relatedTarget)) {- return- }- const savedByEnter = savedByEnterRef.current- savedByEnterRef.current = null- if (saveOnBlur && !isGeneratingMetadata && name !== initialName && name !== savedByEnter) {- debouncedOnBlurSave(name || '')- } else if (!saveOnBlur) {- // Commit any pending debounced change synchronously so a submit or- // validation that immediately follows blur reads the value the user sees.- debouncedOnChange.flush()- }- if (!forceEdit) {- setIsEditing(false)- }- }-// If onBlur is provided, we want to show a button that allows the user to edit the name// Otherwise, we want to show the name as a textconst Element =@@ -564,15 +391,7 @@ export function SceneName({name="name"value={name || ''}readOnly={isGeneratingMetadata}- onChange={(e) => {- latestNameRef.current = e.target.value- setName(e.target.value)- if (forceEdit && !saveOnBlur) {- onChange?.(e.target.value)- } else if (!saveOnBlur) {- debouncedOnChange(e.target.value)- }- }}+ onChange={(e) => change(e.target.value)}data-attr="scene-title-textarea"className={cn(buttonPrimitiveVariants({@@ -585,15 +404,12 @@ export function SceneName({)}wrapperClassName="flex-1 min-w-0"placeholder="Enter name"- onBlur={handleBlur}+ onBlur={blur}autoFocus={!forceEdit}onKeyDown={(e) => {if (e.key === 'Enter') {e.preventDefault()- if (saveOnBlur && e.currentTarget.value !== initialName) {- savedByEnterRef.current = e.currentTarget.value || ''- onChange?.(e.currentTarget.value || '')- }+ saveFromEnter(e.currentTarget.value)}}}/>@@ -634,11 +450,7 @@ export function SceneName({buttonPrimitiveVariants({ size: 'fit', className: textClasses }),'flex text-left [&_.LemonIcon]:size-4 focus-visible:z-20')}- onClick={() => {- if (!isGeneratingMetadata) {- setIsEditing(true)- }- }}+ onClick={startEditing}disabled={isGeneratingMetadata}truncate>@@ -679,189 +491,3 @@ export function SceneName({</div>)}--type SceneDescriptionProps = {- description?: string | null- markdown?: boolean- isLoading?: boolean- onChange?: (value: string) => void- canEdit?: boolean- forceEdit?: boolean- renameDebounceMs?: number- saveOnBlur?: boolean- maxLength?: number- /** When true, description field is read-only (title AI control may be generating body copy too). */- isGeneratingMetadata?: boolean-}--function SceneDescription({- description: initialDescription,- markdown = false,- isLoading = false,- onChange,- canEdit = false,- forceEdit = false,- renameDebounceMs = 100,- saveOnBlur = false,- maxLength,- isGeneratingMetadata = false,-}: SceneDescriptionProps): JSX.Element | null {- const [description, setDescription] = useState(initialDescription)- const [prevInitialDescription, setPrevInitialDescription] = useState(initialDescription)- // See SceneName: keep external updates from clobbering an in-flight local edit.- const latestDescriptionRef = useRef(initialDescription)- if (initialDescription !== prevInitialDescription) {- setPrevInitialDescription(initialDescription)- if (initialDescription !== latestDescriptionRef.current) {- setDescription(initialDescription)- latestDescriptionRef.current = initialDescription- }- }-- const [isEditing, setIsEditing] = useState(forceEdit)-- const textClasses = 'text-sm my-0 select-auto'-- const emptyText = canEdit ? 'Enter description (optional)' : 'No description'-- useEffect(() => {- if (!isLoading && forceEdit) {- setIsEditing(true)- } else {- setIsEditing(false)- }- }, [isLoading, forceEdit])-- const debouncedOnBlurSaveDescription = useDebouncedCallback((value: string) => {- onChange?.(value)- }, renameDebounceMs)-- const debouncedOnDescriptionChange = useDebouncedCallback((value: string) => {- onChange?.(value)- }, renameDebounceMs)-- useEffect(() => {- return () => {- debouncedOnBlurSaveDescription.flush()- debouncedOnDescriptionChange.flush()- }- }, [debouncedOnBlurSaveDescription, debouncedOnDescriptionChange])-- const handleBlur = (): void => {- if (saveOnBlur && !isGeneratingMetadata && description !== initialDescription) {- debouncedOnBlurSaveDescription(description || '')- } else if (!saveOnBlur) {- debouncedOnDescriptionChange.flush()- }- if (!forceEdit) {- setIsEditing(false)- }- }-- const Element =- onChange && canEdit ? (- <>- {isEditing ? (- <TextareaPrimitive- variant="default"- name="description"- value={description || ''}- maxLength={maxLength}- readOnly={isGeneratingMetadata}- onChange={(e) => {- latestDescriptionRef.current = e.target.value- setDescription(e.target.value)- if (forceEdit && !saveOnBlur) {- onChange?.(e.target.value)- } else if (!saveOnBlur) {- debouncedOnDescriptionChange(e.target.value)- }- }}- data-attr="scene-description-textarea"- className={cn(- buttonPrimitiveVariants({- inert: true,- className: `${textClasses} w-full hover:bg-fill-input px-[var(--button-padding-x-sm)]`,- autoHeight: true,- }),- '[&_.LemonIcon]:size-4 input-like',- isGeneratingMetadata && 'cursor-not-allowed opacity-80'- )}- wrapperClassName="w-full"- markdown={markdown}- placeholder={emptyText}- onBlur={handleBlur}- autoFocus={!forceEdit}- />- ) : (- <Tooltip- title={- isGeneratingMetadata- ? 'Finish generating before editing'- : canEdit && !forceEdit- ? 'Edit description'- : undefined- }- placement="bottom"- arrowOffset={10}- >- <ButtonPrimitive- onClick={() => {- if (!isGeneratingMetadata) {- setIsEditing(true)- }- }}- disabled={isGeneratingMetadata}- className="flex text-start px-[var(--button-padding-x-sm)] py-[var(--button-padding-y-base)] [&_.LemonIcon]:size-4 focus-visible:z-20"- autoHeight- size="base"- >- <LemonMarkdown lowKeyHeadings>- {description || (canEdit ? 'Enter description (optional)' : 'No description')}- </LemonMarkdown>- {canEdit && !forceEdit && <IconPencil />}- </ButtonPrimitive>- </Tooltip>- )}- </>- ) : (- <>- {markdown && description !== null && description !== undefined ? (- <LemonMarkdown- lowKeyHeadings- className={buttonPrimitiveVariants({- inert: true,- className: `${textClasses} block px-[var(--button-padding-x-sm)]`,- autoHeight: true,- })}- >- {description}- </LemonMarkdown>- ) : (- <p- className={buttonPrimitiveVariants({- inert: true,- className: `${textClasses} px-[var(--button-padding-x-sm)]`,- autoHeight: true,- })}- >- {description !== null ? description : <span className="text-tertiary">{emptyText}</span>}- </p>- )}- </>- )-- if (isLoading) {- return (- <div className="w-full">- <WrappingLoadingSkeleton fullWidth>{Element}</WrappingLoadingSkeleton>- </div>- )- }-- return (- <div className="scene-description relative focus-within:z-20">- <div className="-mx-[var(--button-padding-x-sm)] flex items-center gap-0">{Element}</div>- </div>- )-}diff --git a/frontend/src/layout/scenes/components/sceneResourceIcon.tsx b/frontend/src/layout/scenes/components/sceneResourceIcon.tsxnew file mode 100644index 000000000000..079d47ea179a--- /dev/null+++ b/frontend/src/layout/scenes/components/sceneResourceIcon.tsx@@ -0,0 +1,14 @@+import { FileSystemIconType } from '~/queries/schema/schema-general'++import { ProductIconWrapper, iconForType } from '../../panel-layout/ProjectTree/defaultTree'+import type { ResourceType } from './SceneTitleSection'++export function sceneResourceIcon(resourceType: ResourceType): JSX.Element {+ return resourceType.forceIcon ? (+ <ProductIconWrapper type={resourceType.type} colorOverride={resourceType.forceIconColorOverride}>+ {resourceType.forceIcon}+ </ProductIconWrapper>+ ) : (+ iconForType(resourceType.type ? (resourceType.type as FileSystemIconType) : undefined)+ )+}diff --git a/frontend/src/layout/scenes/components/useSceneNameEditing.ts b/frontend/src/layout/scenes/components/useSceneNameEditing.tsnew file mode 100644index 000000000000..52f780da2547--- /dev/null+++ b/frontend/src/layout/scenes/components/useSceneNameEditing.ts@@ -0,0 +1,143 @@+import { useEffect, useRef, useState } from 'react'+import { useDebouncedCallback } from 'use-debounce'++export interface SceneNameEditingOptions {+ name?: string+ isLoading?: boolean+ onChange?: (value: string) => void+ forceEdit?: boolean+ renameDebounceMs?: number+ saveOnBlur?: boolean+ isGeneratingMetadata?: boolean+}++export interface SceneNameEditing {+ name: string | undefined+ isEditing: boolean+ /** Wraps the field and its controls, so moving focus between them does not end the edit. */+ containerRef: React.RefObject<HTMLDivElement>+ startEditing: () => void+ change: (value: string) => void+ blur: (event: React.FocusEvent) => void+ saveFromEnter: (value: string) => void+ /**+ * Leaves the field. With `saveOnBlur` it also drops the unsaved value. Without it every keystroke has already+ * been saved, so there is nothing local to drop.+ */+ cancel: () => void+}++export function useSceneNameEditing({+ name: initialName,+ isLoading = false,+ onChange,+ forceEdit = false,+ renameDebounceMs = 100,+ saveOnBlur = false,+ isGeneratingMetadata = false,+}: SceneNameEditingOptions): SceneNameEditing {+ const [name, setName] = useState(initialName)+ const [prevInitialName, setPrevInitialName] = useState(initialName)+ // Mirror of the value currently held in the local field. Lets us tell a genuine+ // external update (loading a resource, an AI-generated name) apart from an echo of+ // the user's own edit arriving back through the form, so the render-phase+ // reconciliation below can't overwrite a keystroke that hasn't round-tripped yet.+ const latestNameRef = useRef(initialName)+ // What the last Enter press saved, held only until the next blur. `initialName` catches up+ // when the save round-trips, so the blur straight after Enter still sees a changed field and+ // would save the same value a second time.+ const savedByEnterRef = useRef<string | null>(null)+ // Set by Escape, so the blur that follows does not save the value the user just dropped.+ const cancelledRef = useRef(false)+ if (initialName !== prevInitialName) {+ setPrevInitialName(initialName)+ if (initialName !== latestNameRef.current) {+ setName(initialName)+ latestNameRef.current = initialName+ }+ }++ const [isEditing, setIsEditing] = useState(forceEdit)+ const containerRef = useRef<HTMLDivElement>(null)++ useEffect(() => {+ if (!isLoading && forceEdit) {+ setIsEditing(true)+ } else {+ setIsEditing(false)+ }+ }, [isLoading, forceEdit])++ const debouncedOnBlurSave = useDebouncedCallback((value: string) => {+ onChange?.(value)+ }, renameDebounceMs)++ const debouncedOnChange = useDebouncedCallback((value: string) => {+ onChange?.(value)+ }, renameDebounceMs)++ useEffect(() => {+ return () => {+ debouncedOnBlurSave.flush()+ debouncedOnChange.flush()+ }+ }, [debouncedOnBlurSave, debouncedOnChange])++ const startEditing = (): void => {+ if (!isGeneratingMetadata) {+ cancelledRef.current = false+ setIsEditing(true)+ }+ }++ const change = (value: string): void => {+ latestNameRef.current = value+ setName(value)+ if (forceEdit && !saveOnBlur) {+ onChange?.(value)+ } else if (!saveOnBlur) {+ debouncedOnChange(value)+ }+ }++ const blur = (event: React.FocusEvent): void => {+ const relatedTarget = event.relatedTarget as HTMLElement | null+ if (relatedTarget && containerRef.current && containerRef.current.contains(relatedTarget)) {+ return+ }+ const savedByEnter = savedByEnterRef.current+ savedByEnterRef.current = null+ if (cancelledRef.current) {+ cancelledRef.current = false+ } else if (saveOnBlur && !isGeneratingMetadata && name !== initialName && name !== savedByEnter) {+ debouncedOnBlurSave(name || '')+ } else if (!saveOnBlur) {+ // Commit any pending debounced change synchronously so a submit or+ // validation that immediately follows blur reads the value the user sees.+ debouncedOnChange.flush()+ }+ if (!forceEdit) {+ setIsEditing(false)+ }+ }++ const saveFromEnter = (value: string): void => {+ if (saveOnBlur && value !== initialName) {+ savedByEnterRef.current = value || ''+ onChange?.(value || '')+ }+ }++ const cancel = (): void => {+ if (saveOnBlur) {+ cancelledRef.current = true+ latestNameRef.current = initialName+ setName(initialName)+ }+ if (!forceEdit) {+ setIsEditing(false)+ }+ }++ return { name, isEditing, containerRef, startEditing, change, blur, saveFromEnter, cancel }+}diff --git a/frontend/src/layout/today/TodayChatRow.tsx b/frontend/src/layout/today/TodayChatRow.tsxindex 84b2f262f9ab..94780c5d2643 100644--- a/frontend/src/layout/today/TodayChatRow.tsx+++ b/frontend/src/layout/today/TodayChatRow.tsx@@ -2,7 +2,6 @@ import { useValues } from 'kea'import { router } from 'kea-router'import { useMemo } from 'react'-import { IconChat } from '@posthog/icons'import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from '@posthog/quill'import { urls } from 'scenes/urls'@@ -12,15 +11,17 @@ import { CONTEXT_PARTS } from './todayMenuParts'import { useTodayPreviewMenuReport } from './todayPreviewCardContext'import { chatPreview } from './todayPreviewCards'import { TodayPreviewTrigger } from './TodayPreviewTrigger'+import { TodaySessionIcon } from './TodaySessionIcon'import { TodaySpacesRow } from './TodaySpacesRow'import { TodayWorkItem } from './todayWorkItems'interface TodayChatRowProps {item: TodayWorkItemdataAttr: string+ optionValue: string}-export function TodayChatRow({ item, dataAttr }: TodayChatRowProps): JSX.Element {+export function TodayChatRow({ item, dataAttr, optionValue }: TodayChatRowProps): JSX.Element {const { location, searchParams } = useValues(router)const reportMenuOpen = useTodayPreviewMenuReport()const preview = useMemo(() => chatPreview(item), [item])@@ -31,11 +32,12 @@ export function TodayChatRow({ item, dataAttr }: TodayChatRowProps): JSX.Element<TodayPreviewTrigger payload={preview}><TodaySpacesRowlabel={preview.title}- icon={<IconChat className="text-muted-foreground" />}+ icon={<TodaySessionIcon item={item} />}to={urls.ai(item.id)}active={location.pathname.endsWith('/ai') && searchParams.chat === item.id}dataAttr={dataAttr}weight="regular"+ optionValue={optionValue}/></TodayPreviewTrigger></ContextMenuTrigger>diff --git a/frontend/src/layout/today/TodayFilterMenuTrigger.tsx b/frontend/src/layout/today/TodayFilterMenuTrigger.tsxindex d44a404a7486..9397843a209e 100644--- a/frontend/src/layout/today/TodayFilterMenuTrigger.tsx+++ b/frontend/src/layout/today/TodayFilterMenuTrigger.tsx@@ -12,7 +12,7 @@ export function TodayFilterMenuTrigger({ active, dataAttr }: { active: boolean;<DropdownMenuTriggerrender={<Button- size="icon-xs"+ size="icon"aria-label={label}className={cn('relative text-muted-foreground',diff --git a/frontend/src/layout/today/TodayLibrarySidebar.tsx b/frontend/src/layout/today/TodayLibrarySidebar.tsxindex 4becd0295c8e..22bb57743f70 100644--- a/frontend/src/layout/today/TodayLibrarySidebar.tsx+++ b/frontend/src/layout/today/TodayLibrarySidebar.tsx@@ -1,7 +1,9 @@import { useValues } from 'kea'import { router } from 'kea-router'+import { useState } from 'react'import { IconFolder } from '@posthog/icons'+import { Text } from '@posthog/quill'import { removeProjectIdIfPresent } from 'lib/utils/kea-router'import { LibraryCreateButton } from 'scenes/library/LibraryCreateButton'@@ -13,37 +15,60 @@ import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'import { FileSystemIconType } from '~/queries/schema/schema-general'import { TodayPaneRow } from './TodayPaneRow'+import { matchesPaneQuery } from './todayPaneSearch'+import { TodayPaneSearchList } from './TodayPaneSearchList'/** The Library sub-nav: every saved object type, each opening a filtered list in the main area. */export function TodayLibrarySidebar(): JSX.Element {const { objectTypes } = useValues(libraryLogic)const { location } = useValues(router)+ const [query, setQuery] = useState('')const path = removeProjectIdIfPresent(location.pathname)const objectPageType = libraryTypeForPath(path)+ const showAll = matchesPaneQuery('All objects', query)+ const types = objectTypes.filter((type) => matchesPaneQuery(type.pluralLabel, query))+return (- <div className="TodayPane">- <div className="TodayPane__scroll">- <div className="TodayPane__heading Today__label">Library</div>- <TodayPaneRow- label="All objects"- icon={<IconFolder />}- to={urls.library()}- active={path === urls.library()}- dataAttr="today-library-all"- />- {objectTypes.map((type) => (- <TodayPaneRow- key={type.value}- label={type.pluralLabel}- icon={iconForType(type.value as FileSystemIconType)}- to={urls.library(type.value)}- active={path === urls.library(type.value) || objectPageType === type.value}- action={<LibraryCreateButton objectType={type.value} />}- dataAttr="today-library-type"- />- ))}- </div>+ <div className="TodayPane" data-quill>+ <TodayPaneSearchList+ query={query}+ onQueryChange={setQuery}+ searchLabel="Search library"+ dataAttr="today-library-search"+ >+ {!showAll && !types.length && (+ <Text size="xs" variant="muted" className="block px-2 py-1">+ Nothing in Library matches that search.+ </Text>+ )}+ {(showAll || types.length > 0) && (+ <div>+ {showAll && (+ <TodayPaneRow+ value="all"+ label="All objects"+ icon={<IconFolder />}+ to={urls.library()}+ active={path === urls.library()}+ dataAttr="today-library-all"+ />+ )}+ {types.map((type) => (+ <TodayPaneRow+ key={type.value}+ value={`type:${type.value}`}+ label={type.pluralLabel}+ icon={iconForType(type.value as FileSystemIconType)}+ to={urls.library(type.value)}+ active={path === urls.library(type.value) || objectPageType === type.value}+ action={<LibraryCreateButton objectType={type.value} />}+ dataAttr="today-library-type"+ />+ ))}+ </div>+ )}+ </TodayPaneSearchList></div>)}diff --git a/frontend/src/layout/today/TodayListAppearanceDialog.tsx b/frontend/src/layout/today/TodayListAppearanceDialog.tsxindex 67b3ed6fe900..21700d569ccd 100644--- a/frontend/src/layout/today/TodayListAppearanceDialog.tsx+++ b/frontend/src/layout/today/TodayListAppearanceDialog.tsx@@ -1,6 +1,8 @@import { useActions, useValues } from 'kea'import {+ Autocomplete,+ AutocompleteList,Button,Dialog,DialogBody,@@ -78,24 +80,33 @@ export function TodayListAppearanceDialog(): JSX.Element {className="pointer-events-none h-36 rounded-md border border-border bg-chrome p-1"{...{ inert: '' }}>- {PREVIEW_ROWS.map(({ title, hoursAgo, ...values }) => (- <TodaySpacesRow- key={title}- label={title}- icon={<TodaySessionStatusDot dot={SETTLED_DOT} />}- to={urls.ai()}- active={false}- dataAttr="today-list-appearance-preview-row"- weight="regular"- details={listItemDetails(- {- ...values,- activity: activityDetail(now.subtract(hoursAgo, 'hour').toISOString(), now),- },- draftFields- )}- />- ))}+ {/* Sidebar rows are autocomplete options, so the preview hosts them in an inline list. */}+ <Autocomplete inline open>+ <AutocompleteList className="!max-h-none !p-0">+ {PREVIEW_ROWS.map(({ title, hoursAgo, ...values }) => (+ <TodaySpacesRow+ key={title}+ optionValue={title}+ label={title}+ icon={<TodaySessionStatusDot dot={SETTLED_DOT} />}+ to={urls.ai()}+ active={false}+ dataAttr="today-list-appearance-preview-row"+ weight="regular"+ details={listItemDetails(+ {+ ...values,+ activity: activityDetail(+ now.subtract(hoursAgo, 'hour').toISOString(),+ now+ ),+ },+ draftFields+ )}+ />+ ))}+ </AutocompleteList>+ </Autocomplete></div></section><section aria-labelledby="today-list-appearance-second-row" className="flex flex-col gap-2">diff --git a/frontend/src/layout/today/TodayPaneGroupLabel.tsx b/frontend/src/layout/today/TodayPaneGroupLabel.tsxnew file mode 100644index 000000000000..0725194b7210--- /dev/null+++ b/frontend/src/layout/today/TodayPaneGroupLabel.tsx@@ -0,0 +1,11 @@+import type { ReactNode } from 'react'++import { Text, cn } from '@posthog/quill'++export function TodayPaneGroupLabel({ children, first }: { children: ReactNode; first: boolean }): JSX.Element {+ return (+ <Text size="xs" weight="medium" variant="muted" className={cn('block px-2 pb-1', first ? 'pt-1' : 'pt-3')}>+ {children}+ </Text>+ )+}diff --git a/frontend/src/layout/today/TodayPaneOption.tsx b/frontend/src/layout/today/TodayPaneOption.tsxnew file mode 100644index 000000000000..43378bece803--- /dev/null+++ b/frontend/src/layout/today/TodayPaneOption.tsx@@ -0,0 +1,52 @@+import type { ComponentProps, ReactNode } from 'react'++import { AutocompleteItem, Button, cn } from '@posthog/quill'++import { LinkPrimitive } from 'lib/lemon-ui/Link'++export interface TodayPaneOptionProps extends Omit<+ ComponentProps<typeof AutocompleteItem>,+ 'value' | 'render' | 'className' | 'children'+> {+ value: string+ to: string+ active: boolean+ className?: string+ children: ReactNode+}++// Like Desktop's sidebar, the keyboard highlight tints the row like a hover, without a focus ring.+export function TodayPaneOption({+ value,+ to,+ active,+ className,+ children,+ ...props+}: TodayPaneOptionProps): JSX.Element {+ return (+ <AutocompleteItem+ value={value}+ aria-current={active ? 'page' : undefined}+ {...props}+ render={+ <Button+ size="row"+ left+ nativeButton={false}+ render={<LinkPrimitive to={to} />}+ className={cn(+ 'w-full min-w-0 text-foreground [&>span]:w-full',+ 'data-highlighted:border-transparent data-highlighted:ring-0',+ active+ ? 'bg-fill-selected data-highlighted:bg-fill-selected'+ : 'data-highlighted:bg-fill-hover',+ className+ )}+ />+ }+ >+ {children}+ </AutocompleteItem>+ )+}diff --git a/frontend/src/layout/today/TodayPaneRow.tsx b/frontend/src/layout/today/TodayPaneRow.tsxindex 4c039631d87e..d5502e5bb013 100644--- a/frontend/src/layout/today/TodayPaneRow.tsx+++ b/frontend/src/layout/today/TodayPaneRow.tsx@@ -1,60 +1,62 @@-import { Link } from 'lib/lemon-ui/Link'-import { cn } from 'lib/utils/css-classes'+import { cn } from '@posthog/quill'++import { TodayPaneOption } from './TodayPaneOption'interface TodayPaneRowProps {+ value: stringlabel: stringmeta?: stringicon?: JSX.Element | null- to?: string+ to: stringactive?: boolean- onClick?: () => void- trailing?: JSX.Element | null- /** A control that sits on the row's right edge and shows on hover, outside the row's own link or button. */+ /** A control that sits on the row's right edge and shows on hover, outside the row's own link. */action?: JSX.Element | nulldataAttr?: string}-/** One row in the Spaces, Library and Tools sidebars. It is a link when it has `to`, otherwise a button. */export function TodayPaneRow({+ value,label,meta,icon,to,active = false,- onClick,- trailing,action,dataAttr,}: TodayPaneRowProps): JSX.Element {- const content = (- <>- {icon && (- <span className="TodayPaneRow__icon" aria-hidden>- {icon}+ return (+ <div className="group/row relative flex min-w-0 items-center">+ <TodayPaneOption+ value={value}+ to={to}+ active={active}+ title={label}+ data-attr={dataAttr}+ className={cn('font-medium', action && 'pr-8')}+ >+ {icon && (+ <span className="flex size-4 shrink-0 items-center justify-center [&_svg]:size-4" aria-hidden>+ {icon}+ </span>+ )}+ <span className="min-w-0 flex-1 truncate">{label}</span>+ {meta && (+ <span+ className={cn(+ 'shrink-0 text-xs font-normal text-muted-foreground',+ // The hover action takes the meta's place at the end of the row.+ action && 'group-hover/row:invisible group-focus-within/row:invisible'+ )}+ >+ {meta}+ </span>+ )}+ </TodayPaneOption>+ {action && (+ <span className="absolute right-1 flex items-center opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100">+ {action}</span>)}- <span className="TodayPaneRow__label">{label}</span>- {meta && <span className="TodayPaneRow__meta">{meta}</span>}- {trailing}- </>- )- const className = cn('TodayPaneRow', action && 'TodayPaneRow--withAction')- const row = to ? (- <Link to={to} className={className} data-active={active} data-attr={dataAttr} subtle onClick={onClick}>- {content}- </Link>- ) : (- <button type="button" className={className} data-active={active} data-attr={dataAttr} onClick={onClick}>- {content}- </button>- )- if (!action) {- return row- }- return (- <div className="TodayPaneRow__wrap">- {row}- <span className="TodayPaneRow__action">{action}</span></div>)}diff --git a/frontend/src/layout/today/TodayPaneSearchField.tsx b/frontend/src/layout/today/TodayPaneSearchField.tsxdeleted file mode 100644index 5726402db414..000000000000--- a/frontend/src/layout/today/TodayPaneSearchField.tsx+++ /dev/null@@ -1,82 +0,0 @@-import { ChangeEvent, KeyboardEvent, MouseEvent } from 'react'--import { IconX } from '@posthog/icons'-import {- InputGroup,- InputGroupAddon,- InputGroupButton,- InputGroupInput,- InputGroupText,- Tooltip,- TooltipContent,- TooltipTrigger,-} from '@posthog/quill'--/** A pane section's search box. Escape or the button clears the query first, then closes the box. */-export function TodayPaneSearchField({- query,- resultCount,- label,- onQueryChange,- onClose,- dataAttr,-}: {- query: string- resultCount: number- /** The accessible name, also the placeholder, for example "Search recent". */- label: string- onQueryChange: (query: string) => void- onClose: () => void- /** Prefix for the field's `data-attr` and its clear button's `-clear` one. */- dataAttr: string-}): JSX.Element {- const hasQuery = query !== ''- const buttonLabel = hasQuery ? 'Clear search' : 'Close search'- const clearOrClose = (): void => (hasQuery ? onQueryChange('') : onClose())-- return (- <InputGroup className="min-w-0 flex-1">- <InputGroupInput- autoFocus- value={query}- placeholder={`${label}…`}- aria-label={label}- data-attr={dataAttr}- onChange={(event: ChangeEvent<HTMLInputElement>) => onQueryChange(event.target.value)}- onKeyDown={(event: KeyboardEvent<HTMLInputElement>) => {- if (event.key === 'Escape') {- event.preventDefault()- event.stopPropagation()- clearOrClose()- }- }}- onBlur={() => !hasQuery && onClose()}- />- <InputGroupAddon align="inline-end">- {hasQuery && (- <InputGroupText className="tabular-nums">- {resultCount === 0 ? 'No results' : resultCount}- </InputGroupText>- )}- <Tooltip>- <TooltipTrigger- delay={0}- render={- <InputGroupButton- size="icon-xs"- aria-label={buttonLabel}- // Keeps focus in the field, so blur doesn't close it before the click lands.- onMouseDown={(event: MouseEvent) => event.preventDefault()}- onClick={clearOrClose}- data-attr={`${dataAttr}-clear`}- />- }- >- <IconX />- </TooltipTrigger>- <TooltipContent>{buttonLabel}</TooltipContent>- </Tooltip>- </InputGroupAddon>- </InputGroup>- )-}diff --git a/frontend/src/layout/today/TodayPaneSearchList.tsx b/frontend/src/layout/today/TodayPaneSearchList.tsxnew file mode 100644index 000000000000..5b19a367b86b--- /dev/null+++ b/frontend/src/layout/today/TodayPaneSearchList.tsx@@ -0,0 +1,82 @@+import type { ReactNode } from 'react'++import { Autocomplete, AutocompleteClear, AutocompleteInput, AutocompleteList, cn } from '@posthog/quill'++export interface TodayPaneSearchListProps {+ query: string+ onQueryChange: (query: string) => void+ /** The field's accessible name. Its placeholder adds an ellipsis, for example "Search tools…". */+ searchLabel: string+ dataAttr: string+ searchActions?: ReactNode+ children: ReactNode+ className?: string+ /** For a pane whose own sections scroll, so the list itself does not. */+ listClassName?: string+}++/**+ * A sidebar pane's search field and list, after Desktop's sidebar. The list stays open, the field filters it,+ * the arrow keys move between rows and Enter opens the highlighted row.+ */+export function TodayPaneSearchList({+ query,+ onQueryChange,+ searchLabel,+ dataAttr,+ searchActions,+ children,+ className,+ listClassName,+}: TodayPaneSearchListProps): JSX.Element {+ return (+ <Autocomplete<string>+ inline+ open+ value={query}+ // No `items`: each row registers itself in render order, so the arrow keys walk exactly what shows.+ // The panes filter their own rows.+ filter={null}+ onValueChange={(value: string, details: { reason: string }) => {+ if (details.reason === 'input-change') {+ onQueryChange(value)+ }+ }}+ >+ <div className={cn('flex min-h-0 flex-1 flex-col', className)}>+ <div className="flex shrink-0 items-center gap-1 [&_[data-slot=autocomplete-input-group-wrapper]]:min-w-0 [&_[data-slot=autocomplete-input-group-wrapper]]:flex-1 [&_[data-slot=autocomplete-popover-separator]]:hidden">+ <AutocompleteInput+ placeholder={`${searchLabel}…`}+ aria-label={searchLabel}+ data-attr={dataAttr}+ className="h-7"+ onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {+ if (event.key === 'Escape' && query !== '') {+ event.preventDefault()+ event.stopPropagation()+ onQueryChange('')+ }+ }}+ >+ {query !== '' && (+ <AutocompleteClear+ aria-label="Clear search"+ data-attr={`${dataAttr}-clear`}+ onClick={() => onQueryChange('')}+ />+ )}+ </AutocompleteInput>+ {searchActions}+ </div>+ <AutocompleteList+ className={cn(+ 'TodayPaneSearchList mt-2 min-h-0 !max-h-none flex-1 overflow-y-auto !p-0 pb-6',+ listClassName+ )}+ >+ {children}+ </AutocompleteList>+ </div>+ </Autocomplete>+ )+}diff --git a/frontend/src/layout/today/TodayRail.tsx b/frontend/src/layout/today/TodayRail.tsxindex e95b4ddda6ab..8a17ad02799b 100644--- a/frontend/src/layout/today/TodayRail.tsx+++ b/frontend/src/layout/today/TodayRail.tsx@@ -1,26 +1,27 @@import { useActions, useValues } from 'kea'+import { ComponentProps } from 'react'import {IconBook,IconChat,IconGridMasonry,IconHome,- IconLogomark,IconSearch,IconSidebarClose,IconSidebarOpen,IconWrench,} from '@posthog/icons'+import { Button, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill'+import { Logomark } from 'lib/brand'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 { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'-import { cn } from 'lib/utils/css-classes'import { organizationLogic } from 'scenes/organizationLogic'+import { TodayRailTile } from './TodayRailTile'import { TODAY_RAIL_WIDTH, TodayRailPane, todayShellLogic } from './todayShellLogic'const RAIL_ITEMS: { pane: TodayRailPane; label: string; icon: JSX.Element }[] = [@@ -31,6 +32,32 @@ const RAIL_ITEMS: { pane: TodayRailPane; label: string; icon: JSX.Element }[] ={ pane: 'tools', label: 'Tools', icon: <IconWrench /> },]+function RailUtility({+ label,+ children,+ ...props+}: { label: string; children: JSX.Element } & ComponentProps<typeof Button>): JSX.Element {+ return (+ <Tooltip>+ <TooltipTrigger+ delay={0}+ render={+ <Button+ variant="default"+ size="icon-lg"+ aria-label={label}+ className="relative text-muted-foreground [&_svg]:size-5"+ {...props}+ />+ }+ >+ {children}+ </TooltipTrigger>+ <TooltipContent side="right">{label}</TooltipContent>+ </Tooltip>+ )+}+export function TodayRail(): JSX.Element {const { activePane, sidebarVisible } = useValues(todayShellLogic)const { pickPane, toggleSidebar } = useActions(todayShellLogic)@@ -41,86 +68,59 @@ export function TodayRail(): JSX.Element {return (<navaria-label="Main"- className="flex flex-col items-center gap-1 py-3 shrink-0"+ className="flex shrink-0 flex-col items-center gap-3 border-r border-[var(--border)] px-1 pt-1.5 pb-2"// eslint-disable-next-line react/forbid-dom-propsstyle={{ width: TODAY_RAIL_WIDTH }}>- <div className="flex items-center justify-center size-9 mb-2 text-primary" aria-hidden>- <IconLogomark className="size-6" />+ <div className="mb-1 flex size-9 items-center justify-center" aria-hidden>+ <Logomark className="h-auto w-6" /></div>- {RAIL_ITEMS.map(({ pane, label, icon }) => {- const active = activePane === pane- return (- <ButtonPrimitive- key={pane}- iconOnly- size="lg"- active={active}- aria-label={label}- aria-current={active ? 'page' : undefined}- tooltip={label}- tooltipPlacement="right"- data-attr={`today-rail-${pane}`}- className={cn('text-secondary [&_svg]:size-5', active && 'text-primary')}- onClick={() => pickPane(pane)}- >- {icon}- </ButtonPrimitive>- )- })}+ {RAIL_ITEMS.map(({ pane, label, icon }) => (+ <TodayRailTile+ key={pane}+ label={label}+ icon={icon}+ active={activePane === pane}+ onClick={() => pickPane(pane)}+ dataAttr={`today-rail-${pane}`}+ />+ ))}<div className="mt-auto flex flex-col items-center gap-1">{!sidebarVisible && (<NewAccountMenuside="right"align="end"renderTrigger={(props) => (- <ButtonPrimitive- {...props}- iconOnly- size="lg"- aria-label="Account menu"- tooltip="Account menu"- tooltipPlacement="right"- data-attr="new-account-menu-button"- className="relative"- >- <UploadedLogo- name={currentOrganization?.name ?? '?'}- entityId={currentOrganization?.id ?? ''}- mediaId={currentOrganization?.logo_media_id ?? ''}- size="small"- />- {pendingInvites.length > 0 && (- <PendingInviteDot className="absolute top-1.5 right-1.5" />- )}- </ButtonPrimitive>+ <RailUtility {...props} label="Account menu" data-attr="new-account-menu-button">+ <>+ <UploadedLogo+ name={currentOrganization?.name ?? '?'}+ entityId={currentOrganization?.id ?? ''}+ mediaId={currentOrganization?.logo_media_id ?? ''}+ size="small"+ />+ {pendingInvites.length > 0 && (+ <PendingInviteDot className="absolute top-1.5 right-1.5" />+ )}+ </>+ </RailUtility>)}/>)}- <ButtonPrimitive- iconOnly- size="lg"- aria-label="Search"- tooltip="Search"- tooltipPlacement="right"+ <RailUtility+ label="Search"data-attr="today-rail-search"- className="text-secondary [&_svg]:size-5"onClick={() => toggleCommand('nav-search-button')}><IconSearch />- </ButtonPrimitive>- <ButtonPrimitive- iconOnly- size="lg"- aria-label={sidebarVisible ? 'Hide sidebar' : 'Show sidebar'}- tooltip={sidebarVisible ? 'Hide sidebar' : 'Show sidebar'}- tooltipPlacement="right"+ </RailUtility>+ <RailUtility+ label={sidebarVisible ? 'Hide sidebar' : 'Show sidebar'}data-attr="today-rail-toggle-sidebar"- className="text-secondary [&_svg]:size-5"onClick={toggleSidebar}>{sidebarVisible ? <IconSidebarClose /> : <IconSidebarOpen />}- </ButtonPrimitive>+ </RailUtility></div></nav>)diff --git a/frontend/src/layout/today/TodayRailTile.tsx b/frontend/src/layout/today/TodayRailTile.tsxnew file mode 100644index 000000000000..0ed3828142ef--- /dev/null+++ b/frontend/src/layout/today/TodayRailTile.tsx@@ -0,0 +1,36 @@+import { cn } from '@posthog/quill'++export interface TodayRailTileProps {+ label: string+ icon: JSX.Element+ active: boolean+ onClick: () => void+ dataAttr: string+}++export function TodayRailTile({ label, icon, active, onClick, dataAttr }: TodayRailTileProps): JSX.Element {+ return (+ <button+ type="button"+ aria-label={label}+ aria-current={active ? 'page' : undefined}+ data-attr={dataAttr}+ onClick={onClick}+ className={cn(+ 'group flex w-full shrink-0 cursor-pointer flex-col items-center gap-1 outline-none hover:text-foreground',+ active ? 'text-foreground' : 'text-muted-foreground'+ )}+ >+ <span+ className={cn(+ 'flex size-10 items-center justify-center rounded-md [&_svg]:size-5',+ 'group-focus-visible:ring-2 group-focus-visible:ring-[var(--ring)]',+ active ? 'bg-[var(--fill-selected)]' : 'group-hover:bg-[var(--fill-hover)]'+ )}+ >+ {icon}+ </span>+ <span className="max-w-full truncate px-0.5 text-[10px] leading-3 font-medium">{label}</span>+ </button>+ )+}diff --git a/frontend/src/layout/today/TodayRecentSearchField.tsx b/frontend/src/layout/today/TodayRecentSearchField.tsxdeleted file mode 100644index 26d67ef3d29b..000000000000--- a/frontend/src/layout/today/TodayRecentSearchField.tsx+++ /dev/null@@ -1,20 +0,0 @@-import { useActions, useValues } from 'kea'--import { TodayPaneSearchField } from './TodayPaneSearchField'-import { todaySpacesLogic } from './todaySpacesLogic'--export function TodayRecentSearchField(): JSX.Element {- const { recentQuery, recentItems } = useValues(todaySpacesLogic)- const { setRecentQuery, setRecentSearchOpen } = useActions(todaySpacesLogic)-- return (- <TodayPaneSearchField- query={recentQuery}- resultCount={recentItems.length}- label="Search recent"- onQueryChange={setRecentQuery}- onClose={() => setRecentSearchOpen(false)}- dataAttr="today-recent-search"- />- )-}diff --git a/frontend/src/layout/today/TodaySessionIcon.tsx b/frontend/src/layout/today/TodaySessionIcon.tsxnew file mode 100644index 000000000000..329f5317d871--- /dev/null+++ b/frontend/src/layout/today/TodaySessionIcon.tsx@@ -0,0 +1,22 @@+import { IconChat } from '@posthog/icons'++import { todaySessionDot } from './todaySessionDot'+import { TodaySessionStatusDot } from './TodaySessionStatusDot'+import { TodayWorkItem } from './todayWorkItems'++/**+ * The one icon for a PostHog AI session or chat, wherever it shows: a chat bubble for a chat, and for a session+ * the status dot from PostHog Desktop's task rows.+ */+export function TodaySessionIcon({+ item,+ unread = false,+}: {+ item: Pick<TodayWorkItem, 'kind' | 'status' | 'runEnvironment'>+ unread?: boolean+}): JSX.Element {+ if (item.kind === 'chat') {+ return <IconChat className="text-muted-foreground" />+ }+ return <TodaySessionStatusDot dot={todaySessionDot(item, unread)} />+}diff --git a/frontend/src/layout/today/TodaySessionRow.tsx b/frontend/src/layout/today/TodaySessionRow.tsxindex 9bbbced0d16d..e3828977a84f 100644--- a/frontend/src/layout/today/TodaySessionRow.tsx+++ b/frontend/src/layout/today/TodaySessionRow.tsx@@ -11,9 +11,9 @@ import { TodayPreviewTrigger } from './TodayPreviewTrigger'import { TodaySessionBadges } from './TodaySessionBadges'import { TodaySessionContextMenu } from './TodaySessionContextMenu'import { TodaySessionDialogs } from './TodaySessionDialogs'+import { TodaySessionIcon } from './TodaySessionIcon'import { TodaySessionSurface, todaySessionMenuLogic } from './todaySessionMenuLogic'import { TodaySessionRenameInput } from './TodaySessionRenameInput'-import { TodaySessionStatusDot } from './TodaySessionStatusDot'import { todaySpacesLogic } from './todaySpacesLogic'import { TodaySpacesRow } from './TodaySpacesRow'import { TodayWorkItem, sessionBadges, sessionDetails } from './todayWorkItems'@@ -30,6 +30,7 @@ interface TodaySessionRowProps {selected?: boolean/** Takes a modifier click over for the sidebar's multi-select. */onSelectClick?: (event: React.MouseEvent<HTMLElement>) => void+ optionValue: string}export function TodaySessionRow({@@ -41,6 +42,7 @@ export function TodaySessionRow({unread,selected = false,onSelectClick,+ optionValue,}: TodaySessionRowProps): JSX.Element {const { renaming } = useValues(todaySessionMenuLogic)const { location, searchParams } = useValues(router)@@ -68,7 +70,7 @@ export function TodaySessionRow({<TodaySpacesRowlabel={item.title || 'Untitled session'}// Unread shows only as a solid status dot; the title keeps its resting weight, like desktop.- icon={<TodaySessionStatusDot dot={preview.dot} />}+ icon={<TodaySessionIcon item={item} unread={unread} />}to={urls.aiTask(item.id)}active={location.pathname.endsWith('/ai') && searchParams.task === item.id}dataAttr={dataAttr}@@ -87,6 +89,7 @@ export function TodaySessionRow({selected={selected}onClickCapture={onSelectClick}details={details}+ optionValue={optionValue}/>)// Like Desktop, the row's actions live in its hover card and its right-click menu, which open the dialogs on the row's behalf.diff --git a/frontend/src/layout/today/TodaySessionStatusIcon.tsx b/frontend/src/layout/today/TodaySessionStatusIcon.tsxdeleted file mode 100644index 514e1419af9d..000000000000--- a/frontend/src/layout/today/TodaySessionStatusIcon.tsx+++ /dev/null@@ -1,24 +0,0 @@-import { IconChat, IconCloud, IconPinFilled, IconSpinner } from '@posthog/icons'--import { TodaySessionIconKind, todaySessionIcon } from './todaySessionIcon'-import { TodayWorkItem } from './todayWorkItems'--const ICONS: Record<TodaySessionIconKind, { label: string; icon: JSX.Element }> = {- chat: { label: 'Chat', icon: <IconChat className="text-muted-foreground" /> },- running: { label: 'Running', icon: <IconSpinner className="text-info-foreground motion-safe:animate-spin" /> },- queued: { label: 'Queued', icon: <IconCloud className="text-muted-foreground motion-safe:animate-pulse" /> },- completed: { label: 'Completed', icon: <IconCloud className="text-success-foreground" /> },- failed: { label: 'Failed', icon: <IconCloud className="text-destructive-foreground" /> },- stopped: { label: 'Stopped', icon: <IconCloud className="text-muted-foreground" /> },- pinned: { label: 'Pinned', icon: <IconPinFilled className="text-foreground" /> },- session: { label: 'Session', icon: <IconCloud className="text-muted-foreground" /> },-}--export function TodaySessionStatusIcon({ item, pinned }: { item: TodayWorkItem; pinned: boolean }): JSX.Element {- const { label, icon } = ICONS[todaySessionIcon(item, pinned)]- return (- <span role="img" aria-label={label} className="flex">- {icon}- </span>- )-}diff --git a/frontend/src/layout/today/TodayShell.scss b/frontend/src/layout/today/TodayShell.scssindex dbf1c839d4cf..5c71de6ddfd7 100644--- a/frontend/src/layout/today/TodayShell.scss+++ b/frontend/src/layout/today/TodayShell.scss@@ -71,16 +71,18 @@}.TodayShell__pane {+ display: flex;flex: 1 1 auto;+ flex-direction: column;min-height: 0;}.TodayPane {display: flex;+ flex: 1 1 auto;flex-direction: column;- height: 100%;min-height: 0;- padding: 18px 12px 0;+ padding: 12px 12px 0;}.TodayPane__filters {@@ -92,18 +94,13 @@.TodayPane__scroll {flex: 1 1 auto;min-height: 0;- padding: 0 4px 24px;+ padding: 0 0 24px;margin-top: 6px;overflow-y: auto;scrollbar-color: var(--today-input-border) transparent;scrollbar-width: thin;}-.TodayPane__heading {- margin: 26px 8px 8px;- letter-spacing: 0.08em;-}-.TodayPane__state {display: flex;flex-direction: column;@@ -115,92 +112,7 @@color: var(--today-muted);}-.TodayPaneRow {- display: flex;- gap: 9px;- align-items: center;- width: 100%;- min-height: 32px;- padding: 6px 8px;- font-size: 12.5px;- color: var(--today-body-text);- text-align: left;- border-radius: 8px;-- &[data-active='true'] {- color: var(--today-ink);- background: var(--today-soft);- }-- @media (hover: hover) and (pointer: fine) {- &:hover {- color: var(--today-ink);- background: var(--today-soft);- }- }-}--.TodayPaneRow__icon {- display: flex;- flex: 0 0 18px;- align-items: center;- justify-content: center;- width: 18px;- height: 18px;-- svg {- width: 16px;- height: 16px;- }-}--.TodayPaneRow__label {- flex: 1;- min-width: 0;- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;-}--.TodayPaneRow__meta {- flex: 0 0 auto;- max-width: 40%;- overflow: hidden;- font-size: 10.5px;- color: var(--today-faint);- text-overflow: ellipsis;- white-space: nowrap;-}--.TodayPaneRow__wrap:has(.TodayPaneRow__meta) {- .TodayPaneRow--withAction {- padding-right: 8px;- }-- &:hover .TodayPaneRow__meta,- &:focus-within .TodayPaneRow__meta {- visibility: hidden;- }-}--.TodayPaneRow__wrap {- position: relative;-- .TodayPaneRow--withAction {- padding-right: 36px;- }-}--.TodayPaneRow__action {- position: absolute;- top: 50%;- right: 4px;- opacity: 0;- transition: opacity 0.16s;- transform: translateY(-50%);-- .TodayPaneRow__wrap:hover &,- .TodayPaneRow__wrap:focus-within & {- opacity: 1;- }+// While the keyboard highlights a row, a row under a resting pointer would look active too, so its hover tint drops.+.TodayPaneSearchList:has([data-highlighted]) [role='option']:not([data-highlighted]):hover {+ background: transparent;}diff --git a/frontend/src/layout/today/TodayShell.tsx b/frontend/src/layout/today/TodayShell.tsxindex 82ea45c2a1b3..ec1a2bfd9589 100644--- a/frontend/src/layout/today/TodayShell.tsx+++ b/frontend/src/layout/today/TodayShell.tsx@@ -1,6 +1,6 @@import './TodayShell.scss'-import { useActions, useValues } from 'kea'+import { useActions, useMountedLogic, useValues } from 'kea'import { Suspense, useEffect, useRef } from 'react'import { Skeleton, ToastProvider } from '@posthog/quill'@@ -12,8 +12,11 @@ import { cn } from 'lib/utils/css-classes'import { lazyWithRetry } from 'lib/utils/retryImport'import { TodayHomeSidebar } from 'scenes/project-homepage/today/TodayHomeSidebar'+import { QuillSceneHeader } from '~/layout/scenes/components/QuillSceneHeader'+import { TodayPreviewCardProvider } from './TodayPreviewCardProvider'import { TodayRail } from './TodayRail'+import { todayRecentsLogic } from './todayRecentsLogic'import { TODAY_RAIL_WIDTH, TODAY_SIDEBAR_CLOSE_THRESHOLD, clampSidebarWidth, todayShellLogic } from './todayShellLogic'import { TodaySidebarFooter } from './TodaySidebarFooter'@@ -36,6 +39,8 @@ const PANE_LABELS = { home: 'Today', spaces: 'Spaces', views: 'Views', library:/** 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, sidebarVisible, sidebarWidth } = useValues(todayShellLogic)+ // Records the tools and sessions visited while other panes are open, so each pane's Recent group is ready.+ useMountedLogic(todayRecentsLogic)const { setMobileSidebarOpen, setSidebarOpen, setSidebarWidth, toggleSidebar } = useActions(todayShellLogic)const sidebarRef = useRef<HTMLDivElement | null>(null)const drawerRef = useRef<HTMLElement | null>(null)@@ -75,6 +80,13 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {const pane = (<div className="TodayShell__pane">+ <QuillSceneHeader+ title={+ <h2 className="m-0 min-w-0 truncate text-base font-bold text-foreground">+ {PANE_LABELS[activePane]}+ </h2>+ }+ /><Suspense fallback={<Skeleton className="m-4 h-24" />}>{activePane === 'home' ? (<TodayPreviewCardProvider>@@ -96,7 +108,8 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {return (<ToastProvider><div- className={cn('Today TodayShell', className)}+ data-quill+ className={cn('Today TodayShell bg-[var(--chrome)]', className)}// eslint-disable-next-line react/forbid-dom-propsstyle={{ '--today-rail-width': `${TODAY_RAIL_WIDTH}px` } as React.CSSProperties}>@@ -128,7 +141,7 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {sidebarVisible && (<asideref={sidebarRef}- className="TodayShell__sidebar relative"+ className="TodayShell__sidebar relative border-r border-[var(--border)]"aria-label={PANE_LABELS[activePane]}// eslint-disable-next-line react/forbid-dom-propsstyle={{ width: sidebarWidth }}diff --git a/frontend/src/layout/today/TodaySidebarFooter.tsx b/frontend/src/layout/today/TodaySidebarFooter.tsxindex f7addb8a5435..d5d65156def2 100644--- a/frontend/src/layout/today/TodaySidebarFooter.tsx+++ b/frontend/src/layout/today/TodaySidebarFooter.tsx@@ -2,7 +2,7 @@ import { useValues } from 'kea'import { ComponentProps } from 'react'import { IconGear } from '@posthog/icons'-import { Button, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill'+import { Button, Tooltip, TooltipContent, TooltipTrigger, cn } from '@posthog/quill'import { NewAccountMenu } from 'lib/components/Account/NewAccountMenu'import { pendingInvitesLogic } from 'lib/components/Account/pendingInvitesLogic'@@ -15,6 +15,8 @@ import { urls } from 'scenes/urls'import { todayShellLogic } from './todayShellLogic'+const TRIGGER_CLASSES = 'text-muted-foreground hover:text-foreground data-[popup-open]:text-foreground'+export function TodaySidebarFooter(): JSX.Element {const { currentTeam } = useValues(teamLogic)const { currentOrganization } = useValues(organizationLogic)@@ -25,7 +27,7 @@ export function TodaySidebarFooter(): JSX.Element {<Button{...props}size="lg"- className="TodaySidebarFooter__account justify-start"+ className={cn(TRIGGER_CLASSES, 'min-w-0 justify-start ps-1.5 pe-2')}data-attr="today-project-menu"><UploadedLogo@@ -34,13 +36,13 @@ export function TodaySidebarFooter(): JSX.Element {mediaId={currentOrganization?.logo_media_id ?? ''}size="small"/>- <span className="TodaySidebarFooter__name">{currentTeam?.name ?? 'Project'}</span>+ <span className="min-w-0 truncate">{currentTeam?.name ?? 'Project'}</span>{pendingInvites.length > 0 && <PendingInviteDot className="ml-auto" />}</Button>)return (- <div className="TodaySidebarFooter">+ <div className="mx-3 grid flex-none grid-cols-[minmax(0,1fr)_auto] items-center gap-1 border-t border-[var(--border)] pt-2 pb-4">{sidebarVisible ? (<NewAccountMenu side="top" align="start" sideOffset={12} renderTrigger={renderTrigger} />) : (@@ -52,7 +54,7 @@ export function TodaySidebarFooter(): JSX.Element {render={<Buttonsize="icon-lg"- className="TodaySidebarFooter__settings"+ className={TRIGGER_CLASSES}aria-label="Settings"nativeButton={false}render={<LinkPrimitive to={urls.settings('project')} />}diff --git a/frontend/src/layout/today/TodaySpacesRow.tsx b/frontend/src/layout/today/TodaySpacesRow.tsxindex 8679ef4dda97..68d9f0fe28f6 100644--- a/frontend/src/layout/today/TodaySpacesRow.tsx+++ b/frontend/src/layout/today/TodaySpacesRow.tsx@@ -1,11 +1,10 @@import { Fragment, useState } from 'react'-import { Button, cn } from '@posthog/quill'--import { LinkPrimitive } from 'lib/lemon-ui/Link'+import { cn } from '@posthog/quill'import { TodayListItemDetail } from './todayListAppearance'import { TodayOverflowText } from './TodayOverflowText'+import { TodayPaneOption } from './TodayPaneOption'// The label's right padding for the icon-sized slots that sit over the end of the row.const TRAILING_PADDING = ['', 'pr-8', 'pr-12', 'pr-16', 'pr-20'] as const@@ -30,6 +29,7 @@ interface TodaySpacesRowProps {onClickCapture?: (event: React.MouseEvent<HTMLElement>) => void/** A second line under the label, like Desktop's list item appearance. Empty keeps the row on one line. */details?: TodayListItemDetail[]+ optionValue: string}export function TodaySpacesRow({@@ -46,22 +46,73 @@ export function TodaySpacesRow({selected = false,onClickCapture,details = [],+ optionValue,}: TodaySpacesRowProps): JSX.Element {const [hovered, setHovered] = useState(false)const [keyboardFocused, setKeyboardFocused] = useState(false)const badgeSlots = badge ? badgeCount : 0const showUnreadDot = unread && !active+ const rowClassName = cn(+ weight === 'medium' && 'font-medium',+ // Desktop's two-line row: the second line outgrows the fixed row height, so padding stands in for it.+ details.length > 0 && 'h-auto py-1',+ // Like Desktop, the open row takes a stronger tint than the other selected rows.+ selected &&+ (active ? 'bg-primary/20 data-highlighted:bg-primary/20' : 'bg-primary/10 data-highlighted:bg-primary/10'),+ TRAILING_PADDING[badgeSlots]+ )+ const content = (+ <>+ <span+ className={cn(+ 'flex size-3.5 shrink-0 items-center justify-center',+ details.length > 0 && 'self-start pt-0.5'+ )}+ >+ {showUnreadDot ? (+ <span+ role="img"+ aria-label="Unread"+ className="size-2 rounded-full bg-primary"+ data-attr="today-unread-dot"+ />+ ) : (+ icon+ )}+ </span>+ <span className="flex min-w-0 flex-1 flex-col">+ {ticker ? (+ <TodayOverflowText reveal={hovered || keyboardFocused} className={cn(unread && 'font-bold')}>+ {label}+ </TodayOverflowText>+ ) : (+ <span className={cn('min-w-0 truncate', unread && 'font-bold')}>{label}</span>+ )}+ {details.length > 0 && (+ <span className="truncate text-xxs text-muted-foreground">+ {details.map((detail, index) => (+ // Every part is its own element, so a page translator can't break the line when the details change.+ <Fragment key={detail.field}>+ {index > 0 && <span> · </span>}+ <span title={detail.title}>{detail.text}</span>+ </Fragment>+ ))}+ </span>+ )}+ </span>+ </>+ )return (<divclassName="group/row relative flex min-w-0 items-center"onPointerEnter={ticker ? () => setHovered(true) : undefined}onPointerLeave={ticker ? () => setHovered(false) : undefined}>- <Button- size="row"- left- render={<LinkPrimitive to={to} />}- aria-current={active ? 'page' : undefined}+ <TodayPaneOption+ value={optionValue}+ to={to}+ active={active}+ title={label}data-attr={dataAttr}onClickCapture={onClickCapture}onFocus={@@ -71,54 +122,10 @@ export function TodaySpacesRow({: undefined}onBlur={ticker ? () => setKeyboardFocused(false) : undefined}- className={cn(- 'min-w-0 text-foreground',- weight === 'medium' && 'font-medium',- // Desktop's two-line row: the second line outgrows the fixed row height, so padding stands in for it.- details.length > 0 && 'h-auto py-1',- // Like Desktop, the open row takes a stronger tint than the other selected rows.- selected ? (active ? 'bg-primary/20' : 'bg-primary/10') : active && 'bg-fill-selected',- TRAILING_PADDING[badgeSlots]- )}+ className={rowClassName}>- <span- className={cn(- 'flex size-3.5 shrink-0 items-center justify-center',- details.length > 0 && 'self-start pt-0.5'- )}- >- {showUnreadDot ? (- <span- role="img"- aria-label="Unread"- className="size-2 rounded-full bg-primary"- data-attr="today-unread-dot"- />- ) : (- icon- )}- </span>- <span className="flex min-w-0 flex-1 flex-col">- {ticker ? (- <TodayOverflowText reveal={hovered || keyboardFocused} className={cn(unread && 'font-bold')}>- {label}- </TodayOverflowText>- ) : (- <span className={cn('min-w-0 truncate', unread && 'font-bold')}>{label}</span>- )}- {details.length > 0 && (- <span className="truncate text-xxs text-muted-foreground">- {details.map((detail, index) => (- // Every part is its own element, so a page translator can't break the line when the details change.- <Fragment key={detail.field}>- {index > 0 && <span> · </span>}- <span title={detail.title}>{detail.text}</span>- </Fragment>- ))}- </span>- )}- </span>- </Button>+ {content}+ </TodayPaneOption>{badge && (// Like PostHog Desktop, the badges sit at the end of the row.<div className="absolute right-1 flex min-w-0 items-center gap-0.5">diff --git a/frontend/src/layout/today/TodaySpacesSidebar.tsx b/frontend/src/layout/today/TodaySpacesSidebar.tsxindex eb268a24d277..454d7b079953 100644--- a/frontend/src/layout/today/TodaySpacesSidebar.tsx+++ b/frontend/src/layout/today/TodaySpacesSidebar.tsx@@ -2,7 +2,7 @@ import { useActions, useValues } from 'kea'import { router } from 'kea-router'import { Fragment } from 'react'-import { IconPlus, IconSearch, IconTableOfContents } from '@posthog/icons'+import { IconPlus, IconTableOfContents } from '@posthog/icons'import { Button, Skeleton, Text, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, cn } from '@posthog/quill'import { LinkPrimitive } from 'lib/lemon-ui/Link'@@ -13,10 +13,11 @@ import { SpacePresenceAvatars } from 'products/tasks/frontend/spaces/SpacePresenimport { TodayChatRow } from './TodayChatRow'import { TodayListAppearanceDialog } from './TodayListAppearanceDialog'+import { TodayPaneGroupLabel } from './TodayPaneGroupLabel'+import { TodayPaneSearchList } from './TodayPaneSearchList'import { TodayPaneSection, TodayPaneSectionProps } from './TodayPaneSection'import { TodayPreviewTrigger } from './TodayPreviewTrigger'import { TodayRecentFilterMenu } from './TodayRecentFilterMenu'-import { TodayRecentSearchField } from './TodayRecentSearchField'import { TodaySessionBulkBar } from './TodaySessionBulkBar'import { TodaySessionRow } from './TodaySessionRow'import { selectionClick } from './todaySessionSelection'@@ -37,10 +38,12 @@ export function TodaySpacesSidebar(): JSX.Element {spacesLoading,spacesUnavailable,pinnedItems,+ shownPinnedItems,+ shownSpaces,+ recentlyViewedSessions,allRecentItems,recentItems,recentGroups,- recentSearchVisible,recentQuery,recentFiltersActive,recentLoading,@@ -51,7 +54,7 @@ export function TodaySpacesSidebar(): JSX.Element {spacePresence,spacePreviews,} = useValues(todaySpacesLogic)- const { loadSpaces, loadRecentTasks, toggleSection, setRecentSearchOpen, clearRecentSearchAndFilters } =+ const { loadSpaces, loadRecentTasks, toggleSection, setRecentQuery, clearRecentSearchAndFilters } =useActions(todaySpacesLogic)const { openNewSpace } = useActions(newSpaceLogic)const { selectedSessionIds } = useValues(todaySessionSelectionLogic)@@ -77,10 +80,13 @@ export function TodaySpacesSidebar(): JSX.Element {}}- const renderItem = (item: TodayWorkItem, dataAttr: string, inPinnedSection = false): JSX.Element =>+ // A session can show in more than one group, so the group keeps its rows apart on the keyboard path.+ const optionValue = (group: string, item: TodayWorkItem): string => `${group}:${item.kind}-${item.id}`+ const renderItem = (item: TodayWorkItem, group: string, dataAttr: string, inPinnedSection = false): JSX.Element =>item.kind === 'session' ? (<TodaySessionRowkey={`${item.kind}-${item.id}`}+ optionValue={optionValue(group, item)}item={item}pinned={pinnedIds.has(item.id)}showPinBadge={!inPinnedSection}@@ -91,7 +97,12 @@ export function TodaySpacesSidebar(): JSX.Element {onSelectClick={(event) => onSelectClick(item.id, event)}/>) : (- <TodayChatRow key={`${item.kind}-${item.id}`} item={item} dataAttr={dataAttr} />+ <TodayChatRow+ key={`${item.kind}-${item.id}`}+ item={item}+ dataAttr={dataAttr}+ optionValue={optionValue(group, item)}+ />)const hasPinned = pinnedItems.length > 0@@ -159,39 +170,101 @@ export function TodaySpacesSidebar(): JSX.Element {return (<TooltipProvider><div className="TodayPane" data-quill>- <Button- variant="primary"- size="lg"- className="w-full"- render={<LinkPrimitive to={urls.taskNewSession()} />}- data-attr="today-spaces-new-chat"+ <TodayPaneSearchList+ query={recentQuery}+ onQueryChange={setRecentQuery}+ searchLabel="Search sessions and spaces"+ dataAttr="today-recent-search"+ searchActions={<TodayRecentFilterMenu />}+ listClassName="flex flex-col overflow-hidden pb-0">- <IconPlus />- New session- </Button>- <div className="mt-6 flex min-h-0 flex-1 flex-col overflow-hidden px-1" ref={layout.measureRefs.area}>- {hasPinned && (+ {recentlyViewedSessions.length > 0 && (+ <div className="shrink-0 pb-2">+ <TodayPaneGroupLabel first>Recently viewed</TodayPaneGroupLabel>+ {recentlyViewedSessions.map((item) =>+ renderItem(item, 'viewed', 'today-recently-viewed-session')+ )}+ </div>+ )}+ <div className="flex min-h-0 flex-1 flex-col overflow-hidden" ref={layout.measureRefs.area}>+ {hasPinned && (+ <TodayPaneSection+ label="Pinned"+ {...sectionLayout('pinned')}+ count={pinnedItems.length}+ onToggle={() => toggleSection('pinned')}+ dataAttr="today-section-pinned"+ >+ {shownPinnedItems.map((item) =>+ renderItem(item, 'pinned', 'today-pinned-session', true)+ )}+ </TodayPaneSection>+ )}<TodayPaneSection- label="Pinned"- {...sectionLayout('pinned')}- count={pinnedItems.length}- onToggle={() => toggleSection('pinned')}- dataAttr="today-section-pinned"+ label="Recent"+ {...sectionLayout('recent')}+ count={recentItems.length}+ onToggle={() => toggleSection('recent')}+ divider={hasPinned}+ dataAttr="today-section-recent">- {pinnedItems.map((item) => renderItem(item, 'today-pinned-session', true))}+ {recentState === 'loading' ? (+ loadingRows('Loading recent')+ ) : recentState === 'error' ? (+ loadError('Recent sessions didn’t load.', loadRecentTasks, 'today-recent-retry')+ ) : recentState === 'empty' ? (+ <Text size="xs" variant="muted" className="px-2 py-1">+ Sessions and chats you open show up here. Start one with New chat.+ </Text>+ ) : recentState === 'no-matches' ? (+ notice(+ 'No matches',+ <Button+ variant="outline"+ size="sm"+ onClick={clearRecentSearchAndFilters}+ data-attr="today-recent-clear-filters"+ >+ {todayRecentClearLabel(recentQuery !== '', recentFiltersActive)}+ </Button>+ )+ ) : (+ <>+ {recentTasksUnavailable &&+ loadError('Some sessions didn’t load.', loadRecentTasks, 'today-recent-retry')}+ {recentGroups.map((group, index) => (+ <Fragment key={group.key}>+ {group.label && (+ <Text+ size="xs"+ weight="medium"+ variant="muted"+ className={cn('block px-2 pb-1', index === 0 ? 'pt-1' : 'pt-3')}+ >+ {group.label}+ </Text>+ )}+ {group.items.map((item) =>+ renderItem(+ item,+ 'recent',+ item.kind === 'chat' ? 'today-recent-chat' : 'today-recent-session'+ )+ )}+ </Fragment>+ ))}+ </>+ )}</TodayPaneSection>- )}- <TodayPaneSection- label="Recent"- {...sectionLayout('recent')}- count={recentItems.length}- onToggle={() => toggleSection('recent')}- divider={hasPinned}- dataAttr="today-section-recent"- heading={recentSearchVisible ? <TodayRecentSearchField /> : null}- actions={- <>- {!recentSearchVisible && (+ <TodayPaneSection+ label="Spaces"+ {...sectionLayout('spaces')}+ count={visibleSpaces.length}+ onToggle={() => toggleSection('spaces')}+ divider+ dataAttr="today-section-spaces"+ actions={+ <><Tooltip><TooltipTriggerdelay={0}@@ -199,191 +272,119 @@ export function TodaySpacesSidebar(): JSX.Element {<Buttonsize="icon-xs"className="text-muted-foreground"- aria-label="Search recent"- onClick={() => setRecentSearchOpen(true)}- data-attr="today-recent-search-open"+ aria-label="New space"+ onClick={openNewSpace}+ data-attr="today-new-space-open-sidebar"/>}>- <IconSearch />+ <IconPlus /></TooltipTrigger>- <TooltipContent>Search recent</TooltipContent>+ <TooltipContent>New space</TooltipContent></Tooltip>- )}- <TodayRecentFilterMenu />- </>- }- >- {recentState === 'loading' ? (- loadingRows('Loading recent')- ) : recentState === 'error' ? (- loadError('Recent sessions didn’t load.', loadRecentTasks, 'today-recent-retry')- ) : recentState === 'empty' ? (- <Text size="xs" variant="muted" className="px-2 py-1">- Sessions and chats you open show up here. Start one with New session.- </Text>- ) : recentState === 'no-matches' ? (- notice(- 'No matches',- <Button- variant="outline"- size="sm"- onClick={clearRecentSearchAndFilters}- data-attr="today-recent-clear-filters"- >- {todayRecentClearLabel(recentQuery !== '', recentFiltersActive)}- </Button>- )- ) : (- <>- {recentTasksUnavailable &&- loadError('Some sessions didn’t load.', loadRecentTasks, 'today-recent-retry')}- {recentGroups.map((group, index) => (- <Fragment key={group.key}>- {group.label && (- <Text- size="xs"- weight="medium"- variant="muted"- className={cn('block px-2 pb-1', index === 0 ? 'pt-1' : 'pt-3')}- >- {group.label}- </Text>- )}- {group.items.map((item) =>- renderItem(- item,- item.kind === 'chat' ? 'today-recent-chat' : 'today-recent-session'- )- )}- </Fragment>- ))}- </>- )}- </TodayPaneSection>- <TodayPaneSection- label="Spaces"- {...sectionLayout('spaces')}- count={visibleSpaces.length}- onToggle={() => toggleSection('spaces')}- divider- dataAttr="today-section-spaces"- actions={- <>- <Tooltip>- <TooltipTrigger- delay={0}- render={- <Button- size="icon-xs"- className="text-muted-foreground"- aria-label="New space"- onClick={openNewSpace}- data-attr="today-new-space-open-sidebar"- />- }- >- <IconPlus />- </TooltipTrigger>- <TooltipContent>New space</TooltipContent>- </Tooltip>- <Tooltip>- <TooltipTrigger- delay={0}- render={- <Button- size="icon-xs"- render={<LinkPrimitive to={urls.taskSpaces()} />}- aria-current={browsingSpaces ? 'page' : undefined}- className={cn(- 'text-muted-foreground',- browsingSpaces && 'bg-fill-selected text-foreground'- )}- aria-label="Browse spaces"- data-attr="today-spaces-browse"- />- }- >- <IconTableOfContents />- </TooltipTrigger>- <TooltipContent>Browse spaces</TooltipContent>- </Tooltip>- </>- }- >- {spacesState === 'loading' ? (- loadingRows('Loading spaces')- ) : spacesState === 'error' ? (- loadError('Spaces didn’t load.', loadSpaces, 'today-spaces-retry')- ) : spacesState === 'empty' ? (- notice(- 'Spaces you star show up here.',+ <Tooltip>+ <TooltipTrigger+ delay={0}+ render={+ <Button+ size="icon-xs"+ render={<LinkPrimitive to={urls.taskSpaces()} />}+ aria-current={browsingSpaces ? 'page' : undefined}+ className={cn(+ 'text-muted-foreground',+ browsingSpaces && 'bg-fill-selected text-foreground'+ )}+ aria-label="Browse spaces"+ data-attr="today-spaces-browse"+ />+ }+ >+ <IconTableOfContents />+ </TooltipTrigger>+ <TooltipContent>Browse spaces</TooltipContent>+ </Tooltip>+ </>+ }+ >+ {spacesState === 'loading' ? (+ loadingRows('Loading spaces')+ ) : spacesState === 'error' ? (+ loadError('Spaces didn’t load.', loadSpaces, 'today-spaces-retry')+ ) : spacesState === 'empty' ? (+ notice(+ 'Spaces you star show up here.',+ <>+ <Button+ variant="outline"+ size="sm"+ onClick={openNewSpace}+ data-attr="today-spaces-empty-new-space"+ >+ <IconPlus />+ New space…+ </Button>+ <Button+ variant="outline"+ size="sm"+ render={<LinkPrimitive to={urls.taskSpaces()} />}+ data-attr="today-spaces-add"+ >+ Browse spaces+ </Button>+ </>+ )+ ) : (<>- <Button- variant="outline"- size="sm"- onClick={openNewSpace}- data-attr="today-spaces-empty-new-space"- >- <IconPlus />- New space…- </Button>- <Button- variant="outline"- size="sm"- render={<LinkPrimitive to={urls.taskSpaces()} />}- data-attr="today-spaces-add"- >- Browse spaces- </Button>+ {spacesUnavailable &&+ loadError('Spaces didn’t refresh.', loadSpaces, 'today-spaces-retry')}+ {shownSpaces.map((space) => {+ const presence = spacePresence[space.id]+ return (+ <TodaySpaceContextMenu key={space.id} space={space}>+ <TodayPreviewTrigger payload={spacePreviews[space.id]}>+ <TodaySpacesRow+ label={spaceLabel(space)}+ icon={+ <TodaySpaceGlyph+ locked={isLockedSpace(space)}+ className="text-muted-foreground"+ />+ }+ to={urls.taskSpace(space.id)}+ active={location.pathname.includes(urls.taskSpace(space.id))}+ dataAttr="today-space-row"+ optionValue={`space:${space.id}`}+ badge={+ presence ? (+ <SpacePresenceAvatars presence={presence} />+ ) : null+ }+ badgeCount={+ Math.min(presence?.people.length ?? 1, 3) as 1 | 2 | 3+ }+ unread={unreadSpaceIds.has(space.id)}+ />+ </TodayPreviewTrigger>+ </TodaySpaceContextMenu>+ )+ })}+ {visibleSpaces.length === 1 && (+ <Button+ variant="outline"+ size="sm"+ className="mt-1 self-start"+ data-attr="today-spaces-add"+ render={<LinkPrimitive to={urls.taskSpaces()} />}+ >+ <IconPlus />+ Add the spaces you work in+ </Button>+ )}</>- )- ) : (- <>- {spacesUnavailable &&- loadError('Spaces didn’t refresh.', loadSpaces, 'today-spaces-retry')}- {visibleSpaces.map((space) => {- const presence = spacePresence[space.id]- return (- <TodaySpaceContextMenu key={space.id} space={space}>- <TodayPreviewTrigger payload={spacePreviews[space.id]}>- <TodaySpacesRow- label={spaceLabel(space)}- icon={- <TodaySpaceGlyph- locked={isLockedSpace(space)}- className="text-muted-foreground"- />- }- to={urls.taskSpace(space.id)}- active={location.pathname.includes(urls.taskSpace(space.id))}- dataAttr="today-space-row"- badge={- presence ? <SpacePresenceAvatars presence={presence} /> : null- }- badgeCount={Math.min(presence?.people.length ?? 1, 3) as 1 | 2 | 3}- unread={unreadSpaceIds.has(space.id)}- />- </TodayPreviewTrigger>- </TodaySpaceContextMenu>- )- })}- {visibleSpaces.length === 1 && (- <Button- variant="outline"- size="sm"- className="mt-1 self-start"- data-attr="today-spaces-add"- render={<LinkPrimitive to={urls.taskSpaces()} />}- >- <IconPlus />- Add the spaces you work in- </Button>- )}- </>- )}- </TodayPaneSection>- </div>+ )}+ </TodayPaneSection>+ </div>+ </TodayPaneSearchList><TodaySessionBulkBar /><TodayListAppearanceDialog /></div>diff --git a/frontend/src/layout/today/TodayToolsSidebar.tsx b/frontend/src/layout/today/TodayToolsSidebar.tsxindex 86282082e66f..80e82df6f9ce 100644--- a/frontend/src/layout/today/TodayToolsSidebar.tsx+++ b/frontend/src/layout/today/TodayToolsSidebar.tsx@@ -1,47 +1,53 @@import { useActions, useValues } from 'kea'import { router } from 'kea-router'-import { LemonInput } from '@posthog/lemon-ui'+import { Text } from '@posthog/quill'import { removeProjectIdIfPresent } from 'lib/utils/kea-router'+import { toolHrefForPath, toolLabel } from 'scenes/tools/toolsUtils'import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'-import { FileSystemIconType } from '~/queries/schema/schema-general'+import { FileSystemIconType, FileSystemImport } from '~/queries/schema/schema-general'+import { TodayPaneGroupLabel } from './TodayPaneGroupLabel'import { TodayPaneRow } from './TodayPaneRow'-import { todayToolsLogic, toolHrefForPath, toolLabel } from './todayToolsLogic'+import { TodayPaneSearchList } from './TodayPaneSearchList'+import { todayToolsLogic } from './todayToolsLogic'export function TodayToolsSidebar(): JSX.Element {- const { tools, toolGroups, search } = useValues(todayToolsLogic)+ const { tools, toolGroups, recentTools, search } = useValues(todayToolsLogic)const { setSearch } = useActions(todayToolsLogic)const { location } = useValues(router)const activeHref = toolHrefForPath(removeProjectIdIfPresent(location.pathname), tools)+ const groups = [+ ...(recentTools.length ? [{ key: 'recent', label: 'Recently viewed', tools: recentTools }] : []),+ ...toolGroups.map((group) => ({ key: group.category, label: group.category, tools: group.tools })),+ ]+ // A tool can show in Recently viewed and in its own group, so the group keeps the two rows apart on the keyboard path.+ const optionValue = (groupKey: string, tool: FileSystemImport): string => `${groupKey}:${tool.href ?? ''}`return (- <div className="TodayPane">- <div className="TodayPane__filters">- <LemonInput- type="search"- size="small"- placeholder="Search tools"- value={search}- onChange={setSearch}- data-attr="today-tools-search"- fullWidth- />- </div>- <div className="TodayPane__scroll">- {!toolGroups.length ? (- <div className="TodayPane__state">No tools match that search.</div>+ <div className="TodayPane" data-quill>+ <TodayPaneSearchList+ query={search}+ onQueryChange={setSearch}+ searchLabel="Search tools"+ dataAttr="today-tools-search"+ >+ {!groups.length ? (+ <Text size="xs" variant="muted" className="block px-2 py-1">+ No tools match that search.+ </Text>) : (- toolGroups.map((group) => (- <div key={group.category}>- <div className="TodayPane__heading Today__label">{group.category}</div>+ groups.map((group, index) => (+ <div key={group.key}>+ <TodayPaneGroupLabel first={index === 0}>{group.label}</TodayPaneGroupLabel>{group.tools.map((tool) => {const href = tool.href ?? ''return (<TodayPaneRowkey={href}+ value={optionValue(group.key, tool)}label={toolLabel(tool)}icon={iconForType((tool.iconType ?? tool.type) as FileSystemIconType,@@ -49,14 +55,14 @@ export function TodayToolsSidebar(): JSX.Element {)}to={href}active={!!href && href === activeHref}- dataAttr="today-tool"+ dataAttr={group.key === 'recent' ? 'today-tool-recent' : 'today-tool'}/>)})}</div>)))}- </div>+ </TodayPaneSearchList></div>)}diff --git a/frontend/src/layout/today/TodayViewsSidebar.tsx b/frontend/src/layout/today/TodayViewsSidebar.tsxindex 6889420e5f36..fdea172e0c70 100644--- a/frontend/src/layout/today/TodayViewsSidebar.tsx+++ b/frontend/src/layout/today/TodayViewsSidebar.tsx@@ -1,41 +1,43 @@import { useActions, useValues } from 'kea'import { router } from 'kea-router'-import { IconGridMasonry, IconPlus, IconSearch } from '@posthog/icons'-import { Button, Spinner, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill'+import { IconGridMasonry } from '@posthog/icons'+import { Button, Spinner } from '@posthog/quill'import { removeProjectIdIfPresent } from 'lib/utils/kea-router'import { urls } from 'scenes/urls'-import { NewViewMenu } from 'scenes/views/NewViewMenu'import { VIEW_TYPE_INFO } from 'scenes/views/viewsUtils'import { ViewTypeIcon } from 'scenes/views/ViewTypeIcon'+import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'+import { FileSystemIconType } from '~/queries/schema/schema-general'++import { TodayPaneGroupLabel } from './TodayPaneGroupLabel'import { TodayPaneRow } from './TodayPaneRow'-import { TodayPaneSearchField } from './TodayPaneSearchField'-import { TodayPaneSection } from './TodayPaneSection'+import { matchesPaneQuery } from './todayPaneSearch'+import { TodayPaneSearchList } from './TodayPaneSearchList'import { TodayViewsFilterMenu } from './TodayViewsFilterMenu'import { todayViewsLogic } from './todayViewsLogic'import { shortTimeAgo } from './todayWorkItems'-/** The Views sub-nav: a "New" menu, the full list, and the most recent views of every type, newest first. */+/** The Views sub-nav: recently viewed views, then the full list, newest first. */export function TodayViewsSidebar(): JSX.Element {const {recentViews,recentItems,recentViewsLoading,recentUnavailable,- recentCollapsed,recentQuery,- recentSearchVisible,recentFiltersActive,buildingViewIds,+ recentlyViewed: recents,} = useValues(todayViewsLogic)- const { loadRecentViews, toggleRecent, setRecentQuery, setRecentSearchOpen, clearRecentSearchAndFilters } =- useActions(todayViewsLogic)+ const { loadRecentViews, setRecentQuery, clearRecentSearchAndFilters } = useActions(todayViewsLogic)const narrowed = recentQuery.trim() !== '' || recentFiltersActiveconst { location } = useValues(router)const path = removeProjectIdIfPresent(location.pathname)const failedTypes = recentViews?.failedTypes ?? []+ const showAll = matchesPaneQuery('All views', recentQuery)const retryButton = (size: 'sm' | 'xs'): JSX.Element => (<Button@@ -51,63 +53,41 @@ export function TodayViewsSidebar(): JSX.Element {return (<div className="TodayPane" data-quill>- <NewViewMenu- trigger={<Button variant="primary" size="lg" className="w-full" data-attr="today-views-new" />}+ <TodayPaneSearchList+ query={recentQuery}+ onQueryChange={setRecentQuery}+ searchLabel="Search views"+ dataAttr="today-views-search"+ searchActions={<TodayViewsFilterMenu />}>- <IconPlus />- New…- </NewViewMenu>- <div className="TodayPane__scroll">- <TodayPaneRow- label="All views"- icon={<IconGridMasonry />}- to={urls.views()}- active={path === urls.views()}- dataAttr="today-views-all"- />- <TodayPaneSection- label="Recent"- open={!recentCollapsed}- count={recentItems.length}- onToggle={toggleRecent}- dataAttr="today-views-section-recent"- heading={- recentSearchVisible ? (- <TodayPaneSearchField- query={recentQuery}- resultCount={recentItems.length}- label="Search views"- onQueryChange={setRecentQuery}- onClose={() => setRecentSearchOpen(false)}- dataAttr="today-views-search"+ {recents.length > 0 && (+ <div>+ <TodayPaneGroupLabel first>Recently viewed</TodayPaneGroupLabel>+ {recents.map((recent) => (+ <TodayPaneRow+ key={recent.entry.id}+ value={`recent:${recent.entry.id}`}+ label={recent.name}+ icon={iconForType(recent.entry.type as FileSystemIconType)}+ to={recent.href}+ active={path === removeProjectIdIfPresent(recent.href)}+ dataAttr="today-views-recently-viewed"/>- ) : null- }- actions={- <>- {!recentSearchVisible && (- <Tooltip>- <TooltipTrigger- delay={0}- render={- <Button- size="icon-xs"- className="text-muted-foreground"- aria-label="Search views"- onClick={() => setRecentSearchOpen(true)}- data-attr="today-views-search-open"- />- }- >- <IconSearch />- </TooltipTrigger>- <TooltipContent>Search views</TooltipContent>- </Tooltip>- )}- <TodayViewsFilterMenu />- </>- }- >+ ))}+ </div>+ )}+ <div>+ <TodayPaneGroupLabel first={!recents.length}>Views</TodayPaneGroupLabel>+ {showAll && (+ <TodayPaneRow+ value="all"+ label="All views"+ icon={<IconGridMasonry />}+ to={urls.views()}+ active={path === urls.views()}+ dataAttr="today-views-all"+ />+ )}{!recentViews || (recentViewsLoading && !recentItems.length) ? (recentUnavailable ? (<div className="TodayPane__state">@@ -162,6 +142,7 @@ export function TodayViewsSidebar(): JSX.Element {return (<TodayPaneRowkey={`${item.type}-${item.id}`}+ value={`view:${item.type}-${item.id}`}label={item.name}icon={building ? <Spinner /> : <ViewTypeIcon type={item.type} />}meta={building ? 'Building' : shortTimeAgo(item.timestamp)}@@ -173,8 +154,8 @@ export function TodayViewsSidebar(): JSX.Element {})}</>)}- </TodayPaneSection>- </div>+ </div>+ </TodayPaneSearchList></div>)}diff --git a/frontend/src/layout/today/todayPaneSearch.ts b/frontend/src/layout/today/todayPaneSearch.tsnew file mode 100644index 000000000000..5b535ca86c14--- /dev/null+++ b/frontend/src/layout/today/todayPaneSearch.ts@@ -0,0 +1,4 @@+export function matchesPaneQuery(label: string, query: string): boolean {+ const needle = query.trim().toLowerCase()+ return needle === '' || label.toLowerCase().includes(needle)+}diff --git a/frontend/src/layout/today/todayRecentsLogic.ts b/frontend/src/layout/today/todayRecentsLogic.tsnew file mode 100644index 000000000000..d213af5104fa--- /dev/null+++ b/frontend/src/layout/today/todayRecentsLogic.ts@@ -0,0 +1,150 @@+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'+import { router } from 'kea-router'+import type { LocationChangedPayload } from 'kea-router/lib/types'++import { removeProjectIdIfPresent } from 'lib/utils/kea-router'+import { VIEW_FILE_SYSTEM_TYPES, baseObjectType, libraryObjectHref } from 'scenes/library/libraryUtils'+import { toolHrefForPath } from 'scenes/tools/toolsUtils'++import { splitPath, unescapePath } from '~/layout/panel-layout/ProjectTree/utils'+import { recentItemsModel } from '~/models/recentItemsModel'+import { FileSystemEntry } from '~/queries/schema/schema-general'++export const TODAY_RECENTS_LIMIT = 5++export interface TodayRecentEntry {+ entry: FileSystemEntry+ name: string+ href: string+}++function pushRecent(list: string[], value: string): string[] {+ return [value, ...list.filter((item) => item !== value)].slice(0, TODAY_RECENTS_LIMIT)+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface todayRecentsLogicValues {+ recents: FileSystemEntry[] // recentItemsModel+ recentSessionIds: string[]+ recentToolHrefs: string[]+ recentViewEntries: TodayRecentEntry[]+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface todayRecentsLogicActions {+ recordLocation: (+ pathname: string,+ searchParams: Record<string, any>+ ) => {+ pathname: string+ searchParams: Record<string, any>+ }+ recordSessionVisit: (sessionId: string) => {+ sessionId: string+ }+ recordToolVisit: (href: string) => {+ href: string+ }+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface todayRecentsLogicMeta {+ __keaTypeGenInternalSelectorTypes: {+ recentViewEntries: (recents: FileSystemEntry[]) => TodayRecentEntry[]+ }+ __keaTypeGenInternalReducerActions: {+ 'location changed (kea.router)': ({+ method,+ pathname,+ search,+ searchParams,+ hash,+ hashParams,+ initial,+ url,+ routerState,+ }: LocationChangedPayload) => {+ payload: {+ hash: string+ hashParams: Record<string, any>+ initial: boolean+ method: 'POP' | 'PUSH' | 'REPLACE'+ pathname: string+ routerState: Record<string, any>+ search: string+ searchParams: Record<string, any>+ url: string+ }+ type: 'location changed (kea.router)'+ }+ }+}++export type todayRecentsLogicType = MakeLogicType<+ todayRecentsLogicValues,+ todayRecentsLogicActions,+ Record<string, any>,+ todayRecentsLogicMeta+>++/**+ * What the sidebar panes list as recently viewed. Views reads the project's recently viewed objects.+ * Tools and sessions have no server record of views, so this browser keeps one as the user moves between pages.+ */+export const todayRecentsLogic = kea<todayRecentsLogicType>([+ path(['layout', 'today', 'todayRecentsLogic']),+ connect(() => ({ values: [recentItemsModel, ['recents']] })),+ actions({+ recordToolVisit: (href: string) => ({ href }),+ recordSessionVisit: (sessionId: string) => ({ sessionId }),+ recordLocation: (pathname: string, searchParams: Record<string, any>) => ({ pathname, searchParams }),+ }),+ reducers({+ // pinned: storage keys for persisted state. Renaming them clears everyone's recents.+ recentToolHrefs: [+ [] as string[],+ { persist: true },+ { recordToolVisit: (state, { href }) => pushRecent(state, href) },+ ],+ recentSessionIds: [+ [] as string[],+ { persist: true },+ { recordSessionVisit: (state, { sessionId }) => pushRecent(state, sessionId) },+ ],+ }),+ selectors({+ recentViewEntries: [+ (s) => [s.recents],+ (recents: FileSystemEntry[]): TodayRecentEntry[] =>+ recents+ .flatMap((entry) => {+ const href = VIEW_FILE_SYSTEM_TYPES.has(baseObjectType(entry.type))+ ? libraryObjectHref(entry)+ : null+ return href+ ? [{ entry, href, name: unescapePath(splitPath(entry.path).pop() ?? entry.path) }]+ : []+ })+ .slice(0, TODAY_RECENTS_LIMIT),+ ],+ }),+ listeners(({ actions }) => ({+ recordLocation: ({ pathname, searchParams }) => {+ const path = removeProjectIdIfPresent(pathname)+ const toolHref = toolHrefForPath(path)+ if (toolHref) {+ actions.recordToolVisit(toolHref)+ }+ if (path === '/ai' && typeof searchParams.task === 'string') {+ actions.recordSessionVisit(searchParams.task)+ }+ },+ [router.actionTypes.locationChanged]: ({ pathname, searchParams }: LocationChangedPayload) => {+ actions.recordLocation(pathname, searchParams)+ },+ })),+ afterMount(({ actions }) => {+ const { location, searchParams } = router.values+ actions.recordLocation(location.pathname, searchParams)+ }),+])diff --git a/frontend/src/layout/today/todaySessionIcon.test.ts b/frontend/src/layout/today/todaySessionIcon.test.tsdeleted file mode 100644index 89a3762b779a..000000000000--- a/frontend/src/layout/today/todaySessionIcon.test.ts+++ /dev/null@@ -1,37 +0,0 @@-import { TodaySessionIconKind, todaySessionIcon } from './todaySessionIcon'-import { TodayWorkItem } from './todayWorkItems'--const item = (kind: TodayWorkItem['kind'], status: string | null): TodayWorkItem => ({- kind,- id: 'id',- title: 'Title',- timestamp: null,- createdAt: null,- status,- channel: null,- createdById: null,- author: null,- latestRunId: null,- runEnvironment: null,- originProduct: null,- source: null,- repository: null,- branch: null,- pullRequests: [],- finalMessage: null,-})--describe('todaySessionIcon', () => {- it.each<[string, TodayWorkItem, boolean, TodaySessionIconKind]>([- ['a chat', item('chat', null), false, 'chat'],- ['a running session, even when pinned', item('session', 'in_progress'), true, 'running'],- ['a finished session, even when pinned', item('session', 'completed'), true, 'completed'],- ['a failed session', item('session', 'failed'), false, 'failed'],- ['a cancelled session', item('session', 'cancelled'), false, 'stopped'],- ['a pinned session with no run', item('session', null), true, 'pinned'],- ['a queued session', item('session', 'queued'), false, 'queued'],- ['a session with no run', item('session', null), false, 'session'],- ])('shows %s as %s', (_, workItem, pinned, expected) => {- expect(todaySessionIcon(workItem, pinned)).toBe(expected)- })-})diff --git a/frontend/src/layout/today/todaySessionIcon.ts b/frontend/src/layout/today/todaySessionIcon.tsdeleted file mode 100644index 0e4ce15430ef..000000000000--- a/frontend/src/layout/today/todaySessionIcon.ts+++ /dev/null@@ -1,36 +0,0 @@-import { TodayWorkItem } from './todayWorkItems'--export type TodaySessionIconKind =- | 'chat'- | 'running'- | 'queued'- | 'completed'- | 'failed'- | 'stopped'- | 'pinned'- | 'session'--const TERMINAL: Record<string, TodaySessionIconKind> = {- completed: 'completed',- failed: 'failed',- cancelled: 'stopped',-}--export function todaySessionIcon(item: TodayWorkItem, pinned: boolean): TodaySessionIconKind {- if (item.kind === 'chat') {- return 'chat'- }- if (item.status === 'in_progress') {- return 'running'- }- if (item.status && TERMINAL[item.status]) {- return TERMINAL[item.status]- }- if (pinned) {- return 'pinned'- }- if (item.status === 'queued' || item.status === 'not_started') {- return 'queued'- }- return 'session'-}diff --git a/frontend/src/layout/today/todayShellLogic.test.ts b/frontend/src/layout/today/todayShellLogic.test.tsindex a3de8c99e785..5941b35b1bed 100644--- a/frontend/src/layout/today/todayShellLogic.test.ts+++ b/frontend/src/layout/today/todayShellLogic.test.ts@@ -2,11 +2,12 @@ import { router } from 'kea-router'import { FEATURE_FLAGS } from 'lib/constants'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { removeProjectIdIfPresent } from 'lib/utils/kea-router'+import { toolHrefForPath } from 'scenes/tools/toolsUtils'import { initKeaTests } from '~/test/init'import { TODAY_RAIL_WIDTH, TODAY_SIDEBAR_MAX_WIDTH, railPaneForPath, todayShellLogic } from './todayShellLogic'-import { toolHrefForPath } from './todayToolsLogic'describe('todayShellLogic', () => {beforeEach(() => {@@ -47,6 +48,22 @@ describe('todayShellLogic', () => {expect(toolHrefForPath(path, tools)).toBe(href)})+ test.each([+ ['home', '/home'],+ ['spaces', '/ai'],+ ['views', '/views/new'],+ ['library', '/library'],+ ['tools', '/tools'],+ ] as const)('opens the %s section when its rail item is picked', (pane, pathname) => {+ const logic = todayShellLogic()+ logic.mount()++ router.actions.push('/project/1/airplane')+ logic.actions.pickPane(pane)+ expect(removeProjectIdIfPresent(router.values.location.pathname)).toBe(pathname)+ expect(logic.values.activePane).toBe(pane)+ })+it('keeps the last pane open on pages that belong to no pane', () => {const logic = todayShellLogic()logic.mount()diff --git a/frontend/src/layout/today/todayShellLogic.ts b/frontend/src/layout/today/todayShellLogic.tsindex 7af5ebf1a460..31d68cd4cdc7 100644--- a/frontend/src/layout/today/todayShellLogic.ts+++ b/frontend/src/layout/today/todayShellLogic.ts@@ -8,15 +8,14 @@ import { FEATURE_FLAGS } from 'lib/constants'import { FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'import { removeProjectIdIfPresent } from 'lib/utils/kea-router'import { libraryTypeForPath } from 'scenes/library/libraryUtils'+import { toolHrefForPath } from 'scenes/tools/toolsUtils'import { urls } from 'scenes/urls'import { navigationLogic } from '~/layout/navigation/navigationLogic'-import { toolHrefForPath } from './todayToolsLogic'-export type TodayRailPane = 'home' | 'spaces' | 'views' | 'library' | 'tools'-export const TODAY_RAIL_WIDTH = 56+export const TODAY_RAIL_WIDTH = 60export const TODAY_SIDEBAR_DEFAULT_WIDTH: number = 312export const TODAY_SIDEBAR_MIN_WIDTH = 240export const TODAY_SIDEBAR_MAX_WIDTH = 480@@ -34,6 +33,14 @@ 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.ai(),+ views: () => urls.viewsNew(),+ library: () => urls.library(),+ tools: () => urls.tools(),+}+/** The pane a route belongs to, or null for pages that keep whichever pane was open. */export function railPaneForPath(pathname: string): TodayRailPane | null {const path = removeProjectIdIfPresent(pathname)@@ -54,7 +61,7 @@ export function railPaneForPath(pathname: string): TodayRailPane | null {if (isUnder(path, urls.library()) || libraryTypeForPath(path)) {return 'library'}- if (toolHrefForPath(path)) {+ if (isUnder(path, urls.tools()) || toolHrefForPath(path)) {return 'tools'}return null@@ -226,15 +233,7 @@ export const todayShellLogic = kea<todayShellLogicType>([pickPane: ({ pane }) => {// pinned: analytics event name and property. Renaming them breaks dashboards.posthog.capture('today rail pane picked', { pane })- if (pane === 'home' && values.routePane !== 'home') {- router.actions.push(urls.projectHomepage())- }- if (pane === 'views' && values.routePane !== 'views') {- router.actions.push(urls.views())- }- if (pane === 'library' && values.routePane !== 'library') {- router.actions.push(urls.library())- }+ router.actions.push(RAIL_PANE_HOME[pane]())if (values.mobileLayout) {actions.setMobileSidebarOpen(true)} else {diff --git a/frontend/src/layout/today/todaySpacesLogic.ts b/frontend/src/layout/today/todaySpacesLogic.tsindex a96a5df72523..3cac516b2317 100644--- a/frontend/src/layout/today/todaySpacesLogic.ts+++ b/frontend/src/layout/today/todaySpacesLogic.ts@@ -37,6 +37,7 @@ import {} from 'products/tasks/frontend/spaces/spacePresence'import { pullRequestStates, sessionIdsWithPullRequests } from 'products/tasks/frontend/spaces/taskPullRequests'+import { matchesPaneQuery } from './todayPaneSearch'import { TodaySpacePreview, spacePreview } from './todayPreviewCards'import {DEFAULT_RECENT_FILTERS,@@ -55,6 +56,7 @@ import {groupRecentItems,sortRecentItems,} from './todayRecentOrder'+import { todayRecentsLogic } from './todayRecentsLogic'import {TodayWorkItem,buildRecentItems,@@ -130,6 +132,7 @@ export interface todaySpacesLogicValues {conversationHistory: ConversationDetail[] // maxGlobalLogicconversationHistoryLoading: boolean // maxGlobalLogiccurrentTeamId: number | null // teamLogic+ recentSessionIds: string[] // todayRecentsLogicuser: UserType | null // userLogicallRecentItems: TodayWorkItem[]collapsedSections: TodayWorkSectionId[]@@ -146,14 +149,15 @@ export interface todaySpacesLogicValues {recentItems: TodayWorkItem[]recentLoading: booleanrecentQuery: string- recentSearchOpen: boolean- recentSearchVisible: booleanrecentSort: TodayRecentSortrecentSourceOptions: string[]recentTasks: TaskListItemApi[]recentTasksLoading: booleanrecentTasksUnavailable: boolean+ recentlyViewedSessions: TodayWorkItem[]sectionHeights: Partial<Record<TodayWorkSectionId, number>>+ shownPinnedItems: TodayWorkItem[]+ shownSpaces: ChannelDTOApi[]sortedSpaces: ChannelDTOApi[]spaceActivity: SpaceActivityspaceActivityLoading: boolean@@ -317,9 +321,6 @@ export interface todaySpacesLogicActions {setRecentQuery: (query: string) => {query: string}- setRecentSearchOpen: (open: boolean) => {- open: boolean- }setRecentSort: (sort: TodayRecentSort) => {sort: TodayRecentSort}@@ -357,7 +358,13 @@ export interface todaySpacesLogicMeta {) => TodayWorkItem[]recentFilters: (storedRecentFilters: Partial<TodayRecentFilters>) => TodayRecentFiltersrecentSourceOptions: (allRecentItems: TodayWorkItem[], recentFilters: TodayRecentFilters) => string[]- recentSearchVisible: (recentSearchOpen: boolean, recentQuery: string) => boolean+ shownPinnedItems: (pinnedItems: TodayWorkItem[], recentQuery: string) => TodayWorkItem[]+ shownSpaces: (visibleSpaces: ChannelDTOApi[], recentQuery: string) => ChannelDTOApi[]+ recentlyViewedSessions: (+ recentSessionIds: string[],+ allRecentItems: TodayWorkItem[],+ recentQuery: string+ ) => TodayWorkItem[]recentFiltersActive: (recentFilters: TodayRecentFilters) => booleanunreadSessionIds: (taskActivity: TaskActivityDTOApi[]) => Set<string>recentItems: (@@ -405,6 +412,8 @@ export const todaySpacesLogic = kea<todaySpacesLogicType>([['user'],maxGlobalLogic,['conversationHistory', 'conversationHistoryLoading'],+ todayRecentsLogic,+ ['recentSessionIds'],],actions: [router, ['locationChanged']],})),@@ -414,7 +423,6 @@ export const todaySpacesLogic = kea<todaySpacesLogicType>([resetSectionPair: (upper: TodayWorkSectionId, lower: TodayWorkSectionId) => ({ upper, lower }),spaceVisited: (spaceId: string) => ({ spaceId }),setRecentQuery: (query: string) => ({ query }),- setRecentSearchOpen: (open: boolean) => ({ open }),setRecentFilters: (filters: TodayRecentFilters) => ({ filters }),clearRecentFilters: true,clearRecentSearchAndFilters: true,@@ -537,10 +545,6 @@ export const todaySpacesLogic = kea<todaySpacesLogicType>([// A generic New session files here, like PostHog Desktop's scoped space. A stale id falls back to personal.lastSpaceId: [null as string | null, { persist: true }, { spaceVisited: (_, { spaceId }) => spaceId }],recentQuery: ['', { setRecentQuery: (_, { query }) => query, clearRecentSearchAndFilters: () => '' }],- recentSearchOpen: [- false,- { setRecentSearchOpen: (_, { open }) => open, clearRecentSearchAndFilters: () => false },- ],storedRecentFilters: [DEFAULT_RECENT_FILTERS as Partial<TodayRecentFilters>,// pinned: localStorage key. A new key resets every person's saved Recent filters.@@ -612,9 +616,24 @@ export const todaySpacesLogic = kea<todaySpacesLogicType>([(allRecentItems: TodayWorkItem[], recentFilters: TodayRecentFilters): string[] =>recentSourceOptions(allRecentItems, recentFilters.sources),],- recentSearchVisible: [- (s) => [s.recentSearchOpen, s.recentQuery],- (recentSearchOpen: boolean, recentQuery: string): boolean => recentSearchOpen || recentQuery !== '',+ // The pane's search filters every group, so these match on the same terms as the Recent list.+ shownPinnedItems: [+ (s) => [s.pinnedItems, s.recentQuery],+ (pinnedItems: TodayWorkItem[], recentQuery: string): TodayWorkItem[] =>+ pinnedItems.filter((item) => matchesPaneQuery(item.title || '', recentQuery)),+ ],+ shownSpaces: [+ (s) => [s.visibleSpaces, s.recentQuery],+ (visibleSpaces: ChannelDTOApi[], recentQuery: string): ChannelDTOApi[] =>+ visibleSpaces.filter((space) => matchesPaneQuery(spaceLabel(space), recentQuery)),+ ],+ // A session outside the loaded Recent list has no title or status to show, so it waits until it loads.+ recentlyViewedSessions: [+ (s) => [s.recentSessionIds, s.allRecentItems, s.recentQuery],+ (recentSessionIds: string[], allRecentItems: TodayWorkItem[], recentQuery: string): TodayWorkItem[] =>+ recentSessionIds+ .flatMap((id) => allRecentItems.find((item) => item.kind === 'session' && item.id === id) ?? [])+ .filter((item) => matchesPaneQuery(item.title || '', recentQuery)),],recentFiltersActive: [(s) => [s.recentFilters],diff --git a/frontend/src/layout/today/todayToolsLogic.ts b/frontend/src/layout/today/todayToolsLogic.tsindex 0975a6195dbf..4225676ffaf0 100644--- a/frontend/src/layout/today/todayToolsLogic.ts+++ b/frontend/src/layout/today/todayToolsLogic.ts@@ -1,56 +1,19 @@import { MakeLogicType, actions, connect, kea, path, reducers, selectors } from 'kea'-import { FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'-import { getProductAccessDisabledReason } from 'lib/utils/accessControlUtils'-import { TOOL_FILE_SYSTEM_TYPES } from 'scenes/library/libraryUtils'+import { toolsLogic } from 'scenes/tools/toolsLogic'+import { ToolGroup, groupTools, toolMatchesSearch } from 'scenes/tools/toolsUtils'-import { fileSystemTypes, getTreeItemsMetadata, getTreeItemsProducts } from '~/products'import { FileSystemImport } from '~/queries/schema/schema-general'-export interface ToolGroup {- category: string- tools: FileSystemImport[]-}--// Workspaces for building queries come first, apart from the product pages.-const PINNED_TOOL_ICONS = ['sql_editor']-export const PINNED_TOOLS_CATEGORY = 'Workspace'--export function toolLabel(tool: FileSystemImport): string {- return tool.displayLabel || tool.path-}--// Saved object types live in Library, except the ones that are working pages.-function isToolItem(item: FileSystemImport): boolean {- const type = item.type?.split('/')[0] || item.iconType || ''- return !!item.href && !(type in fileSystemTypes && !TOOL_FILE_SYSTEM_TYPES.has(type))-}--export function toolHrefForPath(- path: string,- tools: Pick<FileSystemImport, 'href'>[] = [...getTreeItemsProducts(), ...getTreeItemsMetadata()].filter(isToolItem)-): string | null {- let match: { href: string; toolPath: string } | null = null- for (const { href } of tools) {- const toolPath = href?.split(/[?#]/)[0]- if (- href &&- toolPath &&- (path === toolPath || path.startsWith(`${toolPath}/`)) &&- (!match || toolPath.length > match.toolPath.length)- ) {- match = { href, toolPath }- }- }- return match?.href ?? null-}+import { todayRecentsLogic } from './todayRecentsLogic'// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface todayToolsLogicValues {- featureFlags: FeatureFlagsSet // featureFlagLogic+ recentToolHrefs: string[] // todayRecentsLogic+ tools: FileSystemImport[] // toolsLogic+ recentTools: FileSystemImport[]search: stringtoolGroups: ToolGroup[]- tools: FileSystemImport[]}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -63,8 +26,8 @@ export interface todayToolsLogicActions {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface todayToolsLogicMeta {__keaTypeGenInternalSelectorTypes: {- tools: (featureFlags: FeatureFlagsSet) => FileSystemImport[]toolGroups: (tools: FileSystemImport[], search: string) => ToolGroup[]+ recentTools: (recentToolHrefs: string[], tools: FileSystemImport[], search: string) => FileSystemImport[]}}@@ -77,53 +40,20 @@ export type todayToolsLogicType = MakeLogicType<export const todayToolsLogic = kea<todayToolsLogicType>([path(['layout', 'today', 'todayToolsLogic']),- connect(() => ({ values: [featureFlagLogic, ['featureFlags']] })),+ connect(() => ({ values: [toolsLogic, ['tools'], todayRecentsLogic, ['recentToolHrefs']] })),actions({ setSearch: (search: string) => ({ search }) }),reducers({ search: ['', { setSearch: (_, { search }) => search }] }),selectors({- tools: [- (s) => [s.featureFlags],- (featureFlags: FeatureFlagsSet): FileSystemImport[] => {- const seen = new Set<string>()- return [...getTreeItemsProducts(), ...getTreeItemsMetadata()]- .filter((item) => {- if (- !item.href ||- !isToolItem(item) ||- seen.has(item.href) ||- (item.flag && !featureFlags[item.flag as keyof FeatureFlagsSet]) ||- getProductAccessDisabledReason(item)- ) {- return false- }- seen.add(item.href)- return true- })- .sort((first, second) => toolLabel(first).localeCompare(toolLabel(second)))- },- ],toolGroups: [(s) => [s.tools, s.search],- (tools: FileSystemImport[], search: string): ToolGroup[] => {- const query = search.trim().toLowerCase()- const groups = new Map<string, FileSystemImport[]>()- for (const tool of tools) {- const pinned = PINNED_TOOL_ICONS.includes(tool.iconType ?? '')- const category = pinned ? PINNED_TOOLS_CATEGORY : tool.category || 'Other'- if (query && !`${toolLabel(tool)} ${category}`.toLowerCase().includes(query)) {- continue- }- groups.set(category, [...(groups.get(category) ?? []), tool])- }- return [...groups.entries()]- .map(([category, groupTools]) => ({ category, tools: groupTools }))- .sort(- (first, second) =>- Number(second.category === PINNED_TOOLS_CATEGORY) -- Number(first.category === PINNED_TOOLS_CATEGORY) ||- first.category.localeCompare(second.category)- )- },+ (tools: FileSystemImport[], search: string): ToolGroup[] => groupTools(tools, search),+ ],+ recentTools: [+ (s) => [s.recentToolHrefs, s.tools, s.search],+ (hrefs: string[], tools: FileSystemImport[], search: string): FileSystemImport[] =>+ hrefs+ .flatMap((href) => tools.find((tool) => tool.href === href) ?? [])+ .filter((tool) => toolMatchesSearch(tool, search)),],}),])diff --git a/frontend/src/layout/today/todayViewsLogic.ts b/frontend/src/layout/today/todayViewsLogic.tsindex 4debef916ca6..736455174111 100644--- a/frontend/src/layout/today/todayViewsLogic.ts+++ b/frontend/src/layout/today/todayViewsLogic.ts@@ -13,6 +13,8 @@ import type { UserType } from '~/types'import { canvasesRetrieve } from 'products/canvas/frontend/generated/api'import { tasksRetrieve } from 'products/tasks/frontend/generated/api'+import { matchesPaneQuery } from './todayPaneSearch'+import { TodayRecentEntry, todayRecentsLogic } from './todayRecentsLogic'import { railPaneForPath } from './todayShellLogic'import { DEFAULT_VIEWS_FILTERS, TodayViewsFilters, filterRecentViews, viewsFiltersActive } from './todayViewsFilters'@@ -31,21 +33,20 @@ export interface FirstBuildState {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface todayViewsLogicValues {currentTeamId: number | null // teamLogic+ recentViewEntries: TodayRecentEntry[] // todayRecentsLogicuser: UserType | null // userLogicbuildingViewIds: string[]firstBuilds: Record<string, FirstBuildState>firstBuildsLoading: booleanopenCanvasBuilding: Record<string, boolean>- recentCollapsed: booleanrecentFilters: TodayViewsFiltersrecentFiltersActive: booleanrecentItems: ViewItem[]recentQuery: string- recentSearchOpen: boolean- recentSearchVisible: booleanrecentUnavailable: booleanrecentViews: ViewItemsPage | nullrecentViewsLoading: boolean+ recentlyViewed: TodayRecentEntry[]}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -103,19 +104,13 @@ export interface todayViewsLogicActions {setRecentQuery: (query: string) => {query: string}- setRecentSearchOpen: (open: boolean) => {- open: boolean- }- toggleRecent: () => {- value: true- }}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface todayViewsLogicMeta {__keaTypeGenInternalSelectorTypes: {+ recentlyViewed: (recentViewEntries: TodayRecentEntry[], recentQuery: string) => TodayRecentEntry[]recentFiltersActive: (recentFilters: TodayViewsFilters) => boolean- recentSearchVisible: (recentSearchOpen: boolean, recentQuery: string) => booleanrecentItems: (recentViews: ViewItemsPage | null,recentQuery: string,@@ -165,12 +160,12 @@ export type todayViewsLogicType = MakeLogicType<export const todayViewsLogic = kea<todayViewsLogicType>([path(['layout', 'today', 'todayViewsLogic']),- connect(() => ({ values: [teamLogic, ['currentTeamId'], userLogic, ['user']] })),+ connect(() => ({+ values: [teamLogic, ['currentTeamId'], userLogic, ['user'], todayRecentsLogic, ['recentViewEntries']],+ })),actions({receiveRecentViews: (page: ViewItemsPage) => ({ page }),- toggleRecent: true,setRecentQuery: (query: string) => ({ query }),- setRecentSearchOpen: (open: boolean) => ({ open }),setRecentFilters: (filters: TodayViewsFilters) => ({ filters }),clearRecentSearchAndFilters: true,/** The open canvas reports whether its agent or a build is at work, which it knows exactly. Null when it closes. */@@ -234,13 +229,8 @@ export const todayViewsLogic = kea<todayViewsLogicType>([recentViews: {receiveRecentViews: (_, { page }) => page,},- recentCollapsed: [false, { persist: true }, { toggleRecent: (state) => !state }],recentUnavailable: [false, { loadRecentViews: () => false, loadRecentViewsFailure: () => true }],recentQuery: ['', { setRecentQuery: (_, { query }) => query, clearRecentSearchAndFilters: () => '' }],- recentSearchOpen: [- false,- { setRecentSearchOpen: (_, { open }) => open, clearRecentSearchAndFilters: () => false },- ],recentFilters: [DEFAULT_VIEWS_FILTERS,{ persist: true },@@ -260,14 +250,15 @@ export const todayViewsLogic = kea<todayViewsLogicType>([],}),selectors({+ recentlyViewed: [+ (s) => [s.recentViewEntries, s.recentQuery],+ (recentViewEntries: TodayRecentEntry[], recentQuery: string): TodayRecentEntry[] =>+ recentViewEntries.filter((recent) => matchesPaneQuery(recent.name, recentQuery)),+ ],recentFiltersActive: [(s) => [s.recentFilters],(recentFilters: TodayViewsFilters): boolean => viewsFiltersActive(recentFilters),],- recentSearchVisible: [- (s) => [s.recentSearchOpen, s.recentQuery],- (recentSearchOpen: boolean, recentQuery: string): boolean => recentSearchOpen || recentQuery !== '',- ],recentItems: [(s) => [s.recentViews, s.recentQuery, s.recentFilters, s.user],// The items arrive newest first across every type. A search or filter looks past the first few.diff --git a/frontend/src/layout/today/todayWorkItems.ts b/frontend/src/layout/today/todayWorkItems.tsindex aa3bf01863b0..42cbc1cf37cc 100644--- a/frontend/src/layout/today/todayWorkItems.ts+++ b/frontend/src/layout/today/todayWorkItems.ts@@ -123,6 +123,13 @@ function finalMessage(output: TaskRunDetailDTOApi['output'] | undefined): stringreturn typeof message === 'string' && message.trim() ? message.trim() : null}+/** What the session icon reads, from a task's latest run, for a page that has the task but not its work item. */+export function sessionIconFields(+ latestRun: { status?: string | null; environment?: string | null } | null | undefined+): Pick<TodayWorkItem, 'kind' | 'status' | 'runEnvironment'> {+ return { kind: 'session', status: latestRun?.status ?? null, runEnvironment: latestRun?.environment ?? null }+}+export function sessionItem(task: TaskListItemApi): TodayWorkItem {return {kind: 'session',diff --git a/frontend/src/scenes/appScenes.ts b/frontend/src/scenes/appScenes.tsindex 02539c342e7d..220ef322d207 100644--- a/frontend/src/scenes/appScenes.ts+++ b/frontend/src/scenes/appScenes.ts@@ -79,6 +79,8 @@ export const appScenes: Record<Scene | string, () => any> = {[Scene.ProjectHomepage]: () => import('./project-homepage/ProjectHomepage'),[Scene.Library]: () => import('./library/Library'),[Scene.Views]: () => import('./views/Views'),+ [Scene.ViewsNew]: () => import('./views/NewView'),+ [Scene.Tools]: () => import('./tools/Tools'),[Scene.PropertyDefinitionEdit]: () => import('./data-management/definition/DefinitionEdit'),[Scene.PropertyDefinition]: () => import('./data-management/definition/DefinitionView'),[Scene.SqlVariableEdit]: () => import('./data-management/variables/SqlVariableEditScene'),diff --git a/frontend/src/scenes/data-warehouse/editor/QueryWindow.tsx b/frontend/src/scenes/data-warehouse/editor/QueryWindow.tsxindex 8857994ea33c..f5cf9fec05a0 100644--- a/frontend/src/scenes/data-warehouse/editor/QueryWindow.tsx+++ b/frontend/src/scenes/data-warehouse/editor/QueryWindow.tsx@@ -24,7 +24,7 @@ import { SQLEditorMode } from 'scenes/data-warehouse/editor/sqlEditorModes'import { Scene } from 'scenes/sceneTypes'import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'-import { SceneTitlePanelButton } from '~/layout/scenes/components/SceneTitleSection'+import { SceneTitlePanelButton } from '~/layout/scenes/components/SceneTitlePanelButton'import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'import { ProductKey } from '~/queries/schema/schema-general'import { AccessControlLevel, AccessControlResourceType } from '~/types'diff --git a/frontend/src/scenes/project-homepage/today/Today.scss b/frontend/src/scenes/project-homepage/today/Today.scssindex 6cf7207083cd..1a6f01e80f7d 100644--- a/frontend/src/scenes/project-homepage/today/Today.scss+++ b/frontend/src/scenes/project-homepage/today/Today.scss@@ -135,7 +135,6 @@&[data-active='true'] {background: var(--today-soft);- transform: translateX(3px);.TodayNavItem__marker {color: #fff;@@ -213,41 +212,6 @@color: var(--today-faint);}-// Shared sidebar footer--.TodaySidebarFooter {- display: grid;- flex: none;- grid-template-columns: minmax(0, 1fr) auto;- gap: 4px;- align-items: center;- padding: 7px 0 16px;- margin: 0 12px;- border-top: 1px solid var(--today-line);-}--.TodaySidebarFooter__account,-.TodaySidebarFooter__settings {- color: var(--today-secondary-text);-- &:hover,- &[data-popup-open] {- color: var(--today-ink);- }-}--.TodaySidebarFooter__account {- min-width: 0;- padding-inline: 6px 8px;-}--.TodaySidebarFooter__name {- min-width: 0;- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;-}-// Home.TodayHome,diff --git a/frontend/src/scenes/project-homepage/today/Today.stories.tsx b/frontend/src/scenes/project-homepage/today/Today.stories.tsxindex 97e99946b4e6..f0aa68bc449d 100644--- a/frontend/src/scenes/project-homepage/today/Today.stories.tsx+++ b/frontend/src/scenes/project-homepage/today/Today.stories.tsx@@ -1052,6 +1052,7 @@ export const ViewsEmpty: Story = {export const ViewsNewMenu: Story = {parameters: { pageUrl: urls.views() },play: async ({ canvasElement }) => {- await userEvent.click(await within(canvasElement).findByText('New…'))+ const [newView] = await within(canvasElement).findAllByText('New view')+ await userEvent.click(newView)},}diff --git a/frontend/src/scenes/project-homepage/today/TodayHomeSidebar.tsx b/frontend/src/scenes/project-homepage/today/TodayHomeSidebar.tsxindex edd3c8fe6c84..c91c11a29712 100644--- a/frontend/src/scenes/project-homepage/today/TodayHomeSidebar.tsx+++ b/frontend/src/scenes/project-homepage/today/TodayHomeSidebar.tsx@@ -95,7 +95,6 @@ export function TodayHomeSidebar(): JSX.Element {New session</Button><div className="TodayPane__scroll">- <div className="TodayPane__heading Today__label">Today</div><div className="TodaySidebar__list"><TodayNavItemtitle="Home"diff --git a/frontend/src/scenes/sceneTypes.ts b/frontend/src/scenes/sceneTypes.tsindex 5f1fcfb2f34e..4bda534d61ef 100644--- a/frontend/src/scenes/sceneTypes.ts+++ b/frontend/src/scenes/sceneTypes.ts@@ -105,6 +105,8 @@ export enum Scene {LegalDocumentNew = 'LegalDocumentNew',Library = 'Library',Views = 'Views',+ ViewsNew = 'ViewsNew',+ Tools = 'Tools',Link = 'Link',Links = 'Links',LiveDebugger = 'LiveDebugger',diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.tsindex 91653031c70b..2ed46805db76 100644--- a/frontend/src/scenes/scenes.ts+++ b/frontend/src/scenes/scenes.ts@@ -340,6 +340,14 @@ export const sceneConfigurations: Record<Scene | string, SceneConfig> = {projectBased: true,name: 'Views',},+ [Scene.ViewsNew]: {+ projectBased: true,+ name: 'New view',+ },+ [Scene.Tools]: {+ projectBased: true,+ name: 'Tools',+ },[Scene.PropertyDefinitionEdit]: {projectBased: true,name: 'Data management',@@ -844,6 +852,8 @@ export const routes: Record<string, [Scene | string, string]> = {[urls.library()]: [Scene.Library, 'library'],[urls.library(':objectType')]: [Scene.Library, 'libraryObjectType'],[urls.views()]: [Scene.Views, 'views'],+ [urls.viewsNew()]: [Scene.ViewsNew, 'viewsNew'],+ [urls.tools()]: [Scene.Tools, 'tools'],[urls.aiHistory()]: [Scene.Max, 'maxHistory'],[urls.ai()]: [Scene.Max, 'max'],[urls.projectCreateFirst()]: [Scene.ProjectCreateFirst, 'projectCreateFirst'],diff --git a/frontend/src/scenes/tools/Tools.tsx b/frontend/src/scenes/tools/Tools.tsxnew file mode 100644index 000000000000..d897ae7c7741--- /dev/null+++ b/frontend/src/scenes/tools/Tools.tsx@@ -0,0 +1,95 @@+import { useActions, useValues } from 'kea'++import { IconSearch, IconWrench } from '@posthog/icons'+import {+ InputGroup,+ InputGroupAddon,+ InputGroupInput,+ Item,+ ItemContent,+ ItemGroup,+ ItemMedia,+ ItemTitle,+ Text,+} from '@posthog/quill'++import { LinkPrimitive } from 'lib/lemon-ui/Link'+import { SceneExport } from 'scenes/sceneTypes'++import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'+import { SceneContent } from '~/layout/scenes/components/SceneContent'+import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'+import { FileSystemIconType } from '~/queries/schema/schema-general'++import { toolsLogic } from './toolsLogic'+import { toolLabel } from './toolsUtils'++export const scene: SceneExport = {+ component: Tools,+ logic: toolsLogic,+}++export function Tools(): JSX.Element {+ const { toolGroups: groups, search } = useValues(toolsLogic)+ const { setSearch } = useActions(toolsLogic)++ return (+ <SceneContent>+ <SceneTitleSection+ name="Tools"+ description="Working pages for querying, building and running your product."+ resourceType={{ type: 'tools', forceIcon: <IconWrench /> }}+ />+ <div data-quill className="@container/tools flex flex-col gap-4">+ <InputGroup className="max-w-120">+ <InputGroupAddon>+ <IconSearch />+ </InputGroupAddon>+ <InputGroupInput+ type="search"+ aria-label="Search tools"+ placeholder="Search tools"+ value={search}+ onChange={(event: React.ChangeEvent<HTMLInputElement>) => setSearch(event.target.value)}+ data-attr="tools-search"+ />+ </InputGroup>+ {!groups.length ? (+ <Text size="sm" variant="muted">+ No tools match that search.+ </Text>+ ) : (+ groups.map((group) => (+ <section key={group.category} className="flex flex-col gap-2">+ <Text size="xs" weight="medium" variant="muted" render={<h2 />} className="m-0">+ {group.category}+ </Text>+ <ItemGroup className="grid gap-2 @xl/tools:grid-cols-2 @4xl/tools:grid-cols-3">+ {group.tools.map((tool) => (+ <Item+ key={tool.href}+ variant="outline"+ size="sm"+ // The app styles every link in its accent color. A whole-row link reads as a row, so it keeps the text color.+ className="text-foreground hover:bg-fill-hover hover:text-foreground"+ render={<LinkPrimitive to={tool.href ?? ''} data-attr="tools-page-tool" />}+ >+ <ItemMedia variant="icon" aria-hidden>+ {iconForType(+ (tool.iconType ?? tool.type) as FileSystemIconType,+ tool.iconColor+ )}+ </ItemMedia>+ <ItemContent className="min-w-0">+ <ItemTitle className="truncate">{toolLabel(tool)}</ItemTitle>+ </ItemContent>+ </Item>+ ))}+ </ItemGroup>+ </section>+ ))+ )}+ </div>+ </SceneContent>+ )+}diff --git a/frontend/src/scenes/tools/toolsLogic.ts b/frontend/src/scenes/tools/toolsLogic.tsnew file mode 100644index 000000000000..bf9b5e005e92--- /dev/null+++ b/frontend/src/scenes/tools/toolsLogic.ts@@ -0,0 +1,68 @@+import { MakeLogicType, actions, connect, kea, path, reducers, selectors } from 'kea'++import { FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { getProductAccessDisabledReason } from 'lib/utils/accessControlUtils'++import { getTreeItemsMetadata, getTreeItemsProducts } from '~/products'+import { FileSystemImport } from '~/queries/schema/schema-general'++import { ToolGroup, groupTools, isToolItem, toolLabel } from './toolsUtils'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface toolsLogicValues {+ featureFlags: FeatureFlagsSet // featureFlagLogic+ search: string+ toolGroups: ToolGroup[]+ tools: FileSystemImport[]+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface toolsLogicActions {+ setSearch: (search: string) => {+ search: string+ }+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface toolsLogicMeta {+ __keaTypeGenInternalSelectorTypes: {+ tools: (featureFlags: FeatureFlagsSet) => FileSystemImport[]+ toolGroups: (tools: FileSystemImport[], search: string) => ToolGroup[]+ }+}++export type toolsLogicType = MakeLogicType<toolsLogicValues, toolsLogicActions, Record<string, any>, toolsLogicMeta>++export const toolsLogic = kea<toolsLogicType>([+ path(['scenes', 'tools', 'toolsLogic']),+ connect(() => ({ values: [featureFlagLogic, ['featureFlags']] })),+ actions({ setSearch: (search: string) => ({ search }) }),+ reducers({ search: ['', { setSearch: (_, { search }) => search }] }),+ selectors({+ tools: [+ (s) => [s.featureFlags],+ (featureFlags: FeatureFlagsSet): FileSystemImport[] => {+ const seen = new Set<string>()+ return [...getTreeItemsProducts(), ...getTreeItemsMetadata()]+ .filter((item) => {+ if (+ !item.href ||+ !isToolItem(item) ||+ seen.has(item.href) ||+ (item.flag && !featureFlags[item.flag as keyof FeatureFlagsSet]) ||+ getProductAccessDisabledReason(item)+ ) {+ return false+ }+ seen.add(item.href)+ return true+ })+ .sort((first, second) => toolLabel(first).localeCompare(toolLabel(second)))+ },+ ],+ toolGroups: [+ (s) => [s.tools, s.search],+ (tools: FileSystemImport[], search: string): ToolGroup[] => groupTools(tools, search),+ ],+ }),+])diff --git a/frontend/src/scenes/tools/toolsUtils.ts b/frontend/src/scenes/tools/toolsUtils.tsnew file mode 100644index 000000000000..2c55499755b2--- /dev/null+++ b/frontend/src/scenes/tools/toolsUtils.ts@@ -0,0 +1,68 @@+import { TOOL_FILE_SYSTEM_TYPES } from 'scenes/library/libraryUtils'++import { fileSystemTypes, getTreeItemsMetadata, getTreeItemsProducts } from '~/products'+import { FileSystemImport } from '~/queries/schema/schema-general'++export interface ToolGroup {+ category: string+ tools: FileSystemImport[]+}++// Workspaces for building queries come first, apart from the product pages.+const PINNED_TOOL_ICONS = ['sql_editor']+export const PINNED_TOOLS_CATEGORY = 'Workspace'++export function toolLabel(tool: FileSystemImport): string {+ return tool.displayLabel || tool.path+}++export function toolCategory(tool: FileSystemImport): string {+ return PINNED_TOOL_ICONS.includes(tool.iconType ?? '') ? PINNED_TOOLS_CATEGORY : tool.category || 'Other'+}++export function toolMatchesSearch(tool: FileSystemImport, search: string): boolean {+ const query = search.trim().toLowerCase()+ return !query || `${toolLabel(tool)} ${toolCategory(tool)}`.toLowerCase().includes(query)+}++// Saved object types live in Library, except the ones that are working pages.+export function isToolItem(item: FileSystemImport): boolean {+ const type = item.type?.split('/')[0] || item.iconType || ''+ return !!item.href && !(type in fileSystemTypes && !TOOL_FILE_SYSTEM_TYPES.has(type))+}++export function toolHrefForPath(+ path: string,+ tools: Pick<FileSystemImport, 'href'>[] = [...getTreeItemsProducts(), ...getTreeItemsMetadata()].filter(isToolItem)+): string | null {+ let match: { href: string; toolPath: string } | null = null+ for (const { href } of tools) {+ const toolPath = href?.split(/[?#]/)[0]+ if (+ href &&+ toolPath &&+ (path === toolPath || path.startsWith(`${toolPath}/`)) &&+ (!match || toolPath.length > match.toolPath.length)+ ) {+ match = { href, toolPath }+ }+ }+ return match?.href ?? null+}++export function groupTools(tools: FileSystemImport[], search: string): ToolGroup[] {+ const groups = new Map<string, FileSystemImport[]>()+ for (const tool of tools) {+ if (toolMatchesSearch(tool, search)) {+ const category = toolCategory(tool)+ groups.set(category, [...(groups.get(category) ?? []), tool])+ }+ }+ return [...groups.entries()]+ .map(([category, groupTools]) => ({ category, tools: groupTools }))+ .sort(+ (first, second) =>+ Number(second.category === PINNED_TOOLS_CATEGORY) - Number(first.category === PINNED_TOOLS_CATEGORY) ||+ first.category.localeCompare(second.category)+ )+}diff --git a/frontend/src/scenes/urls.ts b/frontend/src/scenes/urls.tsindex 47afac71f127..96475b303a16 100644--- a/frontend/src/scenes/urls.ts+++ b/frontend/src/scenes/urls.ts@@ -173,6 +173,8 @@ export const urls = {todayReport: (reportId: string): string => `/home/reports/${reportId}`,library: (objectType?: string): string => (objectType ? `/library/${objectType}` : '/library'),views: (): string => '/views',+ viewsNew: (): string => '/views/new',+ tools: (): string => '/tools',ai: (chat?: string, ask?: string): string => combineUrl('/ai', { ask, chat }).url,aiTask: (taskId: string): string => combineUrl('/ai', { task: taskId }).url,aiHistory: (): string => '/ai/history',diff --git a/frontend/src/scenes/views/NewView.tsx b/frontend/src/scenes/views/NewView.tsxnew file mode 100644index 000000000000..94dc55049a7e--- /dev/null+++ b/frontend/src/scenes/views/NewView.tsx@@ -0,0 +1,51 @@+import { useActions } from 'kea'++import { IconPlus } from '@posthog/icons'+import { Item, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemTitle } from '@posthog/quill'++import { SceneExport } from 'scenes/sceneTypes'++import { SceneContent } from '~/layout/scenes/components/SceneContent'+import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'++import { newViewLogic } from './newViewLogic'+import { VIEW_TYPES } from './viewsUtils'+import { ViewTypeIcon } from './ViewTypeIcon'++export const scene: SceneExport = {+ component: NewView,+}++export function NewView(): JSX.Element {+ const { pickNewViewType } = useActions(newViewLogic)++ return (+ <SceneContent>+ <SceneTitleSection+ name="New view"+ description="Pick what to create."+ resourceType={{ type: 'views', forceIcon: <IconPlus /> }}+ />+ <ItemGroup data-quill className="max-w-160 gap-2">+ {VIEW_TYPES.map((info) => (+ <Item+ key={info.type}+ variant="outline"+ render={<button type="button" />}+ className="text-start text-foreground hover:bg-fill-hover"+ onClick={() => pickNewViewType(info.type)}+ data-attr={`views-new-page-${info.type}`}+ >+ <ItemMedia variant="icon" aria-hidden>+ <ViewTypeIcon type={info.type} />+ </ItemMedia>+ <ItemContent>+ <ItemTitle>{info.label}</ItemTitle>+ <ItemDescription>{info.description}</ItemDescription>+ </ItemContent>+ </Item>+ ))}+ </ItemGroup>+ </SceneContent>+ )+}diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/QuillTaskTitle.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/QuillTaskTitle.tsxdeleted file mode 100644index 71a77896720d..000000000000--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/QuillTaskTitle.tsx+++ /dev/null@@ -1,88 +0,0 @@-import { type ReactNode, useState } from 'react'--import { IconChevronLeft, IconPencil } from '@posthog/icons'-import { Button, Heading, Input, SkeletonText } from '@posthog/quill-primitives'--import { LinkPrimitive } from 'lib/lemon-ui/Link'--export interface QuillTaskTitleProps {- name: string- icon: ReactNode- isLoading: boolean- /** Omitting this leaves the title read-only. */- onRename?: (title: string) => void- backTo?: { label: string; path: string }- actions?: ReactNode-}--export function QuillTaskTitle({ name, icon, isLoading, onRename, backTo, actions }: QuillTaskTitleProps): JSX.Element {- const [draft, setDraft] = useState<string | null>(null)-- const commit = (): void => {- if (draft !== null) {- onRename?.(draft)- }- setDraft(null)- }-- return (- <div data-quill className="flex flex-wrap items-center gap-2 py-2">- {backTo && (- <Button- variant="default"- size="icon-sm"- nativeButton={false}- render={<LinkPrimitive to={backTo.path} />}- aria-label={`Back to ${backTo.label}`}- >- <IconChevronLeft />- </Button>- )}- <span className="flex size-5 shrink-0 items-center justify-center text-sm" aria-hidden>- {icon}- </span>- <div className="flex h-6 min-w-0 flex-1 items-center gap-1">- {isLoading ? (- <SkeletonText lines={1} className="w-60 max-w-full" />- ) : draft !== null ? (- <Input- aria-label="Task title"- value={draft}- onChange={(event) => setDraft(event.target.value)}- onBlur={commit}- onKeyDown={(event) => {- if (event.key === 'Enter') {- event.preventDefault()- commit()- } else if (event.key === 'Escape') {- event.preventDefault()- setDraft(null)- }- }}- autoFocus- // Same height as the pencil button, and pulled left by its padding and border, so the text stays put on edit.- className="-ms-[calc(0.5rem+1px)] h-6 max-w-120 text-sm font-semibold"- />- ) : (- <>- <Heading size="sm" render={<h1 />} className="m-0 min-w-0 truncate">- {name}- </Heading>- {onRename && (- <Button- variant="default"- size="icon-sm"- aria-label="Rename task"- onClick={() => setDraft(name)}- data-attr="task-rename"- >- <IconPencil />- </Button>- )}- </>- )}- </div>- {actions && <div className="ml-auto flex flex-wrap items-center gap-1">{actions}</div>}- </div>- )-}diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsxindex c5292e4c574e..cc99e1955829 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx@@ -1,13 +1,17 @@import { type ReactNode } from 'react'-import { IconArchive } from '@posthog/icons'+import { IconArchive, IconChevronLeft } from '@posthog/icons'import { LemonDivider } from '@posthog/lemon-ui'+import { Button } from '@posthog/quill-primitives'import { dayjs } from 'lib/dayjs'+import { LinkPrimitive } from 'lib/lemon-ui/Link'import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'import { cn } from 'lib/utils/css-classes'import { urls } from 'scenes/urls'+import { QuillSceneHeader } from '~/layout/scenes/components/QuillSceneHeader'+import { QuillSceneName } from '~/layout/scenes/components/QuillSceneName'import { SceneContent } from '~/layout/scenes/components/SceneContent'import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import {@@ -16,6 +20,8 @@ import {ScenePanelDivider,ScenePanelInfoSection,} from '~/layout/scenes/SceneLayout'+import { TodaySessionIcon } from '~/layout/today/TodaySessionIcon'+import { sessionIconFields } from '~/layout/today/todayWorkItems'import type { TaskRunDetailDTOApi } from 'products/tasks/frontend/generated/api.schemas'@@ -23,7 +29,6 @@ import { TaskSourceIcon } from '../../../components/TaskSourceIcon'import { useThreadSkin } from '../../../hooks/useThreadSkin'import type { Task } from '../../../types/taskTypes'import { QuillTaskMenu } from './QuillTaskMenu'-import { QuillTaskTitle } from './QuillTaskTitle'import { TaskDebugLogsPanelToggle } from './TaskDebugLogsPanelToggle'import { TaskPanelSkeleton, TaskRunMetadataSkeleton } from './taskDetailSkeletons'import { TaskErrorBanner } from './TaskErrorBanner'@@ -69,7 +74,6 @@ export function TaskRunSceneShell({children,}: TaskRunSceneShellProps): JSX.Element {const skin = useThreadSkin()- const icon = <TaskSourceIcon originProduct={task?.origin_product} environment={task?.latest_run?.environment} />return (<SceneContent className="h-full min-h-0 gap-y-0">{/* The quill skin moves the panel's facts and actions into the title's overflow menu (QuillTaskMenu). */}@@ -140,34 +144,58 @@ export function TaskRunSceneShell({)}{skin === 'quill' ? (- <header className={cn('px-2', taskError && 'mt-4')}>- <QuillTaskTitle- name={task?.title || 'Task'}- icon={icon}- isLoading={isHeaderLoading}- onRename={onRename}- backTo={isMobile ? { label: 'PostHog AI', path: urls.ai() } : undefined}- actions={- <div data-quill className="flex flex-wrap items-center gap-1">- {titleActions}- {task && (- <QuillTaskMenu- task={task}- selectedRun={selectedRun}- onArchive={onArchive}- />- )}- </div>- }- />- </header>+ <QuillSceneHeader+ className={cn(taskError && 'mt-4')}+ back={+ isMobile ? (+ <Button+ variant="default"+ size="icon-sm"+ nativeButton={false}+ render={<LinkPrimitive to={urls.ai()} />}+ aria-label="Back to PostHog AI"+ >+ <IconChevronLeft />+ </Button>+ ) : undefined+ }+ icon={<TodaySessionIcon item={sessionIconFields(task?.latest_run)} />}+ title={+ <QuillSceneName+ name={task?.title || 'Task'}+ isLoading={isHeaderLoading}+ onChange={onRename}+ canEdit={!!onRename}+ // One write when the field is left, rather than one per keystroke.+ saveOnBlur+ renameDebounceMs={0}+ editDataAttr="task-rename"+ />+ }+ actions={+ <>+ {titleActions}+ {task && (+ <QuillTaskMenu task={task} selectedRun={selectedRun} onArchive={onArchive} />+ )}+ </>+ }+ />) : (<header className={cn('flex flex-col gap-y-2 px-4 pt-2', taskError && 'mt-4')}><SceneTitleSectionclassName="-mt-2"name={task?.title || 'Task'}description={null}- resourceType={{ type: 'task', forceIcon: icon }}+ resourceType={{+ type: 'task',+ forceIcon: (+ <TaskSourceIcon+ originProduct={task?.origin_product}+ environment={task?.latest_run?.environment}+ />+ ),+ }}isLoading={isHeaderLoading}canEdit={!!onRename}onNameChange={onRename}diff --git a/products/tasks/frontend/spaces/SpaceFeedStatusIcon.tsx b/products/tasks/frontend/spaces/SpaceFeedStatusIcon.tsxindex 9be19170c054..1544dc37fba2 100644--- a/products/tasks/frontend/spaces/SpaceFeedStatusIcon.tsx+++ b/products/tasks/frontend/spaces/SpaceFeedStatusIcon.tsx@@ -1,31 +1,12 @@-import { IconChat, IconCloud, IconPinFilled, IconSpinner } from '@posthog/icons'import { cn } from '@posthog/quill'-import { TodaySessionIconKind, todaySessionIcon } from '~/layout/today/todaySessionIcon'+import { TodaySessionIcon } from '~/layout/today/TodaySessionIcon'import { TodayWorkItem } from '~/layout/today/todayWorkItems'-// A settled run fills its cloud, like PostHog Desktop's feed cards. `IconCloud` is an outline path, so-// `*:fill-current` fills that path with the text colour.-const ICONS: Record<TodaySessionIconKind, { label: string; icon: JSX.Element }> = {- chat: { label: 'Chat', icon: <IconChat className="text-muted-foreground" /> },- running: { label: 'Running', icon: <IconSpinner className="text-info-foreground motion-safe:animate-spin" /> },- queued: { label: 'Queued', icon: <IconCloud className="text-muted-foreground motion-safe:animate-pulse" /> },- completed: { label: 'Completed', icon: <IconCloud className="text-success-foreground *:fill-current" /> },- failed: { label: 'Failed', icon: <IconCloud className="text-destructive-foreground *:fill-current" /> },- stopped: { label: 'Stopped', icon: <IconCloud className="text-muted-foreground *:fill-current" /> },- pinned: { label: 'Pinned', icon: <IconPinFilled className="text-foreground" /> },- session: { label: 'Session', icon: <IconCloud className="text-muted-foreground" /> },-}-export function SpaceFeedStatusIcon({ item, className }: { item: TodayWorkItem; className?: string }): JSX.Element {- const { label, icon } = ICONS[todaySessionIcon(item, false)]return (- <span- role="img"- aria-label={label}- className={cn('flex size-3.5 shrink-0 items-center justify-center', className)}- >- {icon}+ <span className={cn('flex size-3.5 shrink-0 items-center justify-center', className)}>+ <TodaySessionIcon item={item} /></span>)}diff --git a/services/mcp/src/tools/links/app-url-manifest.json b/services/mcp/src/tools/links/app-url-manifest.jsonindex bd0d03d53e3d..1e54111c00c6 100644--- a/services/mcp/src/tools/links/app-url-manifest.json+++ b/services/mcp/src/tools/links/app-url-manifest.json@@ -1729,6 +1729,11 @@"params": [],"scope": "project"},+ "tools": {+ "template": "/tools",+ "params": [],+ "scope": "project"+ },"tracing": {"template": "/tracing","params": [],@@ -1809,6 +1814,11 @@"params": [],"scope": "project"},+ "viewsNew": {+ "template": "/views/new",+ "params": [],+ "scope": "project"+ },"visualReviewFlakiness": {"template": "/visual_review/repos/{repoId}/flakiness","params": ["repoId"],diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.jsonindex 11975eca45fc..0a8cc7934491 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json@@ -13,7 +13,7 @@"type": "object"},"url": {- "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/scorers\n/ai-evals/evaluations/scorers/{scorerId}\n/ai-evals/evaluations/scorers/{scorerId}/offline\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-gateway\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/autoresearch\n/autoresearch/new\n/autoresearch/{id}\n/billing/authorization_status\n/broadcasts\n/broadcasts/new\n/broadcasts/{id}\n/business-knowledge\n/business-knowledge/playground\n/business-knowledge/settings\n/business-knowledge/{id}\n/canvas\n/canvases/new\n/canvases/{id}\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/loop/{loopId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/by-external-id/{externalId}\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/customer_analytics/tasks\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/tiles/{tileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-destinations\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/debug/precompute\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors\n/engineering-analytics/authors/{handle}\n/engineering-analytics/deploys\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/tests\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/etl\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/files\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/games/shipit\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/link/{id}\n/links\n/live-debugger\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-registry\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/widgets/{widgetId}\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/overview\n/replay-vision/{id}/self-driving\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/organization-authentication/{feature}/{configId}\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/spaces\n/spaces/new\n/spaces/{id}\n/spaces/{id}/canvases\n/spaces/{id}/new\n/spaces/{id}/settings\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/terminal\n/themes/custom-css\n/toolbar\n/tracing\n/tracing/retention-rules/new\n/tracing/retention-rules/{id}\n/unsubscribe\n/user_research\n/user_research/{id}\n/user_research/{topicId}/response/{responseId}\n/verify_email\n/views\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/content-autopilot\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard/runs\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",+ "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/scorers\n/ai-evals/evaluations/scorers/{scorerId}\n/ai-evals/evaluations/scorers/{scorerId}/offline\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-gateway\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/autoresearch\n/autoresearch/new\n/autoresearch/{id}\n/billing/authorization_status\n/broadcasts\n/broadcasts/new\n/broadcasts/{id}\n/business-knowledge\n/business-knowledge/playground\n/business-knowledge/settings\n/business-knowledge/{id}\n/canvas\n/canvases/new\n/canvases/{id}\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/loop/{loopId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/by-external-id/{externalId}\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/customer_analytics/tasks\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/tiles/{tileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-destinations\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/debug/precompute\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors\n/engineering-analytics/authors/{handle}\n/engineering-analytics/deploys\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/tests\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/etl\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/files\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/games/shipit\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/link/{id}\n/links\n/live-debugger\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-registry\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/widgets/{widgetId}\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/overview\n/replay-vision/{id}/self-driving\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/organization-authentication/{feature}/{configId}\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/spaces\n/spaces/new\n/spaces/{id}\n/spaces/{id}/canvases\n/spaces/{id}/new\n/spaces/{id}/settings\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/terminal\n/themes/custom-css\n/toolbar\n/tools\n/tracing\n/tracing/retention-rules/new\n/tracing/retention-rules/{id}\n/unsubscribe\n/user_research\n/user_research/{id}\n/user_research/{topicId}/response/{responseId}\n/verify_email\n/views\n/views/new\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/content-autopilot\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard/runs\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}","type": "string"}},