"use client"; import Link from "next/link"; import { Badge } from "@kandev/ui/badge"; import { StatusIcon } from "@/app/office/tasks/[id]/status-icon"; import { topoSort } from "./workflow-sort"; import type { Task } from "@/app/office/tasks/[id]/types"; import type { TreeHold } from "@/lib/api/domains/tree-api"; type SubtaskStepperProps = { items: Task["children"]; activeHold: TreeHold | null; }; export function SubtaskStepper({ items, activeHold }: SubtaskStepperProps) { if (items.length === 0) return null; const sorted = topoSort(items); const completedIds = new Set( items .filter((i) => { const s = i.status?.toLowerCase(); return s === "done" || s === "completed" || s === "cancelled"; }) .map((i) => i.id), ); const holdLabel = activeHold?.mode === "pause" ? "Paused" : "Cancelled (tree)"; return (