"use client"; import type { ClientView } from "@/lib/client-view"; import { ApproveButton } from "@/components/client/ApproveButton"; type Task = ClientView["phases"][number]["tasks"][number] & { phaseTitle: string; }; const COLUMNS: { id: "todo" | "in_progress" | "done"; label: string; dotClass: string; headerClass: string }[] = [ { id: "todo", label: "Da fare", dotClass: "bg-[#d4d4d8]", headerClass: "text-[#71717a]" }, { id: "in_progress", label: "In corso", dotClass: "bg-[#DEF168]", headerClass: "text-[#1A463C]" }, { id: "done", label: "Fatto", dotClass: "bg-[#1A463C]", headerClass: "text-[#1A463C]" }, ]; function TaskCard({ task, token }: { task: Task; token: string }) { return (

{task.phaseTitle}

{task.title}

{task.description && (

{task.description}

)} {task.deliverables.length > 0 && ( )}
); } export function ClientKanban({ phases, token }: { phases: ClientView["phases"]; token: string }) { const allTasks: Task[] = phases.flatMap((phase) => phase.tasks.map((task) => ({ ...task, phaseTitle: phase.title })) ); const tasksByStatus = { todo: allTasks.filter((t) => t.status === "todo"), in_progress: allTasks.filter((t) => t.status === "in_progress"), done: allTasks.filter((t) => t.status === "done"), }; return (
{COLUMNS.map((col) => (
{col.label}
{tasksByStatus[col.id].length}
{tasksByStatus[col.id].map((task) => ( ))} {tasksByStatus[col.id].length === 0 && (

Nessun task

)}
))}
); }