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.

fix(today): match desktop list stripes, sticky labels and skeletons in the space feed (#109799)

Shy Alter15cb940058f6
diff --git a/products/tasks/frontend/spaces/SpaceFeed.tsx b/products/tasks/frontend/spaces/SpaceFeed.tsx
index aaafd0dc6eff..fcb607be9d07 100644
--- a/products/tasks/frontend/spaces/SpaceFeed.tsx
+++ b/products/tasks/frontend/spaces/SpaceFeed.tsx
@@ -1,7 +1,7 @@
import { useActions, useValues } from 'kea'
import { Fragment } from 'react'
-import { Button, Separator, Skeleton, Text } from '@posthog/quill'
+import { Button, Separator, Text, cn } from '@posthog/quill'
import { todaySpacesLogic } from '~/layout/today/todaySpacesLogic'
@@ -11,6 +11,7 @@ import { SpaceFeedControls } from './SpaceFeedControls'
import { SPACE_FEED_TYPES, SpaceFeedType } from './spaceFeedEntries'
import { SpaceFeedListRow } from './SpaceFeedListRow'
import { SpaceFeedPullRequestRow } from './SpaceFeedPullRequestRow'
+import { SpaceFeedSkeleton } from './SpaceFeedSkeleton'
import { spaceFeedViewLogic } from './spaceFeedViewLogic'
import { SpaceFeedSourceStatus, spaceSceneLogic } from './spaceSceneLogic'
@@ -81,13 +82,7 @@ export function SpaceFeed({ id }: { id: string }): JSX.Element {
</Button>
</div>
)}
- {feedPending && (
- <div className="flex flex-col gap-3 px-2 pt-6">
- <Skeleton className="h-4 w-1/4" />
- <Skeleton className="h-4 w-3/4" />
- <Skeleton className="h-4 w-2/3" />
- </div>
- )}
+ {feedPending && <SpaceFeedSkeleton listRows={listRows} />}
{feedEmpty && (
<div className="flex flex-col items-start gap-2 px-2 pt-6">
<Text size="sm" variant="muted">
@@ -105,88 +100,93 @@ export function SpaceFeed({ id }: { id: string }): JSX.Element {
)}
</div>
)}
- {feedSections.map((section) => (
- <Fragment key={section.key}>
- {section.label !== null &&
- (listRows ? (
- <Text
- size="xxs"
- weight="medium"
- variant="muted"
- className="px-2 pt-3 pb-1 tracking-wider uppercase"
- >
- {section.label}
- </Text>
- ) : (
- <div className="flex items-center gap-3 pt-5 pb-2">
- <Separator className="flex-1" />
- <Text
- render={<span />}
- size="xxs"
- weight="semibold"
- variant="muted"
- className="shrink-0 tracking-wider uppercase"
- >
+ {feedSections.map((section) => {
+ const entries = section.entries.filter(
+ (entry) => entry.kind === 'canvas' || sessionsById[entry.item.id]
+ )
+ return (
+ <Fragment key={section.key}>
+ {section.label !== null &&
+ (listRows ? (
+ <div className="sticky top-0 z-10 bg-(--scene-layout-background) px-2 pt-3 pb-1 text-xxs font-medium tracking-wider text-muted-foreground uppercase @2xl/main-content:top-8.5">
{section.label}
- </Text>
- <Separator className="flex-1" />
- </div>
- ))}
- {section.entries.map((entry) => {
- // List rows are ruled apart, like PostHog Desktop's.
- const rowClassName = 'border-b border-border last:border-b-0'
- if (entry.kind === 'canvas') {
- const row = <SpaceFeedCanvasRow key={entry.key} canvas={entry.canvas} listRow={listRows} />
- return listRows ? (
- <div key={entry.key} className={rowClassName}>
- {row}
</div>
) : (
- row
- )
- }
- const task = sessionsById[entry.item.id]
- if (!task) {
- return null
- }
- if (entry.kind === 'pr') {
- const row = (
- <SpaceFeedPullRequestRow
- key={entry.key}
- pullRequest={entry.pullRequest}
- session={entry.item}
- author={task.created_by ?? null}
- listRow={listRows}
- />
+ <div className="flex items-center gap-3 pt-5 pb-2">
+ <Separator className="flex-1" />
+ <Text
+ render={<span />}
+ size="xxs"
+ weight="semibold"
+ variant="muted"
+ className="shrink-0 tracking-wider uppercase"
+ >
+ {section.label}
+ </Text>
+ <Separator className="flex-1" />
+ </div>
+ ))}
+ {entries.map((entry, index) => {
+ // List rows are ruled apart, like PostHog Desktop's.
+ const rowClassName = cn(
+ index < entries.length - 1 && 'border-b border-border/60',
+ index % 2 === 1 && 'bg-fill-hover'
)
+ if (entry.kind === 'canvas') {
+ const row = (
+ <SpaceFeedCanvasRow key={entry.key} canvas={entry.canvas} listRow={listRows} />
+ )
+ return listRows ? (
+ <div key={entry.key} className={rowClassName}>
+ {row}
+ </div>
+ ) : (
+ row
+ )
+ }
+ const task = sessionsById[entry.item.id]
+ if (!task) {
+ return null
+ }
+ if (entry.kind === 'pr') {
+ const row = (
+ <SpaceFeedPullRequestRow
+ key={entry.key}
+ pullRequest={entry.pullRequest}
+ session={entry.item}
+ author={task.created_by ?? null}
+ listRow={listRows}
+ />
+ )
+ return listRows ? (
+ <div key={entry.key} className={rowClassName}>
+ {row}
+ </div>
+ ) : (
+ row
+ )
+ }
return listRows ? (
<div key={entry.key} className={rowClassName}>
- {row}
+ <SpaceFeedListRow
+ task={task}
+ pinned={pinnedIds.has(task.id)}
+ unread={unreadSessionIds.has(task.id)}
+ />
</div>
) : (
- row
- )
- }
- return listRows ? (
- <div key={entry.key} className={rowClassName}>
- <SpaceFeedListRow
+ <SpaceFeedCard
+ key={entry.key}
task={task}
pinned={pinnedIds.has(task.id)}
unread={unreadSessionIds.has(task.id)}
+ repository={feedRepositories[task.id] ?? null}
/>
- </div>
- ) : (
- <SpaceFeedCard
- key={entry.key}
- task={task}
- pinned={pinnedIds.has(task.id)}
- unread={unreadSessionIds.has(task.id)}
- repository={feedRepositories[task.id] ?? null}
- />
- )
- })}
- </Fragment>
- ))}
+ )
+ })}
+ </Fragment>
+ )
+ })}
</div>
)
}
diff --git a/products/tasks/frontend/spaces/SpaceFeedSkeleton.tsx b/products/tasks/frontend/spaces/SpaceFeedSkeleton.tsx
new file mode 100644
index 000000000000..7a5292bce0e2
--- /dev/null
+++ b/products/tasks/frontend/spaces/SpaceFeedSkeleton.tsx
@@ -0,0 +1,63 @@
+import { Card, Separator, Skeleton, cn } from '@posthog/quill'
+
+const CARD_FADES = [
+ { wide: true, className: undefined },
+ { wide: false, className: 'opacity-70' },
+ { wide: true, className: 'opacity-40' },
+ { wide: false, className: 'opacity-15' },
+]
+
+const LIST_GROUPS = [
+ { className: undefined, widths: ['w-2/5', 'w-3/5', 'w-1/3'] },
+ { className: 'opacity-50', widths: ['w-1/2', 'w-2/5', 'w-1/4'] },
+]
+
+export function SpaceFeedSkeleton({ listRows }: { listRows: boolean }): JSX.Element {
+ if (listRows) {
+ return (
+ <div aria-hidden className="flex flex-col">
+ {LIST_GROUPS.map((group, groupIndex) => (
+ <div key={groupIndex} className={cn('flex flex-col', group.className)}>
+ <div className="px-2 pt-3 pb-0.5">
+ <Skeleton className="h-2.5 w-14" />
+ </div>
+ {group.widths.map((width) => (
+ <div key={width} className="flex h-8 items-center gap-2 px-2">
+ <Skeleton className="size-3.5 shrink-0 rounded-sm" />
+ <Skeleton className={cn('h-3.5', width)} />
+ <Skeleton className="ml-auto h-4 w-14 shrink-0 rounded-full" />
+ <Skeleton className="size-4 shrink-0 rounded-full" />
+ <Skeleton className="h-3 w-6 shrink-0" />
+ </div>
+ ))}
+ </div>
+ ))}
+ </div>
+ )
+ }
+ return (
+ <div aria-hidden className="flex flex-col">
+ <div className="flex items-center gap-3 pt-5 pb-2">
+ <Separator className="flex-1" />
+ <Skeleton className="h-3 w-12" />
+ <Separator className="flex-1" />
+ </div>
+ {CARD_FADES.map((card, index) => (
+ <Card key={index} size="sm" className={cn('my-1.5 gap-0 rounded-xl px-4 pt-3.5 pb-3', card.className)}>
+ <div className="flex items-start gap-3">
+ <Skeleton className={cn('h-4', card.wide ? 'w-3/5' : 'w-2/5')} />
+ <Skeleton className="ml-auto h-5 w-16 shrink-0 rounded-full" />
+ </div>
+ <div className="mt-2 flex flex-col gap-1.5">
+ <Skeleton className="h-3 w-full" />
+ <Skeleton className={cn('h-3', card.wide ? 'w-1/2' : 'w-3/4')} />
+ </div>
+ <div className="mt-3 flex items-center gap-2">
+ <Skeleton className="size-5 rounded-full" />
+ <Skeleton className="h-3 w-24" />
+ </div>
+ </Card>
+ ))}
+ </div>
+ )
+}