mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 17:33:51 +02:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work, and task status is one of the most-scanned signals across its whole UI. > - The Tasks UI shows status through small coloured ring icons and chips spread across the list, kanban, task detail, the properties flyout, inline `@`-mentions and the breadcrumb. > - Those ring glyphs lean heavily on colour to distinguish states, which is hard to read for colour-blind users, and the status hues were hard-coded in component classes rather than a single source. > - We want color-blind-safe, distinct *shapes* per status plus a single `--status-*` colour-token system the chips and icons share. > - This pull request adds a unified `StatusGlyph` (one shape per status) and the `--status-*` colour-token system, and adopts them across every task-status surface so the new glyphs + colours render by default. > - The benefit is a more accessible, consistent status language with one source of truth for status hues. ## Linked Issues or Issue Description This is a **feature** (no public issue filed). Following the feature issue template: - **Problem / motivation:** Task status is communicated mostly by colour (ring fills/borders), which is hard to distinguish for colour-blind users, and the status hues are duplicated across component classes with no single source of truth. Several community PRs have nibbled at parts of this (see related PRs below). - **Proposed solution:** A single `StatusGlyph` component with a distinct *shape* per status (not just colour), backed by a `--status-*` CSS-variable colour system (base hues + AA-tuned icon hues + `.status-chip` / `.status-fill` color-mix helpers), adopted across all task-status surfaces. - **Alternatives considered:** Recolouring the existing rings in place (rejected — still colour-only, no shape differentiation). - **Roadmap alignment:** Additive UI only; no overlap with planned core work. Related community PRs (partial / different approaches to the same area — not duplicates): - Refs #3806 — Show issue ref and status icon in breadcrumbs and properties - Refs #1760 — Improve design of cancelled task status icon - Refs #1856 — a11y title/aria-label on status and priority icons ## What Changed - **Colour token system:** `--status-agent-*` / `--status-task-*` base hues, AA-tuned `--status-task-icon-*` hues (light + dark), and `.status-chip` / `.status-fill` color-mix helpers in `index.css`; matching status→CSS-var maps in `status-colors.ts`. - **`StatusGlyph`** — one `viewBox="0 0 24 24"` glyph per status with distinct, color-blind-safe shapes (dashed ring, open ring, half-fill, ring+dot, disc+check, ring+bar, ring+slash, and `in_queue` = the blocked shape recoloured blue). Sizes `sm`/`md`/`lg`. - **Adoption (renders by default)** across `StatusIcon`, `StatusBadge` (agent + issue chips), `MarkdownBody` inline mentions, `IssueRow`, `IssuesList`, `IssueProperties`, `BreadcrumbBar` + `BreadcrumbContext`, and the task-detail header/breadcrumb. - **Tests** for `StatusGlyph`, `StatusIcon`, `StatusBadge`, `IssueRow`, `IssuesList`, `MarkdownBody` lock the rendered behaviour. Scope notes: no experimental flag and no Theme Editor surfaces. The generic `StatusBadge` (runs/goals/approvals) is unchanged. Project-status recolour is deferred (no in-scope consumer). ## Verification - `pnpm --filter @paperclipai/shared build` — green (tsc). - `pnpm --filter @paperclipai/ui build` — green (tsc + vite). - Targeted unit tests green: `StatusGlyph`, `StatusIcon`, `StatusBadge`, `IssueRow`, `IssuesList`, `MarkdownBody`, plus consumer suites that render these (`IssueProperties`, `IssueDetail`, `Search`, `IssueChatThread`, `IssueFiltersPopover`, `InterruptHandoffViews`) — all passing. - Remaining: interactive light + dark visual confirmation across list / kanban / detail / properties / inline mentions / breadcrumb. The glyph shapes + AA-tuned hues were previously QA'd on the originating feature branch. ## Risks Low risk. Additive UI: a new component + CSS tokens, adopted at existing status call sites. The generic `StatusBadge` and all non-status UI are untouched; no schema/migration changes. Behaviour is exercised by unit + consumer test suites. ## Model Used Claude Opus 4.8 (`claude-opus-4-8`), extended thinking, with tool use / code execution (file edits, local builds + vitest). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [ ] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Paperclip <noreply@paperclip.ing>
108 lines
3.8 KiB
TypeScript
108 lines
3.8 KiB
TypeScript
// @vitest-environment node
|
|
|
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
import { describe, expect, it } from "vitest";
|
|
import { StatusIcon } from "./StatusIcon";
|
|
|
|
/**
|
|
* StatusIcon renders the unified {@link StatusGlyph} (one shape per status) at
|
|
* every standalone status surface. These tests lock the glyph rendering, the
|
|
* covered-blocked → "in queue" mapping, the accessible blocked labels, and the
|
|
* size prop.
|
|
*/
|
|
describe("StatusIcon", () => {
|
|
it("renders the unified glyph (24-unit viewBox), not a bespoke ring", () => {
|
|
const html = renderToStaticMarkup(<StatusIcon status="in_progress" />);
|
|
expect(html).toContain('viewBox="0 0 24 24"');
|
|
expect(html).not.toContain("rounded-full border-2");
|
|
});
|
|
|
|
it("drives the glyph colour from the status icon var", () => {
|
|
const html = renderToStaticMarkup(<StatusIcon status="todo" />);
|
|
expect(html).toContain("var(--status-task-icon-todo)");
|
|
});
|
|
|
|
it("maps covered-blocked → In queue (blue in_queue var, no cyan markers)", () => {
|
|
const html = renderToStaticMarkup(
|
|
<StatusIcon
|
|
status="blocked"
|
|
blockerAttention={{
|
|
state: "covered",
|
|
reason: "active_child",
|
|
unresolvedBlockerCount: 1,
|
|
coveredBlockerCount: 1,
|
|
attentionBlockerCount: 0,
|
|
stalledBlockerCount: 0,
|
|
sampleBlockerIdentifier: "PAP-9",
|
|
sampleStalledBlockerIdentifier: null,
|
|
}}
|
|
/>,
|
|
);
|
|
expect(html).toContain("var(--status-task-icon-in_queue)");
|
|
expect(html).not.toContain("bg-cyan");
|
|
expect(html).not.toContain("border-cyan");
|
|
// Full blocked reason still rides on the accessible label.
|
|
expect(html).toContain("Blocked · waiting on active sub-task PAP-9");
|
|
});
|
|
|
|
it("surfaces attention-required blocked copy and keeps the blocked glyph", () => {
|
|
const html = renderToStaticMarkup(
|
|
<StatusIcon
|
|
status="blocked"
|
|
blockerAttention={{
|
|
state: "needs_attention",
|
|
reason: "attention_required",
|
|
unresolvedBlockerCount: 3,
|
|
coveredBlockerCount: 2,
|
|
stalledBlockerCount: 0,
|
|
attentionBlockerCount: 3,
|
|
sampleBlockerIdentifier: "PAP-3541",
|
|
sampleStalledBlockerIdentifier: null,
|
|
}}
|
|
/>,
|
|
);
|
|
expect(html).toContain("Blocked · 3 blockers need attention; 2 covered by active work");
|
|
// needs_attention is not "covered", so it keeps the blocked glyph (not in_queue).
|
|
expect(html).toContain("var(--status-task-icon-blocked)");
|
|
expect(html).not.toContain("var(--status-task-icon-in_queue)");
|
|
});
|
|
|
|
it("surfaces stalled-review blocked copy on the accessible label", () => {
|
|
const html = renderToStaticMarkup(
|
|
<StatusIcon
|
|
status="blocked"
|
|
blockerAttention={{
|
|
state: "stalled",
|
|
reason: "stalled_review",
|
|
unresolvedBlockerCount: 1,
|
|
coveredBlockerCount: 0,
|
|
stalledBlockerCount: 1,
|
|
attentionBlockerCount: 0,
|
|
sampleBlockerIdentifier: "PAP-2279",
|
|
sampleStalledBlockerIdentifier: "PAP-2279",
|
|
}}
|
|
/>,
|
|
);
|
|
expect(html).toContain("Blocked · review stalled on PAP-2279");
|
|
});
|
|
|
|
it("keeps the onChange picker working with the glyph", () => {
|
|
const html = renderToStaticMarkup(<StatusIcon status="todo" onChange={() => {}} />);
|
|
expect(html).toContain('viewBox="0 0 24 24"');
|
|
});
|
|
});
|
|
|
|
describe("StatusIcon — glyph size (PAP-243a)", () => {
|
|
it('forwards size="lg" as a 20px glyph', () => {
|
|
const html = renderToStaticMarkup(<StatusIcon status="todo" size="lg" />);
|
|
expect(html).toContain('width="20"');
|
|
expect(html).toContain('height="20"');
|
|
});
|
|
|
|
it("defaults to a 16px (md) glyph when size is omitted", () => {
|
|
const html = renderToStaticMarkup(<StatusIcon status="todo" />);
|
|
expect(html).toContain('width="16"');
|
|
expect(html).toContain('height="16"');
|
|
});
|
|
});
|