diff --git a/web/src/components/ui/status-dot.tsx b/web/src/components/ui/status-dot.tsx index 05b766c..3b20a76 100644 --- a/web/src/components/ui/status-dot.tsx +++ b/web/src/components/ui/status-dot.tsx @@ -3,6 +3,17 @@ import { cn } from "@/lib/utils"; /** Status-dot vocabulary from the design's `:PiSessions` state matrix. */ export type DotStatus = "busy" | "compacting" | "idle" | "ok" | "err" | "attention" | "exited" | "dead"; +/** + * Blink rate, in shared-clock phases (`web/src/lib/blink.ts`): `fast` follows + * `data-pi-blink-fast` (500ms), `slow` follows `data-pi-blink-slow` (1000ms). + */ +export type BlinkRate = "fast" | "slow"; + +/** + * Colour only. Whether a dot blinks is NOT encoded here: `dot--busy` is amber + * whether it pulses (a running turn) or not (a startup `connecting` chip), so a + * class-keyed dim rule cannot express the matrix. `blink` carries it instead. + */ export const DOT_CLASS: Record = { busy: "dot--busy", compacting: "dot--compacting", @@ -14,6 +25,11 @@ export const DOT_CLASS: Record = { dead: "dot--dead", }; +export const BLINK_CLASS: Record = { + fast: "dot--blink-fast", + slow: "dot--blink-slow", +}; + export type ServerStatus = "online" | "degraded" | "offline"; /** Server / connection status mapping (online → ok, degraded → attention, else exited). */ @@ -27,20 +43,29 @@ export function serverDotClass(status: ServerStatus | string | null | undefined) export interface StatusDotProps { status: DotStatus; + /** + * Blink rate decided by the *view* that owns the dot (`DotView.blink`), never + * by the DOM location or the colour class. Omitted/`null` = solid. + */ + blink?: BlinkRate | null; title?: string; className?: string; - /** Pin the dot solid (no blink) — nvim's "focused child error is steady red". */ - steady?: boolean; /** "You are here" overlay (nvim `PiSessionsListCurrent`, agent blue). */ current?: boolean; /** Decorative by default; pass a title to expose the state to assistive tech. */ "aria-hidden"?: boolean; } -export function StatusDot({ status, title, className, steady, current, ...rest }: StatusDotProps) { +export function StatusDot({ status, blink, title, className, current, ...rest }: StatusDotProps) { return ( {t("chat.tabTasks")} - {running ?