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): make the working session row's spinner legible again (#84094)

Adam Leith003521e7f0bd
diff --git a/products/desktop/packages/ui/src/features/sidebar/components/items/TaskStatusDot.test.tsx b/products/desktop/packages/ui/src/features/sidebar/components/items/TaskStatusDot.test.tsx
new file mode 100644
index 000000000000..7a4d428491d9
--- /dev/null
+++ b/products/desktop/packages/ui/src/features/sidebar/components/items/TaskStatusDot.test.tsx
@@ -0,0 +1,49 @@
+import { TaskStatusDot } from "@posthog/ui/features/sidebar/components/items/TaskStatusDot";
+import type { TaskDot } from "@posthog/ui/features/sidebar/components/items/taskStatusVocabulary";
+import { render, screen } from "@testing-library/react";
+import { describe, expect, it } from "vitest";
+
+const working: TaskDot = {
+ tone: "yellow",
+ style: "solid",
+ pulse: false,
+ spinner: true,
+ label: "Working",
+};
+
+const idle: TaskDot = {
+ tone: "gray",
+ style: "hollow",
+ pulse: false,
+ label: "All caught up",
+};
+
+describe("TaskStatusDot", () => {
+ // The two halves of the same constraint, and the pair is the point: the ring
+ // has to outgrow the column to read as a ring at all, and the column has to
+ // stay the plain dot's or every working row's label steps right of its
+ // neighbours'. Measured against a rendered plain dot rather than a hardcoded
+ // 8px, so retuning the vocabulary's sizes moves both marks together.
+ //
+ // jsdom lays nothing out, so this reaches the sizes the component sets and
+ // stops there. Whether the ring is legible at that size, and whether it is
+ // clipped by anything upstream, is not a claim this test makes.
+ it("draws the working ring larger than the column it sits in", () => {
+ render(
+ <>
+ <TaskStatusDot dot={working} />
+ <TaskStatusDot dot={idle} />
+ </>,
+ );
+
+ const column = screen.getByRole("img", { name: "All caught up" }).style
+ .width;
+ const mark = screen.getByRole("img", { name: "Working" });
+ const ring = mark.firstElementChild as HTMLElement;
+
+ expect(mark.style.width).toBe(column);
+ expect(Number.parseFloat(ring.style.width)).toBeGreaterThan(
+ Number.parseFloat(column),
+ );
+ });
+});
diff --git a/products/desktop/packages/ui/src/features/sidebar/components/items/TaskStatusDot.tsx b/products/desktop/packages/ui/src/features/sidebar/components/items/TaskStatusDot.tsx
index c7e689441c96..74d6464da76c 100644
--- a/products/desktop/packages/ui/src/features/sidebar/components/items/TaskStatusDot.tsx
+++ b/products/desktop/packages/ui/src/features/sidebar/components/items/TaskStatusDot.tsx
@@ -20,10 +20,15 @@ import { DotRingSpinner } from "@posthog/ui/primitives/DotRingSpinner";
import type { ReactElement, ReactNode } from "react";
const DOT_SIZE = 8;
-// Exactly the plain dot's box. Anything larger and a working row's label starts
-// further right than its neighbours' — the icon column has to hold one width or
-// the list stops looking like a list.
-const SPINNER_SIZE = DOT_SIZE;
+// Drawn at the row-icon size the rest of the app spins at, not at the dot's own
+// 8px: eight dots inside an 8px box are 1.6px across, and that reads as a smudge
+// rather than as something turning, which leaves the one row that is working the
+// faintest mark in the list.
+const SPINNER_SIZE = 12;
+// The box the ring is centered in and measured by. It stays the plain dot's, so
+// the icon column holds one width and a working row's label lines up with its
+// neighbours' — the ring's extra width spills evenly into the row's padding.
+const SPINNER_BOX = DOT_SIZE;
// Enough to still find the dot if you look for it, not enough to count as one of
// the list's live rows.
const FAINT_OPACITY = 0.4;
@@ -74,12 +79,20 @@ function dotMark(dot: TaskDot, decorative = false): ReactElement {
return (
<span
{...naming}
- className="flex shrink-0 items-center justify-center"
+ className="relative flex shrink-0 items-center justify-center"
// The spinner draws its dots in `currentColor`, so the tone is set
// here rather than passed down.
- style={{ color: TONE_ICON_VAR[dot.tone], width: SPINNER_SIZE }}
+ style={{
+ color: TONE_ICON_VAR[dot.tone],
+ width: SPINNER_BOX,
+ height: SPINNER_BOX,
+ }}
>
- <DotRingSpinner size={SPINNER_SIZE} />
+ <DotRingSpinner
+ size={SPINNER_SIZE}
+ // Out of flow, so the box measures the dot rather than the ring.
+ className="-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2"
+ />
</span>
);
}