diff --git a/apps/web/components/kanban/mobile-task-sheet.tsx b/apps/web/components/kanban/mobile-task-sheet.tsx index 7154705305..7021103475 100644 --- a/apps/web/components/kanban/mobile-task-sheet.tsx +++ b/apps/web/components/kanban/mobile-task-sheet.tsx @@ -12,6 +12,7 @@ import { import { Badge } from "@kandev/ui/badge"; import { IconArrowRight, IconEdit, IconTrash } from "@tabler/icons-react"; import type { Task } from "@/components/kanban-card"; +import { formatTaskStateLabel } from "@/lib/ui/state-labels"; type MobileTaskSheetProps = { task: Task | null; @@ -42,7 +43,7 @@ export function MobileTaskSheet({ )}
- {task.state ?? "not_started"} + {formatTaskStateLabel(task.state)}
diff --git a/apps/web/lib/ui/state-labels.ts b/apps/web/lib/ui/state-labels.ts new file mode 100644 index 0000000000..8eb5e457f2 --- /dev/null +++ b/apps/web/lib/ui/state-labels.ts @@ -0,0 +1,34 @@ +import type { TaskState, TaskSessionState } from "@/lib/types/http"; + +const TASK_STATE_LABELS: Record = { + CREATED: "Created", + SCHEDULING: "Scheduling", + TODO: "To do", + IN_PROGRESS: "In progress", + REVIEW: "Review", + BLOCKED: "Blocked", + WAITING_FOR_INPUT: "Waiting for input", + COMPLETED: "Completed", + FAILED: "Failed", + CANCELLED: "Cancelled", +}; + +const TASK_SESSION_STATE_LABELS: Record = { + CREATED: "Created", + STARTING: "Starting", + RUNNING: "Running", + WAITING_FOR_INPUT: "Waiting for input", + COMPLETED: "Completed", + FAILED: "Failed", + CANCELLED: "Cancelled", +}; + +export function formatTaskStateLabel(state: TaskState | null | undefined): string { + if (!state) return "Not started"; + return TASK_STATE_LABELS[state] ?? state; +} + +export function formatTaskSessionStateLabel(state: TaskSessionState | null | undefined): string { + if (!state) return ""; + return TASK_SESSION_STATE_LABELS[state] ?? state; +}