Files
paseo/packages/app/src/utils/project-status-badge-content.ts
T
Mohamed BoudraandGitHub ccb668b3b4 Improve sidebar workspace readability and host identity (#2790)
* fix(app): align turn footer actions

Keep running-turn actions in the same position as completed-turn actions and use the shared small icon size for both copy and fork controls.

* feat(app): improve sidebar workspace identity

Make dense sidebar workspace rows easier to scan and let each device control how connected hosts are identified.

* fix(app): keep host badges readable

Use a compact display menu and keep identity color on the host icon so translated controls fit and badge text retains standard contrast.

* fix(app): announce selected sidebar badge mode

* fix(app): retain icon-only host names for screen readers

* fix(app): name hoisted workspace rows

* fix(app): retain host identity in workspace labels

* fix(app): retain workspace status in row labels

* fix(app): defer host appearance until identity resolves

* fix(app): serialize host appearance writes

* fix(app): serialize host registry writes

* fix(app): bound sidebar host badge labels

* test(app): match workspace status labels

* fix(app): consolidate sidebar identity behavior

* test(app): assert status grouping behavior

* fix(app): keep sidebar row actions accessible

* fix(app): stabilize optimistic message layout
2026-08-02 16:58:20 +02:00

30 lines
1.2 KiB
TypeScript

import type { SidebarStateBucket } from "@/utils/sidebar-agent-state";
export type ProjectStatusBadgeDotBucket = "failed" | "attention" | "running";
export type ProjectStatusBadgeContent =
| { kind: "alert" }
| { kind: "dot"; bucket: ProjectStatusBadgeDotBucket };
/**
* What the project status badge should render for a project's aggregate bucket, or null when
* no badge should show at all. Kept as plain data (no React) so it's testable without JSDOM
* or component mounting — see docs/testing.md's two test categories.
*
* Running is a dot like failed and attention rather than its own glyph. The badge is 14pt;
* anything with internal detail at that size loses to a solid disc, so the buckets separate
* by color and — for running alone — by pulsing. Only needs_input earns a glyph, because
* "someone must act" has to survive being the one amber state next to running.
*/
export function getProjectStatusBadgeContent(
statusBucket: SidebarStateBucket | null,
): ProjectStatusBadgeContent | null {
if (statusBucket === "needs_input") {
return { kind: "alert" };
}
if (statusBucket === "failed" || statusBucket === "attention" || statusBucket === "running") {
return { kind: "dot", bucket: statusBucket };
}
return null;
}