Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(today): build the spaces sidebar on quill (#109043)

Shy Alter92cb43440914
diff --git a/frontend/src/layout/today/TodayPaneSection.tsx b/frontend/src/layout/today/TodayPaneSection.tsx
index 805542218e48..91d2f9fdca0d 100644
--- a/frontend/src/layout/today/TodayPaneSection.tsx
+++ b/frontend/src/layout/today/TodayPaneSection.tsx
@@ -1,8 +1,7 @@
import { ReactNode, RefCallback } from 'react'
import { IconChevronDown, IconChevronRight } from '@posthog/icons'
-
-import { cn } from 'lib/utils/css-classes'
+import { MenuLabel, cn } from '@posthog/quill'
import { TodayPaneSectionResizeHandle } from './TodayPaneSectionResizeHandle'
import { TodaySectionResizer } from './useTodaySectionLayout'
@@ -40,30 +39,38 @@ export function TodayPaneSection({
}: TodayPaneSectionProps): JSX.Element {
const Caret = open ? IconChevronDown : IconChevronRight
return (
- <section aria-label={label} className={cn('TodayPaneSection', divider && 'TodayPaneSection--divider')}>
- <div className="TodayPaneSection__header">
+ <section aria-label={label} className="flex shrink-0 flex-col">
+ <div
+ className={cn(
+ 'relative flex h-9 shrink-0 items-center gap-1 pt-1',
+ divider && 'border-t border-border'
+ )}
+ >
{resizer && <TodayPaneSectionResizeHandle label={label} active={resizing} resizer={resizer} />}
- <button
- type="button"
- className="TodayPaneSection__toggle Today__label"
+ <MenuLabel
+ render={<button type="button" />}
aria-expanded={open}
data-attr={dataAttr}
onClick={onToggle}
+ className="flex min-w-0 flex-1 cursor-pointer items-center gap-1 rounded-sm text-left"
>
<span>{label}</span>
- <Caret className="TodayPaneSection__caret" />
- {!open && count > 0 && <span className="TodayPaneSection__count">{count}</span>}
- </button>
- {open && actions && <div className="TodayPaneSection__actions">{actions}</div>}
+ <Caret className="size-3" />
+ {!open && count > 0 && <span className="tabular-nums">{count}</span>}
+ </MenuLabel>
+ {open && actions && <div className="flex shrink-0 items-center">{actions}</div>}
</div>
<div
- className={cn('TodayPaneSection__viewport', animate && 'TodayPaneSection__viewport--animate')}
+ className={cn(
+ 'min-h-0 shrink-0 overflow-hidden',
+ animate && 'transition-all duration-200 ease-out motion-reduce:transition-none'
+ )}
// eslint-disable-next-line react/forbid-dom-props
style={{ height: open ? height : 0 }}
>
{open && (
- <div className="TodayPaneSection__scroll">
- <div ref={contentRef} className="TodayPaneSection__body">
+ <div className="h-full overflow-y-auto">
+ <div ref={contentRef} className="flex flex-col gap-px pb-2">
{children}
</div>
</div>
diff --git a/frontend/src/layout/today/TodayPaneSectionResizeHandle.tsx b/frontend/src/layout/today/TodayPaneSectionResizeHandle.tsx
index a03e70182fab..340127124116 100644
--- a/frontend/src/layout/today/TodayPaneSectionResizeHandle.tsx
+++ b/frontend/src/layout/today/TodayPaneSectionResizeHandle.tsx
@@ -1,4 +1,4 @@
-import { cn } from 'lib/utils/css-classes'
+import { cn } from '@posthog/quill'
import { TodaySectionResizer } from './useTodaySectionLayout'
@@ -16,18 +16,23 @@ export function TodayPaneSectionResizeHandle({
return (
<button
type="button"
- className={cn('TodayPaneSection__resize', active && 'TodayPaneSection__resize--active')}
+ className="group/resize absolute inset-x-0 -top-1 z-10 flex h-2 cursor-row-resize touch-none items-center outline-none"
aria-label={`Resize ${label}`}
title="Drag to resize. Double-click to reset."
data-attr="today-section-resize"
onPointerDown={resizer.onPointerDown}
onPointerMove={resizer.onPointerMove}
onPointerUp={resizer.onPointerUp}
- onPointerCancel={resizer.onPointerUp}
+ onPointerCancel={resizer.onPointerCancel}
onKeyDown={resizer.onKeyDown}
onDoubleClick={resizer.onDoubleClick}
>
- <span className="TodayPaneSection__resize-line" />
+ <span
+ className={cn(
+ 'h-0.5 w-full rounded-full bg-primary opacity-0 transition-opacity group-hover/resize:opacity-100 group-focus-visible/resize:opacity-100',
+ active && 'opacity-100'
+ )}
+ />
</button>
)
}
diff --git a/frontend/src/layout/today/TodaySessionRow.tsx b/frontend/src/layout/today/TodaySessionRow.tsx
index 60e6271be4e5..b97897214359 100644
--- a/frontend/src/layout/today/TodaySessionRow.tsx
+++ b/frontend/src/layout/today/TodaySessionRow.tsx
@@ -3,11 +3,12 @@ import { router } from 'kea-router'
import { urls } from 'scenes/urls'
-import { TodayPaneRow } from './TodayPaneRow'
import { TodaySessionMenu } from './TodaySessionMenu'
import { TodaySessionSurface, todaySessionMenuLogic } from './todaySessionMenuLogic'
import { TodaySessionRenameInput } from './TodaySessionRenameInput'
-import { TodayWorkItem, shortTimeAgo } from './todayWorkItems'
+import { TodaySessionStatusIcon } from './TodaySessionStatusIcon'
+import { TodaySpacesRow } from './TodaySpacesRow'
+import { TodayWorkItem } from './todayWorkItems'
interface TodaySessionRowProps {
item: TodayWorkItem
@@ -21,13 +22,16 @@ export function TodaySessionRow({ item, pinned, dataAttr, surface }: TodaySessio
const { location, searchParams } = useValues(router)
if (renaming?.sessionId === item.id && renaming.surface === surface) {
- return <TodaySessionRenameInput sessionId={item.id} title={item.title} />
+ return (
+ <div data-not-quill>
+ <TodaySessionRenameInput sessionId={item.id} title={item.title} />
+ </div>
+ )
}
return (
- <TodayPaneRow
+ <TodaySpacesRow
label={item.title || 'Untitled session'}
- icon={<span className="TodayPane__dot" data-kind={item.kind} data-status={item.status ?? undefined} />}
- meta={shortTimeAgo(item.timestamp)}
+ icon={<TodaySessionStatusIcon item={item} pinned={pinned} />}
to={urls.aiTask(item.id)}
active={location.pathname.endsWith('/ai') && searchParams.task === item.id}
dataAttr={dataAttr}
diff --git a/frontend/src/layout/today/TodaySessionStatusIcon.tsx b/frontend/src/layout/today/TodaySessionStatusIcon.tsx
new file mode 100644
index 000000000000..514e1419af9d
--- /dev/null
+++ b/frontend/src/layout/today/TodaySessionStatusIcon.tsx
@@ -0,0 +1,24 @@
+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.scss
index e4584b7aebe0..bc4e700e3761 100644
--- a/frontend/src/layout/today/TodayShell.scss
+++ b/frontend/src/layout/today/TodayShell.scss
@@ -46,136 +46,11 @@
scrollbar-width: thin;
}
-.TodayPane__sections {
- display: flex;
- flex: 1 1 auto;
- flex-direction: column;
- min-height: 0;
- padding: 0 4px;
- margin: 18px 0 8px;
- overflow: hidden;
-}
-
.TodayPane__heading {
margin: 26px 8px 8px;
letter-spacing: 0.08em;
}
-.TodayPaneSection {
- display: flex;
- flex: none;
- flex-direction: column;
-
- &--divider > .TodayPaneSection__header {
- border-top: 1px solid var(--today-line);
- }
-}
-
-.TodayPaneSection__header {
- position: relative;
- box-sizing: border-box;
- display: flex;
- flex: none;
- gap: 4px;
- align-items: center;
- height: 36px;
- padding-top: 4px;
-}
-
-.TodayPaneSection__resize {
- position: absolute;
- top: -4px;
- right: 0;
- left: 0;
- z-index: 1;
- display: flex;
- align-items: center;
- height: 9px;
- touch-action: none;
- cursor: row-resize;
- outline: none;
-}
-
-.TodayPaneSection__resize-line {
- width: 100%;
- height: 2px;
- background: var(--today-focus-border);
- border-radius: 1px;
- opacity: 0;
- transition: opacity 0.16s;
-
- .TodayPaneSection__resize:hover &,
- .TodayPaneSection__resize:focus-visible &,
- .TodayPaneSection__resize--active & {
- opacity: 1;
- }
-}
-
-.TodayPaneSection__viewport {
- flex: none;
- min-height: 0;
- overflow: hidden;
-
- &--animate {
- transition: height 0.2s var(--today-ease);
-
- @media (prefers-reduced-motion: reduce) {
- transition: none;
- }
- }
-}
-
-.TodayPaneSection__scroll {
- height: 100%;
- overflow-y: auto;
- scrollbar-color: var(--today-input-border) transparent;
- scrollbar-width: thin;
-}
-
-.TodayPaneSection__toggle {
- display: flex;
- flex: 1 1 auto;
- gap: 4px;
- align-items: center;
- min-width: 0;
- padding: 4px 8px;
- text-align: left;
- border-radius: 6px;
- transition: color 0.16s;
-
- @media (hover: hover) and (pointer: fine) {
- &:hover {
- color: var(--today-ink);
- }
- }
-}
-
-.TodayPaneSection__caret {
- flex: 0 0 11px;
- width: 11px;
- height: 11px;
- opacity: 0.7;
-}
-
-.TodayPaneSection__count {
- margin-left: 2px;
- font-variant-numeric: tabular-nums;
- color: var(--today-muted);
-}
-
-.TodayPaneSection__actions {
- display: flex;
- flex: 0 0 auto;
- align-items: center;
-}
-
-.TodayPaneSection__body {
- display: flex;
- flex-direction: column;
- gap: 1px;
- padding-bottom: 8px;
-}
-
.TodaySpaceFeed {
max-width: 720px;
}
@@ -191,60 +66,6 @@
}
}
-.TodayPane__dot {
- width: 6px;
- height: 6px;
- background: var(--today-faint);
- border-radius: 50%;
-
- &[data-status='queued'],
- &[data-status='in_progress'] {
- background: var(--warning);
- }
-
- &[data-status='completed'] {
- background: var(--success);
- }
-
- &[data-status='failed'] {
- background: var(--danger);
- }
-
- &[data-kind='chat'] {
- background: transparent;
- border: 1px solid var(--today-faint);
- }
-}
-
-.TodayPane__add {
- display: flex;
- gap: 6px;
- align-items: center;
- padding: 6px 8px;
- margin-top: 4px;
- font-size: 12px;
- font-weight: 500;
- color: var(--today-muted);
- text-align: left;
- border: 1px dashed var(--today-input-border);
- border-radius: 8px;
- transition:
- color 0.16s,
- border-color 0.16s;
-
- svg {
- width: 13px;
- height: 13px;
- }
-
- @media (hover: hover) and (pointer: fine) {
- &:hover {
- color: var(--today-ink);
- border-color: var(--today-focus-border);
- }
- }
-}
-
.TodayPane__state {
display: flex;
flex-direction: column;
@@ -256,12 +77,6 @@
color: var(--today-muted);
}
-.TodayPane__hash {
- font-family: var(--font-mono);
- font-size: 13px;
- color: var(--today-faint);
-}
-
.TodayPaneRow {
display: flex;
gap: 9px;
diff --git a/frontend/src/layout/today/TodaySpacesRow.tsx b/frontend/src/layout/today/TodaySpacesRow.tsx
new file mode 100644
index 000000000000..72d8c63580fd
--- /dev/null
+++ b/frontend/src/layout/today/TodaySpacesRow.tsx
@@ -0,0 +1,42 @@
+import { Button, cn } from '@posthog/quill'
+
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+
+interface TodaySpacesRowProps {
+ label: string
+ icon: JSX.Element
+ to: string
+ active: boolean
+ dataAttr: string
+ action?: JSX.Element | null
+}
+
+export function TodaySpacesRow({ label, icon, to, active, dataAttr, action }: TodaySpacesRowProps): JSX.Element {
+ return (
+ <div className="group/row relative flex min-w-0 items-center">
+ <Button
+ size="row"
+ left
+ render={<LinkPrimitive to={to} />}
+ aria-current={active ? 'page' : undefined}
+ data-attr={dataAttr}
+ className={cn(
+ 'min-w-0 text-muted-foreground',
+ active && 'bg-fill-selected text-foreground',
+ action && 'pr-8'
+ )}
+ >
+ <span className="flex size-4 shrink-0 items-center justify-center">{icon}</span>
+ <span className="min-w-0 flex-1 truncate">{label}</span>
+ </Button>
+ {action && (
+ <div
+ data-not-quill
+ className="absolute right-1 flex opacity-0 transition-opacity group-focus-within/row:opacity-100 group-hover/row:opacity-100"
+ >
+ {action}
+ </div>
+ )}
+ </div>
+ )
+}
diff --git a/frontend/src/layout/today/TodaySpacesSidebar.tsx b/frontend/src/layout/today/TodaySpacesSidebar.tsx
index ebcdacaf530a..7dad916cb3eb 100644
--- a/frontend/src/layout/today/TodaySpacesSidebar.tsx
+++ b/frontend/src/layout/today/TodaySpacesSidebar.tsx
@@ -2,18 +2,16 @@ import { useActions, useValues } from 'kea'
import { router } from 'kea-router'
import { Fragment } from 'react'
-import { IconList, IconPlus } from '@posthog/icons'
-import { LemonButton } from '@posthog/lemon-ui'
+import { IconChat, IconList, IconLock, IconPlus } from '@posthog/icons'
+import { Button, Skeleton, Text, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, cn } from '@posthog/quill'
-import { Spinner } from 'lib/lemon-ui/Spinner'
-import { cn } from 'lib/utils/css-classes'
import { urls } from 'scenes/urls'
-import { TodayPaneRow } from './TodayPaneRow'
import { TodayPaneSection, TodayPaneSectionProps } from './TodayPaneSection'
import { TodaySessionRow } from './TodaySessionRow'
import { TodayWorkSectionId, spaceLabel, todaySpacesLogic } from './todaySpacesLogic'
-import { TodayWorkItem, shortTimeAgo } from './todayWorkItems'
+import { TodaySpacesRow } from './TodaySpacesRow'
+import { TodayWorkItem } from './todayWorkItems'
import { useTodaySectionLayout } from './useTodaySectionLayout'
export function TodaySpacesSidebar(): JSX.Element {
@@ -43,11 +41,10 @@ export function TodaySpacesSidebar(): JSX.Element {
surface="sidebar"
/>
) : (
- <TodayPaneRow
+ <TodaySpacesRow
key={`${item.kind}-${item.id}`}
label={item.title || 'Untitled chat'}
- icon={<span className="TodayPane__dot" data-kind={item.kind} />}
- meta={shortTimeAgo(item.timestamp)}
+ icon={<IconChat className="text-muted-foreground" />}
to={urls.ai(item.id)}
active={location.pathname.endsWith('/ai') && searchParams.chat === item.id}
dataAttr={dataAttr}
@@ -77,146 +74,168 @@ export function TodaySpacesSidebar(): JSX.Element {
}
}
+ const loadingRows = (
+ <div className="flex flex-col gap-2 px-2 py-1">
+ <Skeleton className="h-4 w-3/4" />
+ <Skeleton className="h-4 w-1/2" />
+ <Skeleton className="h-4 w-2/3" />
+ </div>
+ )
+ const loadError = (message: string, onRetry: () => void, dataAttr: string): JSX.Element => (
+ <div className="flex flex-col items-start gap-2 px-2 py-1">
+ <Text size="xs" variant="muted">
+ {message}
+ </Text>
+ <Button variant="outline" size="sm" onClick={onRetry} data-attr={dataAttr}>
+ Try again
+ </Button>
+ </div>
+ )
+
return (
- <div className="TodayPane">
- <button
- type="button"
- className="TodaySidebar__new"
- data-attr="today-spaces-new-chat"
- onClick={() => router.actions.push(urls.ai())}
- >
- <IconPlus />
- New chat
- </button>
- <div className="TodayPane__sections" ref={layout.measureRefs.area}>
- {hasPinned && (
+ <TooltipProvider>
+ <div className="TodayPane" data-quill>
+ <button
+ type="button"
+ className="TodaySidebar__new"
+ data-attr="today-spaces-new-chat"
+ onClick={() => router.actions.push(urls.ai())}
+ >
+ <IconPlus />
+ New chat
+ </button>
+ <div
+ className="mt-4 mb-2 flex min-h-0 flex-1 flex-col overflow-hidden px-1"
+ ref={layout.measureRefs.area}
+ >
+ {hasPinned && (
+ <TodayPaneSection
+ label="Pinned"
+ {...sectionLayout('pinned')}
+ count={pinnedItems.length}
+ onToggle={() => toggleSection('pinned')}
+ dataAttr="today-section-pinned"
+ >
+ {pinnedItems.map((item) => renderItem(item, 'today-pinned-session'))}
+ </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'))}
+ {recentLoading && !recentItems.length ? (
+ loadingRows
+ ) : recentTasksUnavailable && !recentItems.length ? (
+ loadError('Recent sessions didn’t load.', loadRecentTasks, 'today-recent-retry')
+ ) : !recentItems.length ? (
+ <Text size="xs" variant="muted" className="px-2 py-1">
+ Sessions and chats you open show up here.
+ </Text>
+ ) : (
+ <>
+ {recentTasksUnavailable &&
+ loadError('Some sessions didn’t load.', loadRecentTasks, 'today-recent-retry')}
+ {recentGroups.map((group, index) => (
+ <Fragment key={group.key}>
+ <Text
+ size="xs"
+ 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="Recent"
- {...sectionLayout('recent')}
- count={recentItems.length}
- onToggle={() => toggleSection('recent')}
- divider={hasPinned}
- dataAttr="today-section-recent"
- >
- {recentLoading && !recentItems.length ? (
- <div className="TodayPane__state">
- <Spinner />
- </div>
- ) : recentTasksUnavailable && !recentItems.length ? (
- <div className="TodayPane__state">
- <span>Recent sessions didn’t load.</span>
- <LemonButton
- size="small"
- type="secondary"
- onClick={() => loadRecentTasks()}
- data-attr="today-recent-retry"
- >
- Try again
- </LemonButton>
- </div>
- ) : !recentItems.length ? (
- <div className="TodayPane__state">Sessions and chats you open show up here.</div>
- ) : (
- <>
- {recentTasksUnavailable && (
- <div className="TodayPane__state">
- <span>Some sessions didn’t load.</span>
- <LemonButton
- size="xsmall"
- type="secondary"
- onClick={() => loadRecentTasks()}
- data-attr="today-recent-retry"
- >
- Try again
- </LemonButton>
- </div>
- )}
- {recentGroups.map((group, index) => (
- <Fragment key={group.key}>
- <div className={cn('TodayPane__group', index === 0 && 'TodayPane__group--first')}>
- {group.label}
- </div>
- {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={
- <LemonButton
- size="xsmall"
- icon={<IconList />}
- active={browsingSpaces}
- tooltip={browsingSpaces ? 'Show starred spaces only' : 'Browse all spaces'}
- onClick={() => setBrowsingSpaces(!browsingSpaces)}
- data-attr="today-spaces-browse"
- />
- }
- >
- {spacesLoading && !visibleSpaces.length ? (
- <div className="TodayPane__state">
- <Spinner />
- </div>
- ) : spacesUnavailable ? (
- <div className="TodayPane__state">
- <span>Spaces didn’t load.</span>
- <LemonButton size="small" type="secondary" onClick={() => loadSpaces()}>
- Try again
- </LemonButton>
- </div>
- ) : !visibleSpaces.length && browsingSpaces ? (
- <div className="TodayPane__state">
- Spaces group the sessions you and your agents work on. Create one from PostHog Desktop.
- </div>
- ) : (
- <>
- {visibleSpaces.map((space) => (
- <TodayPaneRow
- key={space.id}
- label={spaceLabel(space)}
- icon={<span className="TodayPane__hash">#</span>}
- to={urls.taskSpace(space.id)}
- active={location.pathname.includes(urls.taskSpace(space.id))}
- dataAttr="today-space-row"
- />
- ))}
- {!browsingSpaces && visibleSpaces.length <= 1 && (
- <button
- type="button"
- className="TodayPane__add"
- data-attr="today-spaces-add"
- onClick={() => setBrowsingSpaces(true)}
+ <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-sm"
+ aria-pressed={browsingSpaces}
+ className={cn(browsingSpaces && 'bg-fill-selected')}
+ onClick={() => setBrowsingSpaces(!browsingSpaces)}
+ aria-label={
+ browsingSpaces ? 'Show starred spaces only' : 'Browse all spaces'
+ }
+ data-attr="today-spaces-browse"
+ />
+ }
>
- <IconPlus />
- Add the spaces you work in
- </button>
- )}
- </>
- )}
- </TodayPaneSection>
+ <IconList />
+ </TooltipTrigger>
+ <TooltipContent>
+ {browsingSpaces ? 'Show starred spaces only' : 'Browse all spaces'}
+ </TooltipContent>
+ </Tooltip>
+ }
+ >
+ {spacesLoading && !visibleSpaces.length ? (
+ loadingRows
+ ) : spacesUnavailable ? (
+ loadError('Spaces didn’t load.', loadSpaces, 'today-spaces-retry')
+ ) : !visibleSpaces.length && browsingSpaces ? (
+ <Text size="xs" variant="muted" className="px-2 py-1">
+ Spaces group the sessions you and your agents work on. Create one from PostHog Desktop.
+ </Text>
+ ) : (
+ <>
+ {visibleSpaces.map((space) => (
+ <TodaySpacesRow
+ key={space.id}
+ label={spaceLabel(space)}
+ icon={
+ space.channel_type === 'private' ? (
+ <IconLock className="text-muted-foreground" />
+ ) : (
+ <span aria-hidden className="font-mono text-muted-foreground">
+ #
+ </span>
+ )
+ }
+ to={urls.taskSpace(space.id)}
+ active={location.pathname.includes(urls.taskSpace(space.id))}
+ dataAttr="today-space-row"
+ />
+ ))}
+ {!browsingSpaces && visibleSpaces.length <= 1 && (
+ <Button
+ variant="outline"
+ size="sm"
+ className="mt-1 self-start"
+ data-attr="today-spaces-add"
+ onClick={() => setBrowsingSpaces(true)}
+ >
+ <IconPlus />
+ Add the spaces you work in
+ </Button>
+ )}
+ </>
+ )}
+ </TodayPaneSection>
+ </div>
</div>
- </div>
+ </TooltipProvider>
)
}
diff --git a/frontend/src/layout/today/todaySessionIcon.test.ts b/frontend/src/layout/today/todaySessionIcon.test.ts
new file mode 100644
index 000000000000..c3f4e63e2a72
--- /dev/null
+++ b/frontend/src/layout/today/todaySessionIcon.test.ts
@@ -0,0 +1,26 @@
+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,
+ status,
+ channel: 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.ts
new file mode 100644
index 000000000000..0e4ce15430ef
--- /dev/null
+++ b/frontend/src/layout/today/todaySessionIcon.ts
@@ -0,0 +1,36 @@
+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/useTodaySectionLayout.ts b/frontend/src/layout/today/useTodaySectionLayout.ts
index f16d6a673337..93682fcb95b9 100644
--- a/frontend/src/layout/today/useTodaySectionLayout.ts
+++ b/frontend/src/layout/today/useTodaySectionLayout.ts
@@ -18,6 +18,7 @@ export interface TodaySectionResizer {
onPointerDown: (event: PointerEvent<HTMLElement>) => void
onPointerMove: (event: PointerEvent<HTMLElement>) => void
onPointerUp: (event: PointerEvent<HTMLElement>) => void
+ onPointerCancel: () => void
onKeyDown: (event: KeyboardEvent<HTMLElement>) => void
onDoubleClick: () => void
}
@@ -135,6 +136,7 @@ export function useTodaySectionLayout(sections: readonly { id: TodayWorkSectionI
}
setDrag(null)
},
+ onPointerCancel: () => setDrag(null),
onKeyDown: (event) => {
if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') {
return
diff --git a/frontend/src/styles/quill-bridge.scss b/frontend/src/styles/quill-bridge.scss
index 34cbf054b8b9..250e18b55b47 100644
--- a/frontend/src/styles/quill-bridge.scss
+++ b/frontend/src/styles/quill-bridge.scss
@@ -172,6 +172,14 @@
color: var(--destructive-foreground);
}
+[data-quill] .text-success-foreground {
+ color: var(--success-foreground);
+}
+
+[data-quill] .text-info-foreground {
+ color: var(--info-foreground);
+}
+
[data-quill] .text-accent-foreground {
color: var(--accent-foreground);
}