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): match the desktop work column look in the sidebar (#109441)

Shy Alterf04e326b15a8
diff --git a/frontend/src/layout/today/TodayOverflowText.tsx b/frontend/src/layout/today/TodayOverflowText.tsx
new file mode 100644
index 000000000000..52bc2642f91d
--- /dev/null
+++ b/frontend/src/layout/today/TodayOverflowText.tsx
@@ -0,0 +1,103 @@
+import { useEffect, useRef, useState } from 'react'
+
+import { cn } from '@posthog/quill'
+
+const TICKER_SPEED_PX_PER_SECOND = 50
+const TICKER_FADE_PX = 24
+/** A title that overflows by a character or two keeps its fade: moving costs more to read than the glyphs are worth. */
+const TICKER_MIN_OVERFLOW_PX = 12
+
+function tickerMask(overflowPx: number, isTicking: boolean, showsEnd: boolean): string | undefined {
+ if (overflowPx === 0) {
+ return undefined
+ }
+ const fadeIn = `transparent, black ${TICKER_FADE_PX}px`
+ const fadeOut = `black calc(100% - ${TICKER_FADE_PX}px), transparent`
+ if (!isTicking) {
+ return `linear-gradient(to right, ${fadeOut})`
+ }
+ if (showsEnd) {
+ return `linear-gradient(to right, ${fadeIn})`
+ }
+ return `linear-gradient(to right, ${fadeIn}, ${fadeOut})`
+}
+
+function prefersReducedMotion(): boolean {
+ return typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches
+}
+
+/** Fades a title that does not fit, and scrolls it to its end while `reveal` is on, like the desktop work column. */
+export function TodayOverflowText({
+ reveal,
+ className,
+ children,
+}: {
+ reveal: boolean
+ className?: string
+ children: React.ReactNode
+}): JSX.Element {
+ const containerRef = useRef<HTMLSpanElement>(null)
+ const contentRef = useRef<HTMLSpanElement>(null)
+ const [overflowPx, setOverflowPx] = useState(0)
+ const [reachedEnd, setReachedEnd] = useState(false)
+
+ useEffect(() => {
+ if (!reveal) {
+ setReachedEnd(false)
+ }
+ }, [reveal])
+
+ useEffect(() => {
+ setReachedEnd(false)
+ }, [overflowPx])
+
+ useEffect(() => {
+ const container = containerRef.current
+ const content = contentRef.current
+ if (!container || !content) {
+ return
+ }
+ const measure = (): void => setOverflowPx(Math.max(0, container.scrollWidth - container.clientWidth))
+ measure()
+ const observer = new ResizeObserver(measure)
+ observer.observe(container)
+ observer.observe(content)
+ return () => observer.disconnect()
+ }, [])
+
+ const reducedMotion = prefersReducedMotion()
+ const isTicking = reveal && overflowPx >= TICKER_MIN_OVERFLOW_PX
+ const maskImage = tickerMask(overflowPx, isTicking, reachedEnd || (isTicking && reducedMotion))
+
+ return (
+ <span
+ ref={containerRef}
+ className={cn('min-w-0 overflow-hidden whitespace-nowrap', className)}
+ // eslint-disable-next-line react/forbid-dom-props
+ style={{ maskImage, WebkitMaskImage: maskImage }}
+ >
+ <span
+ ref={contentRef}
+ className="inline-block"
+ onTransitionEnd={(e) => {
+ if (e.target === e.currentTarget && e.propertyName === 'transform') {
+ setReachedEnd(true)
+ }
+ }}
+ // eslint-disable-next-line react/forbid-dom-props
+ style={
+ isTicking
+ ? {
+ transform: `translateX(-${overflowPx}px)`,
+ transitionProperty: reducedMotion ? 'none' : 'transform',
+ transitionTimingFunction: 'linear',
+ transitionDuration: `${overflowPx / TICKER_SPEED_PX_PER_SECOND}s`,
+ }
+ : { transform: 'translateX(0)', transitionProperty: 'none' }
+ }
+ >
+ {children}
+ </span>
+ </span>
+ )
+}
diff --git a/frontend/src/layout/today/TodayRecentFilterMenu.tsx b/frontend/src/layout/today/TodayRecentFilterMenu.tsx
index 3ecfc776f68b..d13001dbab92 100644
--- a/frontend/src/layout/today/TodayRecentFilterMenu.tsx
+++ b/frontend/src/layout/today/TodayRecentFilterMenu.tsx
@@ -67,9 +67,12 @@ export function TodayRecentFilterMenu(): JSX.Element {
<DropdownMenuTrigger
render={
<Button
- size="icon-sm"
+ size="icon-xs"
aria-label={label}
- className={cn('relative', active && 'bg-fill-selected')}
+ className={cn(
+ 'relative text-muted-foreground',
+ active && 'bg-fill-selected text-foreground'
+ )}
data-attr="today-recent-filter"
/>
}
diff --git a/frontend/src/layout/today/TodaySessionBadges.tsx b/frontend/src/layout/today/TodaySessionBadges.tsx
new file mode 100644
index 000000000000..e6275632e0c5
--- /dev/null
+++ b/frontend/src/layout/today/TodaySessionBadges.tsx
@@ -0,0 +1,64 @@
+import { IconPinFilled, IconPullRequest } from '@posthog/icons'
+import { Avatar, AvatarFallback, AvatarGroup, Tooltip, TooltipContent, TooltipTrigger, cn } from '@posthog/quill'
+
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+
+import { PrStateEnumApi } from 'products/tasks/frontend/generated/api.schemas'
+import { pullRequestLinkLabel, pullRequestStateMeta } from 'products/tasks/frontend/spaces/TaskPullRequestChip'
+import { TaskPullRequest } from 'products/tasks/frontend/spaces/taskPullRequests'
+
+// The ring keeps two overlapping badges apart, so they do not read as one glyph.
+const BADGE_CLASS = 'ring-1 ring-border'
+
+interface TodaySessionBadgesProps {
+ pullRequest: TaskPullRequest | null
+ pullRequestState: PrStateEnumApi | null | undefined
+ pinned: boolean
+}
+
+/** A session row's trailing stack, like PostHog Desktop: the pin, then the pull request colored by its state. */
+export function TodaySessionBadges({ pullRequest, pullRequestState, pinned }: TodaySessionBadgesProps): JSX.Element {
+ const known = pullRequestStateMeta(pullRequestState)
+ return (
+ <AvatarGroup stacked reverse size="xs" className="shrink-0">
+ {pinned && (
+ <Tooltip>
+ <TooltipTrigger
+ delay={200}
+ render={<Avatar size="xs" role="img" aria-label="Pinned" className={BADGE_CLASS} />}
+ >
+ <AvatarFallback className="bg-transparent">
+ <IconPinFilled className="size-2.5 text-muted-foreground" />
+ </AvatarFallback>
+ </TooltipTrigger>
+ <TooltipContent>Pinned</TooltipContent>
+ </Tooltip>
+ )}
+ {pullRequest && (
+ <Tooltip>
+ <TooltipTrigger
+ delay={200}
+ render={
+ <Avatar
+ size="xs"
+ render={<LinkPrimitive to={pullRequest.url} target="_blank" />}
+ aria-label={pullRequestLinkLabel(pullRequest, pullRequestState)}
+ data-attr="today-pr-chip-sidebar"
+ className={BADGE_CLASS}
+ />
+ }
+ >
+ <AvatarFallback className="bg-transparent">
+ <IconPullRequest
+ className={cn('size-2.5', known?.iconClassName ?? 'text-muted-foreground')}
+ />
+ </AvatarFallback>
+ </TooltipTrigger>
+ <TooltipContent>
+ {`${known?.label ?? 'Pull request'} · ${pullRequest.repository}#${pullRequest.number}`}
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </AvatarGroup>
+ )
+}
diff --git a/frontend/src/layout/today/TodaySessionRow.tsx b/frontend/src/layout/today/TodaySessionRow.tsx
index 28e847f2da52..fdca181bd0ff 100644
--- a/frontend/src/layout/today/TodaySessionRow.tsx
+++ b/frontend/src/layout/today/TodaySessionRow.tsx
@@ -4,12 +4,12 @@ import { router } from 'kea-router'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
-import { TaskPullRequestChip } from 'products/tasks/frontend/spaces/TaskPullRequestChip'
-
+import { TodaySessionBadges } from './TodaySessionBadges'
+import { todaySessionDot } from './todaySessionDot'
import { TodaySessionMenu } from './TodaySessionMenu'
import { TodaySessionSurface, todaySessionMenuLogic } from './todaySessionMenuLogic'
import { TodaySessionRenameInput } from './TodaySessionRenameInput'
-import { TodaySessionStatusIcon } from './TodaySessionStatusIcon'
+import { TodaySessionStatusDot } from './TodaySessionStatusDot'
import { todaySpacesLogic } from './todaySpacesLogic'
import { TodaySpacesRow } from './TodaySpacesRow'
import { TodayWorkItem, activeCloudRunId, analysisRunId, canHandOff } from './todayWorkItems'
@@ -17,18 +17,29 @@ import { TodayWorkItem, activeCloudRunId, analysisRunId, canHandOff } from './to
interface TodaySessionRowProps {
item: TodayWorkItem
pinned: boolean
+ /** False under the Pinned heading, which already says it for every row. */
+ showPinBadge: boolean
dataAttr: string
surface: TodaySessionSurface
unread: boolean
}
-export function TodaySessionRow({ item, pinned, dataAttr, surface, unread }: TodaySessionRowProps): JSX.Element {
+export function TodaySessionRow({
+ item,
+ pinned,
+ showPinBadge,
+ dataAttr,
+ surface,
+ unread,
+}: TodaySessionRowProps): JSX.Element {
const { renaming } = useValues(todaySessionMenuLogic)
const { location, searchParams } = useValues(router)
const { user } = useValues(userLogic)
const { pullRequestStates } = useValues(todaySpacesLogic)
const [pullRequest] = item.pullRequests
+ const pinBadge = pinned && showPinBadge
+ const badgeCount = (pullRequest ? 1 : 0) + (pinBadge ? 1 : 0)
if (renaming?.sessionId === item.id && renaming.surface === surface) {
return <TodaySessionRenameInput sessionId={item.id} title={item.title} />
@@ -36,22 +47,22 @@ export function TodaySessionRow({ item, pinned, dataAttr, surface, unread }: Tod
return (
<TodaySpacesRow
label={item.title || 'Untitled session'}
- icon={<TodaySessionStatusIcon item={item} pinned={pinned} />}
+ // Unread shows only as a solid status dot; the title keeps its resting weight, like desktop.
+ icon={<TodaySessionStatusDot dot={todaySessionDot(item, unread)} />}
to={urls.aiTask(item.id)}
active={location.pathname.endsWith('/ai') && searchParams.task === item.id}
dataAttr={dataAttr}
badge={
- pullRequest ? (
- <TaskPullRequestChip
- pullRequest={pullRequest}
- label={`#${pullRequest.number}`}
- state={pullRequestStates[pullRequest.url]}
- size="row"
- dataAttr="today-pr-chip-sidebar"
+ badgeCount > 0 ? (
+ <TodaySessionBadges
+ pullRequest={pullRequest ?? null}
+ pullRequestState={pullRequest ? pullRequestStates[pullRequest.url] : null}
+ pinned={pinBadge}
/>
) : null
}
- unread={unread}
+ badgeCount={badgeCount === 2 ? 2 : 1}
+ ticker
action={
<TodaySessionMenu
sessionId={item.id}
diff --git a/frontend/src/layout/today/TodaySessionStatusDot.tsx b/frontend/src/layout/today/TodaySessionStatusDot.tsx
new file mode 100644
index 000000000000..7abf4c458760
--- /dev/null
+++ b/frontend/src/layout/today/TodaySessionStatusDot.tsx
@@ -0,0 +1,36 @@
+import { IconSpinner } from '@posthog/icons'
+import { Tooltip, TooltipContent, TooltipTrigger, cn } from '@posthog/quill'
+
+import { TodaySessionDot } from './todaySessionDot'
+
+const MARK_CLASS: Record<Exclude<TodaySessionDot['mark'], 'spinner'>, string> = {
+ hollow: 'border border-muted-foreground',
+ solid: 'bg-primary',
+ failed: 'bg-destructive-foreground',
+}
+
+export function TodaySessionStatusDot({ dot }: { dot: TodaySessionDot }): JSX.Element {
+ return (
+ <Tooltip>
+ <TooltipTrigger
+ delay={200}
+ render={<span className="relative flex size-2 shrink-0 items-center justify-center" />}
+ >
+ {dot.mark === 'spinner' ? (
+ <span role="img" aria-label={dot.label} className="relative size-2">
+ <IconSpinner className="absolute -inset-0.5 size-3 text-muted-foreground motion-safe:animate-spin" />
+ </span>
+ ) : (
+ <span
+ role="img"
+ aria-label={dot.label}
+ className={cn('size-2 rounded-full', MARK_CLASS[dot.mark], dot.faint && 'opacity-40')}
+ />
+ )}
+ {/* An 8px dot is a small target, so the tooltip also listens on the square around it. */}
+ <span aria-hidden className="absolute -inset-2" />
+ </TooltipTrigger>
+ <TooltipContent side="right">{dot.label}</TooltipContent>
+ </Tooltip>
+ )
+}
diff --git a/frontend/src/layout/today/TodaySpacesRow.tsx b/frontend/src/layout/today/TodaySpacesRow.tsx
index cb208eba3f11..161374be46f5 100644
--- a/frontend/src/layout/today/TodaySpacesRow.tsx
+++ b/frontend/src/layout/today/TodaySpacesRow.tsx
@@ -1,7 +1,11 @@
+import { useState } from 'react'
+
import { Button, cn } from '@posthog/quill'
import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { TodayOverflowText } from './TodayOverflowText'
+
interface TodaySpacesRowProps {
label: string
icon: JSX.Element
@@ -11,9 +15,15 @@ interface TodaySpacesRowProps {
action?: JSX.Element | null
/** Stays visible at the end of the row, after the hover action. */
badge?: JSX.Element | null
+ /** How many stacked badges `badge` holds, so the label truncates before them. */
+ badgeCount?: 1 | 2
/** How many icon buttons `action` holds, so the label truncates before them. */
actionCount?: 1 | 2
unread?: boolean
+ /** Off when the row's icon already marks it unread. */
+ unreadDot?: boolean
+ /** Fade a long label and scroll it on hover instead of cutting it with an ellipsis. */
+ ticker?: boolean
}
export function TodaySpacesRow({
@@ -24,28 +34,52 @@ export function TodaySpacesRow({
dataAttr,
action,
badge,
+ badgeCount = 1,
actionCount = 1,
unread = false,
+ unreadDot = true,
+ ticker = false,
}: TodaySpacesRowProps): JSX.Element {
+ const [hovered, setHovered] = useState(false)
+ const [keyboardFocused, setKeyboardFocused] = useState(false)
return (
- <div className="group/row relative flex min-w-0 items-center">
+ <div
+ className="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}
data-attr={dataAttr}
+ onFocus={
+ ticker
+ ? (e: React.FocusEvent<HTMLElement>) =>
+ setKeyboardFocused(e.currentTarget.matches(':focus-visible'))
+ : undefined
+ }
+ onBlur={ticker ? () => setKeyboardFocused(false) : undefined}
className={cn(
- 'min-w-0 text-muted-foreground',
- (active || unread) && 'text-foreground',
+ 'min-w-0 text-xs font-medium text-foreground',
active && 'bg-fill-selected',
action && !badge && (actionCount === 2 ? 'pr-12' : 'pr-8'),
- badge && 'pr-24'
+ badge && (badgeCount === 2 ? 'pr-16' : 'pr-12')
)}
>
<span className="flex size-3.5 shrink-0 items-center justify-center">{icon}</span>
- <span className={cn('min-w-0 flex-1 truncate', unread && 'font-semibold')}>{label}</span>
- {unread && !active && (
+ {ticker ? (
+ <TodayOverflowText
+ reveal={hovered || keyboardFocused}
+ className={cn('flex-1', unread && 'font-semibold')}
+ >
+ {label}
+ </TodayOverflowText>
+ ) : (
+ <span className={cn('min-w-0 flex-1 truncate', unread && 'font-semibold')}>{label}</span>
+ )}
+ {unread && unreadDot && !active && (
<span
role="img"
aria-label="Unread"
diff --git a/frontend/src/layout/today/TodaySpacesSidebar.tsx b/frontend/src/layout/today/TodaySpacesSidebar.tsx
index e9573793fdef..ecab79508410 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, IconList, IconLock, IconPlus, IconSearch } from '@posthog/icons'
+import { IconChat, IconLock, 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'
@@ -43,12 +43,13 @@ export function TodaySpacesSidebar(): JSX.Element {
const pinnedIds = new Set(pinnedItems.map((item) => item.id))
const browsingSpaces = location.pathname.endsWith(urls.taskSpaces())
- const renderItem = (item: TodayWorkItem, dataAttr: string): JSX.Element =>
+ const renderItem = (item: TodayWorkItem, dataAttr: string, inPinnedSection = false): JSX.Element =>
item.kind === 'session' ? (
<TodaySessionRow
key={`${item.kind}-${item.id}`}
item={item}
pinned={pinnedIds.has(item.id)}
+ showPinBadge={!inPinnedSection}
dataAttr={dataAttr}
surface="sidebar"
unread={unreadSessionIds.has(item.id)}
@@ -132,7 +133,7 @@ export function TodaySpacesSidebar(): JSX.Element {
onToggle={() => toggleSection('pinned')}
dataAttr="today-section-pinned"
>
- {pinnedItems.map((item) => renderItem(item, 'today-pinned-session'))}
+ {pinnedItems.map((item) => renderItem(item, 'today-pinned-session', true))}
</TodayPaneSection>
)}
<TodayPaneSection
@@ -151,7 +152,8 @@ export function TodaySpacesSidebar(): JSX.Element {
delay={0}
render={
<Button
- size="icon-sm"
+ size="icon-xs"
+ className="text-muted-foreground"
aria-label="Search recent"
onClick={() => setRecentSearchOpen(true)}
data-attr="today-recent-search-open"
@@ -223,34 +225,38 @@ export function TodaySpacesSidebar(): JSX.Element {
delay={0}
render={
<Button
- size="icon-sm"
- render={<LinkPrimitive to={urls.taskSpaces()} />}
- aria-current={browsingSpaces ? 'page' : undefined}
- className={cn(browsingSpaces && 'bg-fill-selected')}
- aria-label="Browse spaces"
- data-attr="today-spaces-browse"
+ size="icon-xs"
+ className="text-muted-foreground"
+ aria-label="New space"
+ onClick={openNewSpace}
+ data-attr="today-new-space-open-sidebar"
/>
}
>
- <IconList />
+ <IconPlus />
</TooltipTrigger>
- <TooltipContent>Browse spaces</TooltipContent>
+ <TooltipContent>New space</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger
delay={0}
render={
<Button
- size="icon-sm"
- aria-label="New space"
- onClick={openNewSpace}
- data-attr="today-new-space-open-sidebar"
+ 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"
/>
}
>
- <IconPlus />
+ <IconTableOfContents />
</TooltipTrigger>
- <TooltipContent>New space</TooltipContent>
+ <TooltipContent>Browse spaces</TooltipContent>
</Tooltip>
</>
}
diff --git a/frontend/src/layout/today/todaySessionDot.test.ts b/frontend/src/layout/today/todaySessionDot.test.ts
new file mode 100644
index 000000000000..381d9f7d1579
--- /dev/null
+++ b/frontend/src/layout/today/todaySessionDot.test.ts
@@ -0,0 +1,17 @@
+import { TodaySessionDot, todaySessionDot } from './todaySessionDot'
+
+describe('todaySessionDot', () => {
+ it.each<[string, string | null, string | null, boolean, Omit<TodaySessionDot, 'faint'> & { faint?: boolean }]>([
+ ['a failed run, even when unread', 'failed', 'cloud', true, { mark: 'failed', label: 'Failed' }],
+ ['a queued cloud run', 'queued', 'cloud', false, { mark: 'spinner', label: 'Queued' }],
+ ['a cloud run that has not started', 'not_started', 'cloud', true, { mark: 'spinner', label: 'Starting' }],
+ ['a queued local run', 'queued', 'local', false, { mark: 'hollow', label: 'Queued' }],
+ ['a running session', 'in_progress', 'cloud', false, { mark: 'solid', label: 'Running' }],
+ ['an unread finished session', 'completed', 'cloud', true, { mark: 'solid', label: 'Unread' }],
+ ['a finished session', 'completed', 'cloud', false, { mark: 'hollow', label: 'Completed' }],
+ ['a stopped session', 'cancelled', 'cloud', false, { mark: 'hollow', faint: true, label: 'Stopped' }],
+ ['a session with no run', null, null, false, { mark: 'hollow', label: 'Idle' }],
+ ])('shows %s', (_, status, runEnvironment, unread, expected) => {
+ expect(todaySessionDot({ status, runEnvironment }, unread)).toEqual({ faint: false, ...expected })
+ })
+})
diff --git a/frontend/src/layout/today/todaySessionDot.ts b/frontend/src/layout/today/todaySessionDot.ts
new file mode 100644
index 000000000000..3bf038948b82
--- /dev/null
+++ b/frontend/src/layout/today/todaySessionDot.ts
@@ -0,0 +1,40 @@
+import { TodayWorkItem } from './todayWorkItems'
+
+export interface TodaySessionDot {
+ /** `hollow` is settled, `solid` wants a look, `failed` is red, `spinner` is still starting. */
+ mark: 'hollow' | 'solid' | 'failed' | 'spinner'
+ /** Barely there, for a run somebody stopped. */
+ faint: boolean
+ label: string
+}
+
+const STARTING_LABELS: Record<string, string> = { not_started: 'Starting', queued: 'Queued' }
+
+/**
+ * A session's state as one dot, like the PostHog Desktop task rows. The dot shows attention and activity only,
+ * so every settled state shares the same quiet ring.
+ */
+export function todaySessionDot(
+ item: Pick<TodayWorkItem, 'status' | 'runEnvironment'>,
+ unread: boolean
+): TodaySessionDot {
+ const { status } = item
+ const startingLabel = status ? STARTING_LABELS[status] : undefined
+ if (status === 'failed') {
+ return { mark: 'failed', faint: false, label: 'Failed' }
+ }
+ // A local run can stay `queued` after the agent finishes, so only a cloud run shows the spinner.
+ if (startingLabel && item.runEnvironment === 'cloud') {
+ return { mark: 'spinner', faint: false, label: startingLabel }
+ }
+ if (status === 'in_progress') {
+ return { mark: 'solid', faint: false, label: 'Running' }
+ }
+ if (unread) {
+ return { mark: 'solid', faint: false, label: 'Unread' }
+ }
+ if (status === 'cancelled') {
+ return { mark: 'hollow', faint: true, label: 'Stopped' }
+ }
+ return { mark: 'hollow', faint: false, label: status === 'completed' ? 'Completed' : (startingLabel ?? 'Idle') }
+}
diff --git a/frontend/src/layout/today/todaySpacesLogic.ts b/frontend/src/layout/today/todaySpacesLogic.ts
index ab635d65a3ec..457c6a32036d 100644
--- a/frontend/src/layout/today/todaySpacesLogic.ts
+++ b/frontend/src/layout/today/todaySpacesLogic.ts
@@ -81,7 +81,7 @@ export function sortSpaces(spaces: ChannelDTOApi[]): ChannelDTOApi[] {
}
export function spaceLabel(space: Pick<ChannelDTOApi, 'name' | 'system_role'>): string {
- return space.system_role === 'personal' ? 'Me' : space.name
+ return space.system_role === 'personal' ? 'personal' : space.name
}
/** Only some people can see it: the personal space, or a private shared space. */
diff --git a/frontend/src/styles/quill-bridge.scss b/frontend/src/styles/quill-bridge.scss
index b08c088adc8a..4f2e48f32276 100644
--- a/frontend/src/styles/quill-bridge.scss
+++ b/frontend/src/styles/quill-bridge.scss
@@ -148,10 +148,23 @@
background-color: var(--fill-expanded);
}
+[data-quill] .bg-destructive-foreground {
+ background-color: var(--destructive-foreground);
+}
+
[data-quill] .text-foreground {
color: var(--foreground);
}
+[data-quill] .text-foreground\/70 {
+ color: color-mix(in oklab, var(--foreground) 70%, transparent);
+}
+
+/* stylelint-disable-next-line selector-class-pattern -- the name of Tailwind's hover variant class */
+[data-quill] .hover\:text-foreground:hover {
+ color: var(--foreground);
+}
+
[data-quill] .text-muted-foreground {
color: var(--muted-foreground);
}
@@ -196,6 +209,10 @@
border-color: var(--border);
}
+[data-quill] .border-muted-foreground {
+ border-color: var(--muted-foreground);
+}
+
[data-quill] .border-input {
border-color: var(--input);
}
@@ -223,6 +240,10 @@
--tw-ring-color: color-mix(in oklab, var(--foreground) 20%, transparent);
}
+[data-quill] .ring-border {
+ --tw-ring-color: var(--border);
+}
+
[data-quill] .ring-ring {
--tw-ring-color: var(--ring);
}
diff --git a/products/tasks/frontend/spaces/TaskPullRequestChip.tsx b/products/tasks/frontend/spaces/TaskPullRequestChip.tsx
index 23abef684108..adb82a748669 100644
--- a/products/tasks/frontend/spaces/TaskPullRequestChip.tsx
+++ b/products/tasks/frontend/spaces/TaskPullRequestChip.tsx
@@ -6,53 +6,53 @@ import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { PrStateEnumApi } from '../generated/api.schemas'
import { TaskPullRequest } from './taskPullRequests'
+export interface PullRequestStateMeta {
+ label: string
+ iconClassName: string
+}
+
// The icon carries the state, like PostHog Desktop: the chip itself stays neutral.
-const PR_STATES: Record<Exclude<PrStateEnumApi, 'unknown'>, { label: string; iconClassName: string }> = {
+const PR_STATES: Record<Exclude<PrStateEnumApi, 'unknown'>, PullRequestStateMeta> = {
open: { label: 'Open', iconClassName: 'text-success-foreground' },
draft: { label: 'Draft', iconClassName: 'text-muted-foreground' },
merged: { label: 'Merged', iconClassName: 'text-completed-foreground' },
closed: { label: 'Closed', iconClassName: 'text-destructive-foreground' },
}
+/** The label and icon color of a known state, or null while GitHub has not reported one. */
+export function pullRequestStateMeta(state: PrStateEnumApi | null | undefined): PullRequestStateMeta | null {
+ return state && state !== 'unknown' ? PR_STATES[state] : null
+}
+
+export function pullRequestLinkLabel(pullRequest: TaskPullRequest, state: PrStateEnumApi | null | undefined): string {
+ const known = pullRequestStateMeta(state)
+ const name = `pull request ${pullRequest.repository}#${pullRequest.number}`
+ return known ? `Open ${known.label.toLowerCase()} ${name} on GitHub` : `Open ${name} on GitHub`
+}
+
interface TaskPullRequestChipProps {
pullRequest: TaskPullRequest
label: string
dataAttr: string
state?: PrStateEnumApi | null
- /** `row` for the compact sidebar pill, `card` for the feed card chip. */
- size?: 'row' | 'card'
}
-export function TaskPullRequestChip({
- pullRequest,
- label,
- dataAttr,
- state,
- size = 'card',
-}: TaskPullRequestChipProps): JSX.Element {
- const known = state && state !== 'unknown' ? PR_STATES[state] : null
- const name = `pull request ${pullRequest.repository}#${pullRequest.number}`
+export function TaskPullRequestChip({ pullRequest, label, dataAttr, state }: TaskPullRequestChipProps): JSX.Element {
+ const known = pullRequestStateMeta(state)
return (
<Tooltip>
<TooltipTrigger
render={
<Badge
render={<LinkPrimitive to={pullRequest.url} target="_blank" />}
- aria-label={
- known ? `Open ${known.label.toLowerCase()} ${name} on GitHub` : `Open ${name} on GitHub`
- }
+ aria-label={pullRequestLinkLabel(pullRequest, state)}
data-attr={dataAttr}
// `relative` lifts it above the feed card's full-card link, so it stays clickable.
- className={cn(
- 'relative max-w-full shrink-0 gap-1 border-border bg-fill-hover text-muted-foreground tabular-nums hover:bg-fill-selected hover:text-foreground',
- size === 'row' ? 'rounded-sm px-1' : 'h-6 rounded-md px-2 text-xs'
- )}
+ className="relative h-6 max-w-full shrink-0 gap-1 rounded-md border-border bg-fill-hover px-2 text-xs text-muted-foreground tabular-nums hover:bg-fill-selected hover:text-foreground"
/>
}
>
- <IconPullRequest
- className={cn('shrink-0', size === 'row' ? 'size-2.5' : 'size-3', known?.iconClassName)}
- />
+ <IconPullRequest className={cn('size-3 shrink-0', known?.iconClassName)} />
<span className="min-w-0 truncate">{label}</span>
</TooltipTrigger>
<TooltipContent>{known ? `${known.label} · ${pullRequest.url}` : pullRequest.url}</TooltipContent>
diff --git a/products/tasks/frontend/spaces/spacesSceneLogic.test.ts b/products/tasks/frontend/spaces/spacesSceneLogic.test.ts
index 336fdc90498a..06096c0476d4 100644
--- a/products/tasks/frontend/spaces/spacesSceneLogic.test.ts
+++ b/products/tasks/frontend/spaces/spacesSceneLogic.test.ts
@@ -1,4 +1,4 @@
-import { isLockedSpace } from '~/layout/today/todaySpacesLogic'
+import { isLockedSpace, spaceLabel } from '~/layout/today/todaySpacesLogic'
import { ChannelDTOApi } from '../generated/api.schemas'
import { spacesIndexLists } from './spacesSceneLogic'
@@ -34,4 +34,12 @@ describe('spacesSceneLogic', () => {
])('locks %s: %s', (_, identity, locked) => {
expect(isLockedSpace(identity as ChannelDTOApi)).toBe(locked)
})
+
+ // Matches PostHog Desktop, which names the personal space "personal" whatever its stored name is.
+ it.each([
+ ['the personal space', space('me', 'me', false, 'personal'), 'personal'],
+ ['a shared space', space('billing', 'billing', false), 'billing'],
+ ])('labels %s', (_, channel, label) => {
+ expect(spaceLabel(channel)).toBe(label)
+ })
})