import type { ClientView } from '@/lib/client-view'; import type { Comment } from '@/db/schema'; import { Progress } from '@/components/ui/progress'; import { Card } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { ApproveButton } from './client/ApproveButton'; import { CommentList } from './client/CommentList'; import { CommentForm } from './client/CommentForm'; interface PhaseTimelineProps { phases: ClientView['phases']; token: string; comments: Comment[]; } function PhaseStatusIcon({ status }: { status: 'upcoming' | 'active' | 'done' }) { if (status === 'done') { return ( ); } if (status === 'active') { return ( ); } return ( ); } function TaskStatusIcon({ status }: { status: 'todo' | 'in_progress' | 'done' }) { if (status === 'done') { return ( ); } if (status === 'in_progress') { return ( ); } return ( ); } const phaseStatusLabel: Record<'upcoming' | 'active' | 'done', string> = { upcoming: 'In arrivo', active: 'In corso', done: 'Completata', }; const phaseStatusStyle: Record<'upcoming' | 'active' | 'done', string> = { upcoming: 'border-transparent bg-[#999999] text-white', active: 'border-transparent bg-[#0066cc] text-white', done: 'border-transparent bg-[#16a34a] text-white', }; export function PhaseTimeline({ phases, token, comments }: PhaseTimelineProps) { if (phases.length === 0) { return (
Nessuna fase ancora configurata.
); } // Helper: filter pre-fetched comments by entity id const commentsFor = (entityId: string) => comments.filter((c) => c.entity_id === entityId); return ({doneCount} di {phase.tasks.length} task
{phase.progress_pct}%
Nessun task ancora configurato.
) : ({task.title}
{task.description && ({task.description}
)} {/* Deliverable annidati con ApproveButton + CommentiDeliverable */} {task.deliverables.length > 0 && (