Spaces:
Running
Running
| import type { WorkPackage } from "./work-package-types"; | |
| export type WorkPackageVisualState = "idle" | "running" | "done"; | |
| export function getWorkPackageVersion(workPackage: WorkPackage) { | |
| if (!workPackage.outputs.length) return undefined; | |
| return `v${workPackage.outputs.length}`; | |
| } | |
| export function getWorkPackageVisualState(args: { | |
| workPackage: WorkPackage; | |
| activeWorkPackageId?: string; | |
| }) { | |
| const { workPackage, activeWorkPackageId } = args; | |
| if (activeWorkPackageId && workPackage.id === activeWorkPackageId) { | |
| return "running" satisfies WorkPackageVisualState; | |
| } | |
| if (workPackage.status === "done" && workPackage.outputs.length) { | |
| return "done" satisfies WorkPackageVisualState; | |
| } | |
| return "idle" satisfies WorkPackageVisualState; | |
| } | |