: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): add a hover card and right-click menu to chat rows like desktop (#110081)
Shy Alterfedebd49d96f
diff --git a/frontend/src/layout/today/TodayChatActionItems.tsx b/frontend/src/layout/today/TodayChatActionItems.tsxnew file mode 100644index 000000000000..0d1f32973d14--- /dev/null+++ b/frontend/src/layout/today/TodayChatActionItems.tsx@@ -0,0 +1,34 @@+import { useActions } from 'kea'++import { IconCopy, IconExternal } from '@posthog/icons'++import { todayChatMenuLogic } from './todayChatMenuLogic'+import { TodayMenuParts } from './todayMenuParts'++interface TodayChatActionItemsProps {+ parts: TodayMenuParts+ chatId: string+ dataAttrPrefix: string+}++export function TodayChatActionItems({+ parts: { Item },+ chatId,+ dataAttrPrefix,+}: TodayChatActionItemsProps): JSX.Element {+ const { openChatInNewTab, copyChatLink } = useActions(todayChatMenuLogic)+ const attr = (name: string): string => `${dataAttrPrefix}-${name}`++ return (+ <>+ <Item onClick={() => openChatInNewTab(chatId)} dataAttr={attr('open-new-tab')}>+ <IconExternal />+ Open in new tab+ </Item>+ <Item onClick={() => copyChatLink(chatId)} dataAttr={attr('copy-link')}>+ <IconCopy />+ Copy link+ </Item>+ </>+ )+}diff --git a/frontend/src/layout/today/TodayChatHoverCard.tsx b/frontend/src/layout/today/TodayChatHoverCard.tsxnew file mode 100644index 000000000000..df625821d2f3--- /dev/null+++ b/frontend/src/layout/today/TodayChatHoverCard.tsx@@ -0,0 +1,49 @@+import { useMemo } from 'react'++import { IconChat } from '@posthog/icons'+import { Item, ItemContent, ItemSeparator, ItemTitle } from '@posthog/quill'++import { TodayChatActionItems } from './TodayChatActionItems'+import { TodayHoverCardFact } from './TodayHoverCardFact'+import { cardMenuParts } from './todayMenuParts'+import { TodayChatPreview } from './todayPreviewCards'+import { activityDetail } from './todayWorkItems'++const NO_SUBMENU = (): void => {}++export function TodayChatHoverCard({+ preview,+ onAction,+}: {+ preview: TodayChatPreview+ onAction: () => void+}): JSX.Element {+ const updated = activityDetail(preview.timestamp)+ const parts = useMemo(() => cardMenuParts(onAction, NO_SUBMENU), [onAction])+ return (+ <div className="flex flex-col" data-attr="today-chat-hover-card">+ <Item size="xs" className="items-start">+ <ItemContent className="min-w-0 gap-2">+ <ItemTitle className="flex items-start gap-2 wrap-anywhere">+ <span className="flex h-lh w-4 shrink-0 items-center justify-center text-muted-foreground">+ <IconChat />+ </span>+ <span className="min-w-0 font-semibold">{preview.title}</span>+ </ItemTitle>+ <div className="flex flex-col gap-1 pl-6">+ <TodayHoverCardFact label="Source">{preview.source}</TodayHoverCardFact>+ {updated && (+ <TodayHoverCardFact label="Updated">+ <span title={updated.title}>{updated.text}</span>+ </TodayHoverCardFact>+ )}+ </div>+ </ItemContent>+ </Item>+ <ItemSeparator className="my-0" />+ <div className="flex flex-col p-1">+ <TodayChatActionItems parts={parts} chatId={preview.chatId} dataAttrPrefix="today-chat-card" />+ </div>+ </div>+ )+}diff --git a/frontend/src/layout/today/TodayChatRow.tsx b/frontend/src/layout/today/TodayChatRow.tsxnew file mode 100644index 000000000000..fb345cf688bf--- /dev/null+++ b/frontend/src/layout/today/TodayChatRow.tsx@@ -0,0 +1,46 @@+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'++import { TodayChatActionItems } from './TodayChatActionItems'+import { CONTEXT_PARTS } from './todayMenuParts'+import { useTodayPreviewMenuReport } from './todayPreviewCardContext'+import { chatPreview } from './todayPreviewCards'+import { TodayPreviewTrigger } from './TodayPreviewTrigger'+import { TodaySpacesRow } from './TodaySpacesRow'+import { TodayWorkItem } from './todayWorkItems'++interface TodayChatRowProps {+ item: TodayWorkItem+ dataAttr: string+}++export function TodayChatRow({ item, dataAttr }: TodayChatRowProps): JSX.Element {+ const { location, searchParams } = useValues(router)+ const reportMenuOpen = useTodayPreviewMenuReport()+ const preview = useMemo(() => chatPreview(item), [item])++ return (+ <ContextMenu onOpenChange={reportMenuOpen}>+ <ContextMenuTrigger render={<div className="min-w-0" />}>+ <TodayPreviewTrigger payload={preview}>+ <TodaySpacesRow+ label={preview.title}+ icon={<IconChat className="text-muted-foreground" />}+ to={urls.ai(item.id)}+ active={location.pathname.endsWith('/ai') && searchParams.chat === item.id}+ dataAttr={dataAttr}+ />+ </TodayPreviewTrigger>+ </ContextMenuTrigger>+ <ContextMenuContent className="w-56">+ <TodayChatActionItems parts={CONTEXT_PARTS} chatId={item.id} dataAttrPrefix="today-chat-context" />+ </ContextMenuContent>+ </ContextMenu>+ )+}diff --git a/frontend/src/layout/today/TodayHoverCardFact.tsx b/frontend/src/layout/today/TodayHoverCardFact.tsxnew file mode 100644index 000000000000..7a82f6b8dd4c--- /dev/null+++ b/frontend/src/layout/today/TodayHoverCardFact.tsx@@ -0,0 +1,18 @@+import { Text } from '@posthog/quill'++export function TodayHoverCardFact({+ label,+ children,+}: {+ label: string+ children: JSX.Element | string+}): JSX.Element {+ return (+ <div className="flex min-w-0 items-center gap-2 text-xs">+ <Text size="xs" variant="muted" render={<span />} className="w-16 shrink-0">+ {label}+ </Text>+ <span className="min-w-0 flex-1 truncate">{children}</span>+ </div>+ )+}diff --git a/frontend/src/layout/today/TodayPreviewCardProvider.tsx b/frontend/src/layout/today/TodayPreviewCardProvider.tsxindex 270e35908b3a..4f0ded0ba886 100644--- a/frontend/src/layout/today/TodayPreviewCardProvider.tsx+++ b/frontend/src/layout/today/TodayPreviewCardProvider.tsx@@ -4,6 +4,7 @@ import { ReactNode, useCallback, useMemo, useRef, useState } from 'react'import { Card } from '@posthog/quill'+import { TodayChatHoverCard } from './TodayChatHoverCard'import { TodayPreviewCard, TodayPreviewCardContext } from './todayPreviewCardContext'import { TodayPreviewPayload } from './todayPreviewCards'import { TodaySessionHoverCard } from './TodaySessionHoverCard'@@ -68,6 +69,8 @@ export function TodayPreviewCardProvider({ children }: { children: ReactNode }):<Card size="sm" className="w-72 gap-0 border border-border py-0 shadow-md">{payload.kind === 'space' ? (<TodaySpaceHoverCard preview={payload} onAction={close} />+ ) : payload.kind === 'chat' ? (+ <TodayChatHoverCard preview={payload} onAction={close} />) : (<TodaySessionHoverCard// Keyed on the row, so moving to another row unmounts the card and lowers the submenu flag.diff --git a/frontend/src/layout/today/TodaySessionHoverCard.tsx b/frontend/src/layout/today/TodaySessionHoverCard.tsxindex 156ba70f657d..97f8e173bd35 100644--- a/frontend/src/layout/today/TodaySessionHoverCard.tsx+++ b/frontend/src/layout/today/TodaySessionHoverCard.tsx@@ -22,6 +22,7 @@ import { TaskUserBasicInfoApi } from 'products/tasks/frontend/generated/api.scheimport { pullRequestStateMeta } from 'products/tasks/frontend/spaces/TaskPullRequestChip'import { TaskUserAvatar, taskUserName } from 'products/tasks/frontend/spaces/TaskUserAvatar'+import { TodayHoverCardFact } from './TodayHoverCardFact'import { cardMenuParts } from './todayMenuParts'import { TodaySessionPreview } from './todayPreviewCards'import { TodaySessionActionItems } from './TodaySessionActionItems'@@ -30,17 +31,6 @@ import { todaySessionMenuLogic } from './todaySessionMenuLogic'import { TodaySessionStatusDot } from './TodaySessionStatusDot'import { activityDetail } from './todayWorkItems'-function Fact({ label, children }: { label: string; children: JSX.Element | string }): JSX.Element {- return (- <div className="flex min-w-0 items-center gap-2 text-xs">- <Text size="xs" variant="muted" render={<span />} className="w-16 shrink-0">- {label}- </Text>- <span className="min-w-0 flex-1 truncate">{children}</span>- </div>- )-}-function BranchLine({ branch }: { branch: string }): JSX.Element {const { copyBranchName } = useActions(todaySessionMenuLogic)return (@@ -124,19 +114,23 @@ export function TodaySessionHoverCard({<span className="min-w-0 font-semibold">{preview.title}</span></ItemTitle><div className="flex flex-col gap-1 pl-6">- {preview.repository && <Fact label="Repo">{preview.repository}</Fact>}+ {preview.repository && (+ <TodayHoverCardFact label="Repo">{preview.repository}</TodayHoverCardFact>+ )}{preview.branch && (- <Fact label="Branch">+ <TodayHoverCardFact label="Branch"><BranchLine branch={preview.branch} />- </Fact>+ </TodayHoverCardFact>+ )}+ {preview.spaceName && (+ <TodayHoverCardFact label="Space">{preview.spaceName}</TodayHoverCardFact>)}- {preview.spaceName && <Fact label="Space">{preview.spaceName}</Fact>}{updated && (- <Fact label="Updated">+ <TodayHoverCardFact label="Updated"><span title={updated.title}>{updated.text}</span>- </Fact>+ </TodayHoverCardFact>)}- {preview.source && <Fact label="Source">{preview.source}</Fact>}+ {preview.source && <TodayHoverCardFact label="Source">{preview.source}</TodayHoverCardFact>}</div></ItemContent>{author && (diff --git a/frontend/src/layout/today/TodaySpacesSidebar.tsx b/frontend/src/layout/today/TodaySpacesSidebar.tsxindex 285c011af86b..e20cbd7ed7f3 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 { IconChat, IconPlus, IconSearch, IconTableOfContents } from '@posthog/icons'+import { IconPlus, IconSearch, IconTableOfContents } from '@posthog/icons'import { Button, Skeleton, Text, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, cn } from '@posthog/quill'import { LinkPrimitive } from 'lib/lemon-ui/Link'@@ -11,6 +11,7 @@ import { urls } from 'scenes/urls'import { newSpaceLogic } from 'products/tasks/frontend/spaces/newSpaceLogic'import { SpacePresenceAvatars } from 'products/tasks/frontend/spaces/SpacePresenceAvatars'+import { TodayChatRow } from './TodayChatRow'import { TodayListAppearanceDialog } from './TodayListAppearanceDialog'import { TodayPaneSection, TodayPaneSectionProps } from './TodayPaneSection'import { TodayPreviewTrigger } from './TodayPreviewTrigger'@@ -50,7 +51,7 @@ export function TodaySpacesSidebar(): JSX.Element {const { openNewSpace } = useActions(newSpaceLogic)const { selectedSessionIds } = useValues(todaySessionSelectionLogic)const { toggleSessionSelection, selectSessionRange, clearSelection } = useActions(todaySessionSelectionLogic)- const { location, searchParams } = useValues(router)+ const { location } = useValues(router)const pinnedIds = new Set(pinnedItems.map((item) => item.id))const browsingSpaces = location.pathname.endsWith(urls.taskSpaces())const selectedIds = new Set(selectedSessionIds)@@ -85,14 +86,7 @@ export function TodaySpacesSidebar(): JSX.Element {onSelectClick={(event) => onSelectClick(item.id, event)}/>) : (- <TodaySpacesRow- key={`${item.kind}-${item.id}`}- label={item.title || 'Untitled chat'}- icon={<IconChat className="text-muted-foreground" />}- to={urls.ai(item.id)}- active={location.pathname.endsWith('/ai') && searchParams.chat === item.id}- dataAttr={dataAttr}- />+ <TodayChatRow key={`${item.kind}-${item.id}`} item={item} dataAttr={dataAttr} />)const hasPinned = pinnedItems.length > 0diff --git a/frontend/src/layout/today/todayChatMenuLogic.ts b/frontend/src/layout/today/todayChatMenuLogic.tsnew file mode 100644index 000000000000..7a193983bb09--- /dev/null+++ b/frontend/src/layout/today/todayChatMenuLogic.ts@@ -0,0 +1,43 @@+import { MakeLogicType, actions, kea, listeners, path } from 'kea'++import { toast } from '@posthog/quill'++import { writeToClipboard } from 'lib/utils/writeToClipboard'+import { urls } from 'scenes/urls'++export function chatUrl(chatId: string): string {+ return urls.absolute(urls.currentProject(urls.ai(chatId)))+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface todayChatMenuLogicActions {+ copyChatLink: (chatId: string) => {+ chatId: string+ }+ openChatInNewTab: (chatId: string) => {+ chatId: string+ }+}++export type todayChatMenuLogicType = MakeLogicType<{}, todayChatMenuLogicActions>++export const todayChatMenuLogic = kea<todayChatMenuLogicType>([+ path(['layout', 'today', 'todayChatMenuLogic']),+ actions({+ openChatInNewTab: (chatId: string) => ({ chatId }),+ copyChatLink: (chatId: string) => ({ chatId }),+ }),+ listeners(() => ({+ openChatInNewTab: ({ chatId }) => {+ window.open(chatUrl(chatId), '_blank', 'noopener')+ },+ copyChatLink: async ({ chatId }) => {+ const outcome = await writeToClipboard(chatUrl(chatId))+ if (outcome === 'copied') {+ toast.success({ title: 'Link copied' })+ } else {+ toast.error({ title: 'Couldn’t copy the link. Try again.' })+ }+ },+ })),+])diff --git a/frontend/src/layout/today/todayPreviewCards.test.ts b/frontend/src/layout/today/todayPreviewCards.test.tsindex 70282495babd..5448f5ad01be 100644--- a/frontend/src/layout/today/todayPreviewCards.test.ts+++ b/frontend/src/layout/today/todayPreviewCards.test.ts@@ -1,7 +1,9 @@+import { ConversationDetail } from '~/types'+import { ChannelDTOApi, TaskListItemApi, TaskUserBasicInfoApi } from 'products/tasks/frontend/generated/api.schemas'-import { sessionPreview, spaceKind, spacePreview } from './todayPreviewCards'-import { sessionItem } from './todayWorkItems'+import { chatPreview, sessionPreview, spaceKind, spacePreview } from './todayPreviewCards'+import { chatItem, sessionItem } from './todayWorkItems'const person = (uuid: string): TaskUserBasicInfoApi => ({id: uuid.length,@@ -94,4 +96,20 @@ describe('todayPreviewCards', () => {})expect([preview.source, preview.branch]).toEqual([source, expectedBranch])})++ it('names an untitled chat and acts on that chat', () => {+ const item = chatItem({+ id: 'chat-1',+ title: null,+ created_at: '2026-01-01T00:00:00Z',+ updated_at: '2026-01-02T00:00:00Z',+ } as unknown as ConversationDetail)+ expect(chatPreview(item)).toEqual({+ kind: 'chat',+ chatId: 'chat-1',+ title: 'Untitled chat',+ source: 'PostHog AI',+ timestamp: '2026-01-02T00:00:00Z',+ })+ })})diff --git a/frontend/src/layout/today/todayPreviewCards.ts b/frontend/src/layout/today/todayPreviewCards.tsindex afbff28992b8..ba0c5d1fbad5 100644--- a/frontend/src/layout/today/todayPreviewCards.ts+++ b/frontend/src/layout/today/todayPreviewCards.ts@@ -47,7 +47,15 @@ export interface TodaySpacePreview {hiddenRepositoryCount: number}-export type TodayPreviewPayload = TodaySessionPreview | TodaySpacePreview+export interface TodayChatPreview {+ kind: 'chat'+ chatId: string+ title: string+ source: string+ timestamp: string | null+}++export type TodayPreviewPayload = TodaySessionPreview | TodaySpacePreview | TodayChatPreviewexport function spaceKind(space: Pick<ChannelDTOApi, 'channel_type' | 'system_role'>): TodaySpaceKind {if (space.system_role === 'personal' || space.channel_type === 'personal') {@@ -112,6 +120,16 @@ function spacePeople(return people}+export function chatPreview(item: TodayWorkItem): TodayChatPreview {+ return {+ kind: 'chat',+ chatId: item.id,+ title: item.title || 'Untitled chat',+ source: 'PostHog AI',+ timestamp: item.timestamp,+ }+}+export function spacePreview(space: ChannelDTOApi,name: string,