mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-08 03:10:26 +00:00
28 lines
697 B
TypeScript
28 lines
697 B
TypeScript
import {
|
|
isRunStatus,
|
|
mapRunToRunItem,
|
|
runStatusDisplay,
|
|
type Run,
|
|
} from "../../data/runs";
|
|
|
|
export type RunDetailRun = ReturnType<typeof mapRunToRunItem> & {
|
|
statusLabel: string;
|
|
statusDot: string;
|
|
statusText: string;
|
|
};
|
|
|
|
export function buildRunDetailRun(summary: Run): RunDetailRun {
|
|
const item = mapRunToRunItem(summary);
|
|
const rawStatus = summary.lifecycle.status;
|
|
const statusKind = rawStatus.kind;
|
|
const display = isRunStatus(statusKind)
|
|
? runStatusDisplay[statusKind]
|
|
: { label: statusKind, dot: "bg-fg-muted", text: "text-fg-muted" };
|
|
|
|
return {
|
|
...item,
|
|
statusLabel: display.label,
|
|
statusDot: display.dot,
|
|
statusText: display.text,
|
|
};
|
|
}
|