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): put the avatar on the title row of feed pr and canvas cards (#110483)

Shy Alter10dd1bf4cd74
diff --git a/frontend/src/scenes/project-homepage/today/Today.stories.tsx b/frontend/src/scenes/project-homepage/today/Today.stories.tsx
index fa6d620a5c39..223a4ae6a0ee 100644
--- a/frontend/src/scenes/project-homepage/today/Today.stories.tsx
+++ b/frontend/src/scenes/project-homepage/today/Today.stories.tsx
@@ -449,23 +449,21 @@ const PERSONAL_BRIEFING: BriefingApi = {
// Today keeps sample mode, the open pane, the sidebar width and the space feed view in local storage, which outlives
// a story. Clearing it makes each story start clean, so only the sample stories show sample reports.
-function clearTodayStorage(Story: () => JSX.Element): JSX.Element {
+// A story's `spaceFeedView` parameter is written after the clear, so it starts with that saved space feed view, the
+// way a returning person sees it.
+function clearTodayStorage(
+ Story: () => JSX.Element,
+ { parameters }: { parameters: { spaceFeedView?: Record<string, unknown> } }
+): JSX.Element {
for (const key of Object.keys(window.localStorage)) {
if (/today|spaceFeedViewLogic/i.test(key)) {
window.localStorage.removeItem(key)
}
}
- return <Story />
-}
-
-/** Starts a story with a saved space feed view, the way a returning person sees it. */
-function withSpaceFeedView(saved: Record<string, unknown>): (Story: () => JSX.Element) => JSX.Element {
- return function SpaceFeedViewDecorator(Story) {
- for (const [reducer, value] of Object.entries(saved)) {
- window.localStorage.setItem(`products.tasks.spaces.spaceFeedViewLogic.${reducer}`, JSON.stringify(value))
- }
- return <Story />
+ for (const [reducer, value] of Object.entries(parameters.spaceFeedView ?? {})) {
+ window.localStorage.setItem(`products.tasks.spaces.spaceFeedViewLogic.${reducer}`, JSON.stringify(value))
}
+ return <Story />
}
const meta: Meta = {
@@ -499,6 +497,9 @@ const meta: Meta = {
200,
SPACES.find((space) => space.id === req.params.id) ?? SPACES[0],
],
+ '/api/users/@me/integrations/codex/': { status: 'not_connected' },
+ '/api/code/invites/check-access/': { has_access: true, has_loops_access: false },
+ '/api/projects/:team_id/tasks/repositories/': { repositories: [] },
'/api/projects/:team_id/tasks/': ({ request }) => {
const params = new URL(request.url).searchParams
const results = params.get('pinned')
@@ -705,32 +706,28 @@ export const SpacesPaneWithRecentFilterMenu: Story = {
}
export const SpacePageListView: Story = {
- decorators: [withSpaceFeedView({ view: 'list' })],
- parameters: { pageUrl: urls.taskSpace('space-checkout') },
+ parameters: { pageUrl: urls.taskSpace('space-checkout'), spaceFeedView: { view: 'list' } },
}
export const SpacePagePullRequests: Story = {
- decorators: [withSpaceFeedView({ types: ['pr'] })],
- parameters: { pageUrl: urls.taskSpace('space-checkout') },
+ parameters: { pageUrl: urls.taskSpace('space-checkout'), spaceFeedView: { types: ['pr'] } },
}
export const SpacePageCanvases: Story = {
- decorators: [withSpaceFeedView({ types: ['canvas'] })],
- parameters: { pageUrl: urls.taskSpace('space-checkout') },
+ parameters: { pageUrl: urls.taskSpace('space-checkout'), spaceFeedView: { types: ['canvas'] } },
}
export const SpacePageCanvasesListView: Story = {
- decorators: [withSpaceFeedView({ types: ['canvas'], view: 'list' })],
- parameters: { pageUrl: urls.taskSpace('space-checkout') },
+ parameters: { pageUrl: urls.taskSpace('space-checkout'), spaceFeedView: { types: ['canvas'], view: 'list' } },
}
export const SpacePageFiltered: Story = {
- decorators: [
- withSpaceFeedView({
+ parameters: {
+ pageUrl: urls.taskSpace('space-checkout'),
+ spaceFeedView: {
filters: { createdBy: 'anyone', sources: [], status: 'unread', pinned: 'any', environment: 'any' },
- }),
- ],
- parameters: { pageUrl: urls.taskSpace('space-checkout') },
+ },
+ },
}
// Right-click at the target's corner, where a person would, so the menu opens beside it.
diff --git a/products/tasks/frontend/spaces/SpaceFeedCanvasRow.tsx b/products/tasks/frontend/spaces/SpaceFeedCanvasRow.tsx
index d9d9ab132e8b..139796c88c70 100644
--- a/products/tasks/frontend/spaces/SpaceFeedCanvasRow.tsx
+++ b/products/tasks/frontend/spaces/SpaceFeedCanvasRow.tsx
@@ -62,13 +62,13 @@ export function SpaceFeedCanvasRow({ canvas, listRow }: SpaceFeedCanvasRowProps)
</Text>
</div>
<Badge className="shrink-0">Canvas</Badge>
+ {avatar}
</div>
{canvas.description && (
<Text size="xs" variant="muted" className="mt-1 line-clamp-2 leading-normal break-words">
{canvas.description}
</Text>
)}
- <div className="mt-3 flex justify-end">{avatar}</div>
</Card>
)
}
diff --git a/products/tasks/frontend/spaces/SpaceFeedPullRequestRow.tsx b/products/tasks/frontend/spaces/SpaceFeedPullRequestRow.tsx
index 9ebb8ec3c70c..b081676a2ae6 100644
--- a/products/tasks/frontend/spaces/SpaceFeedPullRequestRow.tsx
+++ b/products/tasks/frontend/spaces/SpaceFeedPullRequestRow.tsx
@@ -105,11 +105,11 @@ export function SpaceFeedPullRequestRow({
)}
</div>
<Badge className="shrink-0">{known?.label ?? 'Open'}</Badge>
+ {avatar}
</div>
<Text size="xs" variant="muted" className="mt-1.5 truncate">
{pullRequest.repository}
</Text>
- {avatar && <div className="mt-3 flex justify-end">{avatar}</div>}
</Card>
)
}