Files
Triple-C/app/src/components/ui/StatusIndicator.tsx
T
shadowdaoandClaude Opus 5.5 a93a8135be
Build App (Preview) / compute-version (pull_request) Successful in 5s
Secret Scan / scan (push) Successful in 23s
Secret Scan / scan (pull_request) Successful in 9s
Build App (Preview) / create-release (pull_request) Successful in 3s
Build App (Preview) / build-macos (pull_request) Successful in 6m24s
Build App (Preview) / build-windows (pull_request) Successful in 11m28s
Build App (Preview) / build-linux (pull_request) Successful in 23m6s
Build App (Preview) / test (pull_request) Successful in 26m21s
Build App (Preview) / prune-previews (pull_request) Successful in 5s
fix(aws): settings layout and deploy for anyone who can
Hosts settings live in a 224-320px sidebar; nowrap buttons and long ARNs,
policy names and run summaries overflowed it. Button and StatusIndicator get
an opt-in wrap prop; host, environment, progress and policy rows wrap with
min-w-0 children; policy copy buttons sit in an auto-fill grid; pre blocks
scroll; the Modal footer wraps.

Deploy a new environment and self-join are offered to anyone after a scan.
When the permission check didn't confirm environment-admin rights a note
says AWS has the last word, and the policies and environment request sit
under a 'Not an admin?' disclosure. The boundary note shows whenever the
boundary is missing. AWS refusals show AWS's message (awsErrorMessage now
names the denied action) and offer the admin bundle: in the deploy and join
modals, and under a failed deploy/join run whose output reads as denied.
The backend already had no tier check on onboard_aws_user; its comment is
corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 12:16:55 -08:00

109 lines
2.7 KiB
TypeScript

import type { ProjectStatus } from "../../lib/types";
/**
* Status is never encoded by hue alone: every tone carries a distinct glyph
* shape, and (unless `iconOnly`) a word.
*/
export type StatusTone =
| "running"
| "stopped"
| "busy"
| "error"
| "unknown"
| "ok"
| "off";
interface ToneStyle {
glyph: string;
color: string;
pulse?: boolean;
}
const TONES: Record<StatusTone, ToneStyle> = {
running: { glyph: "●", color: "var(--success)" },
ok: { glyph: "●", color: "var(--success)" },
stopped: { glyph: "○", color: "var(--text-secondary)" },
off: { glyph: "○", color: "var(--text-secondary)" },
busy: { glyph: "◐", color: "var(--warning)", pulse: true },
error: { glyph: "▲", color: "var(--error)" },
// Still being checked — distinct from "unavailable", and it pulses.
unknown: { glyph: "◌", color: "var(--text-disabled)", pulse: true },
};
export const PROJECT_STATUS_TONE: Record<ProjectStatus, StatusTone> = {
running: "running",
stopped: "stopped",
starting: "busy",
stopping: "busy",
error: "error",
};
export const PROJECT_STATUS_LABEL: Record<ProjectStatus, string> = {
running: "Running",
stopped: "Stopped",
starting: "Starting",
stopping: "Stopping",
error: "Error",
};
interface Props {
tone: StatusTone;
label: string;
/** Render the glyph only; `label` still ships as accessible text. */
iconOnly?: boolean;
className?: string;
title?: string;
/** Let a long label (a failure summary) wrap instead of overflowing its container. */
wrap?: boolean;
}
export default function StatusIndicator({
tone,
label,
iconOnly = false,
className = "",
title,
wrap = false,
}: Props) {
const style = TONES[tone];
return (
<span
className={`inline-flex gap-1 ${wrap ? "items-baseline whitespace-normal break-words min-w-0 max-w-full" : "items-center whitespace-nowrap"} ${className}`}
title={title ?? label}
>
<span
aria-hidden="true"
className={`leading-none text-[10px] ${style.pulse ? "animate-status-pulse" : ""}`}
style={{ color: style.color }}
>
{style.glyph}
</span>
{iconOnly ? (
<span className="sr-only">{label}</span>
) : (
<span style={{ color: style.color }}>{label}</span>
)}
</span>
);
}
/** Status pill for a project, derived from `ProjectStatus`. */
export function ProjectStatusIndicator({
status,
iconOnly,
className,
}: {
status: ProjectStatus;
iconOnly?: boolean;
className?: string;
}) {
return (
<StatusIndicator
tone={PROJECT_STATUS_TONE[status]}
label={PROJECT_STATUS_LABEL[status]}
iconOnly={iconOnly}
className={className}
/>
);
}