"use client"; import { IconListNumbers } from "@tabler/icons-react"; import { useMemo } from "react"; import { useTranslation } from "react-i18next"; import Link from "@/components/routing/app-link"; import { useAppStore } from "@/components/state-provider"; import { settingsActionClassName } from "@/components/settings/settings-control"; import { buildWipQueueViewModel } from "@/lib/tasks/wip-queue-view-model"; export function WipQueueStatus({ taskId }: { taskId: string | null | undefined }) { const { t } = useTranslation(); const snapshots = useAppStore((state) => state.kanbanMulti.snapshots); const activeWorkflowId = useAppStore((state) => state.kanban.workflowId); const activeTasks = useAppStore((state) => state.kanban.tasks); const activeSteps = useAppStore((state) => state.kanban.steps); const workflows = useAppStore((state) => state.workflows.items); const view = useMemo( () => taskId ? buildWipQueueViewModel({ taskId, snapshots, activeWorkflowId, activeTasks, activeSteps, workflows, }) : null, [activeSteps, activeTasks, activeWorkflowId, snapshots, taskId, workflows], ); if (!view) return null; const hasIdentity = view.workflowName !== null && view.destinationTitle !== null; const hasPosition = view.position !== null && view.total !== null; const hasAdmittedCount = view.admittedCount !== null; const hasLimit = view.wipLimit !== null && view.wipLimit > 0; return (
); }