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(desktop): align activity metadata across row (#104280)

Paul D'Ambraddf78ca61388
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityRow.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityRow.test.tsx
index 1a3c43dd2056..f863a4871d5d 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityRow.test.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityRow.test.tsx
@@ -109,11 +109,16 @@ describe("ActivityRow", () => {
);
const title = screen.getByText("Tell me a joke");
- const metadata = screen.getByText("just now · Agent finished in");
- const spaceBadge = screen.getByText("Personal").closest(".quill-badge");
- expect(title.compareDocumentPosition(metadata)).toBe(
+ const time = screen.getByText("just now");
+ const status = screen.getByText("Agent finished in");
+ const spaceBadge = screen
+ .getByText("Personal")
+ .closest<HTMLElement>(".quill-badge");
+ expect(title.compareDocumentPosition(time)).toBe(
Node.DOCUMENT_POSITION_FOLLOWING,
);
+ expect(status.parentElement).toHaveClass("ml-auto");
+ expect(status.parentElement).toContainElement(spaceBadge);
expect(spaceBadge).toHaveClass("quill-badge--variant-default");
const row = title.closest("button");
expect(row).toHaveAccessibleName(
@@ -234,7 +239,7 @@ describe("ActivityRow", () => {
/>,
);
const activityButton = screen
- .getByText("just now · Ann mentioned you")
+ .getByText("Ann mentioned you")
.closest("button");
if (!activityButton) throw new Error("Expected activity row button");
fireEvent.click(activityButton);
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityRow.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityRow.tsx
index bddd7e522eca..fc5eaf56f24f 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityRow.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityRow.tsx
@@ -169,23 +169,24 @@ export function ActivityRow({
{item.isUnread && !compact && <Badge variant="info">New</Badge>}
</span>
<span className="flex min-w-0 items-center gap-1 text-muted-foreground text-xxs">
+ <span className="shrink-0">{presentation.time}</span>
<span
- className="truncate"
+ className="ml-auto flex min-w-0 items-center gap-1"
title={[presentation.metadata, presentation.spaceLabel]
.filter(Boolean)
.join(" ")}
>
- {presentation.metadata}
+ <span className="truncate">{presentation.action}</span>
+ {presentation.spaceLabel && (
+ <Badge
+ variant="default"
+ className="min-w-0 shrink rounded-xs bg-muted/70 p-0"
+ title={presentation.spaceLabel}
+ >
+ <span className="truncate">{presentation.spaceLabel}</span>
+ </Badge>
+ )}
</span>
- {presentation.spaceLabel && (
- <Badge
- variant="default"
- className="min-w-0 shrink rounded-xs bg-muted/70 p-0"
- title={presentation.spaceLabel}
- >
- <span className="truncate">{presentation.spaceLabel}</span>
- </Badge>
- )}
</span>
{item.snippet && !compact && (
<MentionText
diff --git a/products/desktop/packages/ui/src/features/canvas/components/activityPresentation.test.ts b/products/desktop/packages/ui/src/features/canvas/components/activityPresentation.test.ts
index 5ea2b333f612..1a35366ac973 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/activityPresentation.test.ts
+++ b/products/desktop/packages/ui/src/features/canvas/components/activityPresentation.test.ts
@@ -97,9 +97,11 @@ describe("activityPresentation", () => {
],
])("presents a %s", (_name, activity, metadata, agentIcon) => {
expect(activityPresentation(activity, "[email protected]")).toEqual({
+ action: metadata.split(" · ")[1],
metadata,
agentIcon,
spaceLabel: null,
+ time: metadata.split(" · ")[0],
});
});
diff --git a/products/desktop/packages/ui/src/features/canvas/components/activityPresentation.ts b/products/desktop/packages/ui/src/features/canvas/components/activityPresentation.ts
index f28166bfc4f8..2e66f9eecc2b 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/activityPresentation.ts
+++ b/products/desktop/packages/ui/src/features/canvas/components/activityPresentation.ts
@@ -10,8 +10,10 @@ export type AgentActivityIconKind = "chat" | "check" | "question";
export interface ActivityPresentation {
agentIcon: AgentActivityIconKind | null;
+ action: string;
metadata: string;
spaceLabel: string | null;
+ time: string;
}
interface ActivityEventPresentation {
@@ -112,9 +114,12 @@ export function activityPresentation(
const event = activityEventPresentation(item, currentUserEmail);
const spaceLabel = activitySpace(item.channelName);
const action = spaceLabel ? event.actionInSpace : event.action;
+ const time = formatRelativeAge(item.activityAt);
return {
agentIcon: event.agentIcon,
- metadata: [formatRelativeAge(item.activityAt), action].join(" · "),
+ action,
+ metadata: [time, action].join(" · "),
spaceLabel,
+ time,
};
}