Files
PaperClipAI/ui/src/components/StatusIcon.tsx
T
scotttongandScott Tong 8aface6cc3 Keep the unselected In Progress status option still (#23008)
## Thinking Path

> - People use Paperclip to manage work with AI agents.
> - The task status picker shows the current status and the other
choices.
> - A spinning ring indicates a task is in progress.
> - The ring also spun when a task was in review and the user opened the
picker.
> - Keep that option still until the user selects In Progress.

## Linked Issues or Issue Description

**What happened?**

The In Progress option rotated while In Review was selected.

**Expected behavior**

Only an active In Progress status should rotate. Reduced motion should
keep the ring still.

**Steps to reproduce**

1. Open a task in review.
2. Open Change status with reduced motion turned off.
3. Watch the blue ring beside In Progress.

**Paperclip version or commit**

Reproduced at `e18fe61c8f`.

Related work includes the shared task glyph mapping in #19329 and the
empty Kanban column case in #15805.

## What Changed

- Apply the static animation class to the unselected In Progress menu
option.
- Add a regression test for the trigger and option with In Review and In
Progress selected.

## Verification

- Ran the focused component test. The inactive row failed on the
baseline. Both cases passed with the fix.
- Used Chromium on the task detail page. The inactive ring went from one
running CSS animation to zero. The selected option and trigger still
rotated with normal motion and stopped with reduced motion.
- Changed the task to In Progress and back to In Review. Both changes
persisted.
- Local affected UI checks had 3,938 passes and one skip. Three CLI
worktree tests failed while initializing embedded PostgreSQL on the
local host. The remaining 534 CLI tests passed.

## Risks

- The visual change is limited to the unused In Progress row in the
status picker. The test covers the selected row and the trigger.

## Model Used

- OpenAI Codex (GPT-6) with local code execution and browser
verification.

## 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 (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [ ] 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
- [ ] All Paperclip CI gates are green
- [ ] 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: Scott Tong <1504818+scotttong@users.noreply.github.com>
2026-11-26 00:41:10 +00:00

116 lines
4.6 KiB
TypeScript

import { useState } from "react";
import type { IssueBlockerAttention } from "@paperclipai/shared";
import { cn } from "../lib/utils";
import { StatusGlyph, type StatusGlyphSize } from "./StatusGlyph";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import { Button } from "@/components/ui/button";
import { resolveTaskStatusPresentation, taskStatusLabel, type TaskStatusPresentationInput } from "../lib/task-status-presentation";
const allStatuses = ["backlog", "todo", "in_progress", "in_review", "done", "cancelled", "blocked"];
interface StatusIconProps extends TaskStatusPresentationInput {
onChange?: (status: string) => void;
className?: string;
/** Optional layout wrapper around the glyph. Does not change glyph dimensions. */
glyphContainerClassName?: string;
showLabel?: boolean;
/** Glyph size (PAP-243a). Default `md` (16px); lists/detail/mentions use `lg` (20px). */
size?: StatusGlyphSize;
}
/** Shared accessible/tooltip copy, including waiting and covered-blocker states. */
export function getStatusIconLabel(status: string, externalConversationState?: "active" | "waiting" | null, blockerAttention?: IssueBlockerAttention | null, presentationStatus?: string | null): string {
return resolveTaskStatusPresentation({ status, displayStatus: presentationStatus, externalConversationState, blockerAttention }).ariaLabel;
}
/**
* Task/issue status indicator — renders the unified, color-blind-safe
* {@link StatusGlyph} (one distinct shape per status). With `onChange` it also
* acts as a status picker (popover). This one component drives every standalone
* status surface: list, kanban, detail header, properties row + picker flyout,
* sub-task / blocked-by pills, blocked inbox, quicklook, sibling nav, filters,
* search, columns, dashboard.
*
* A "covered" blocked task (waiting on active work) maps to the `in_queue`
* glyph — the blocked shape recoloured blue — while the full blocked reason
* still rides on the accessible label.
*/
export function StatusIcon({ status, displayStatus: presentationStatus, externalConversationState, blockerAttention, onChange, className, glyphContainerClassName, showLabel, size = "md" }: StatusIconProps) {
const [open, setOpen] = useState(false);
const presentation = { status, displayStatus: presentationStatus, externalConversationState, blockerAttention };
const { glyphStatus, label, ariaLabel } = resolveTaskStatusPresentation(presentation);
const glyphIcon = (
<StatusGlyph
status={glyphStatus}
size={size}
className={cn(onChange && !showLabel && "cursor-pointer", className)}
title={ariaLabel}
/>
);
const glyph = glyphContainerClassName ? (
<span className={glyphContainerClassName} data-status-glyph-container="true">
{glyphIcon}
</span>
) : glyphIcon;
if (!onChange) {
return showLabel ? (
<span className="inline-flex items-center gap-1.5">
{glyph}
<span className="text-sm">{label}</span>
</span>
) : (
glyph
);
}
const trigger = showLabel ? (
<button
type="button"
aria-label={`Change status (current: ${ariaLabel})`}
className="inline-flex min-h-5 items-center gap-1.5 cursor-pointer hover:bg-accent/50 rounded px-1 -mx-1 py-0.5 transition-colors"
>
{glyph}
<span className="text-sm">{label}</span>
</button>
) : (
<button
type="button"
data-slot="icon-button"
aria-label={`Change status (current: ${ariaLabel})`}
className="inline-flex cursor-pointer items-center justify-center rounded-sm focus-visible:outline-none focus-visible:ring-(length:--rad-3) focus-visible:ring-ring"
>
{glyph}
</button>
);
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>{trigger}</PopoverTrigger>
<PopoverContent className="w-40 p-1" align="start">
{allStatuses.map((s) => (
<Button
key={s}
variant="ghost"
size="sm"
className={cn("w-full justify-start gap-2 text-xs", s === status && "bg-accent")}
onClick={() => {
onChange(s);
setOpen(false);
}}
>
{/* The current row is the task's state: draw it exactly like the trigger. */}
<StatusIcon
{...(s === status ? presentation : { status: s })}
size="lg"
className={s === "in_progress" && s !== status ? "motion-safe:animate-none" : undefined}
/>
{taskStatusLabel(s)}
</Button>
))}
</PopoverContent>
</Popover>
);
}