'use client' import type React from 'react' import { useDraggable } from '@dnd-kit/core' import { CSS } from '@dnd-kit/utilities' import { Loader2 } from 'lucide-react' import { cn } from '@/lib/utils' import { CodeBadge } from '@/components/shared/code-badge' import { JOB_STATUS_LABELS, JOB_STATUS_COLORS, JOB_STATUS_ACTIVE } from '@/components/shared/job-status' import { useSoloStore } from '@/stores/solo-store' import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from '@/components/ui/tooltip' import type { SoloTask } from './solo-board' import { debugProps } from '@/lib/debug' const PRIORITY_BORDER: Record = { 1: 'border-l-4 border-l-priority-critical', 2: 'border-l-4 border-l-priority-high', 3: 'border-l-4 border-l-priority-medium', 4: 'border-l-4 border-l-priority-low', } interface SoloTaskCardProps { task: SoloTask isDemo: boolean onClick: () => void } export function SoloTaskCard({ task, isDemo, onClick }: SoloTaskCardProps) { const job = useSoloStore(s => s.claudeJobsByTaskId[task.id]) const { attributes, listeners, setNodeRef, transform, isDragging } = useDraggable({ id: task.id, disabled: isDemo, }) const style: React.CSSProperties | undefined = transform ? { transform: CSS.Translate.toString(transform) } : { viewTransitionName: `solo-task-${task.id}` } return (
{/* Regel 1: taaknaam + task_code */}

{task.title}

{task.task_code && ( }>

{task.title}

{task.description && (

{task.description.slice(0, 100)}

)}
)}
{/* Regels 2–3: beschrijving + pbi_code */}
{task.description ? ( }> {task.description} {task.description.length > 80 && ( {task.description} )} ) : (
)} {task.pbi_code && ( }>

{task.pbi_title}

{task.pbi_description && (

{task.pbi_description.slice(0, 100)}

)}
)}
{/* Regel 4: story-info + job-badge */}

{task.story_code && {task.story_code}} {task.story_title}

{job && ( { e.stopPropagation(); onClick() }} onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault() e.stopPropagation() onClick() } }} role="button" tabIndex={0} aria-label={`Agent-status: ${JOB_STATUS_LABELS[job.status]}`} > {JOB_STATUS_ACTIVE.has(job.status) && } {JOB_STATUS_LABELS[job.status]} )}
) } export function SoloTaskCardOverlay({ task }: { task: SoloTask }) { return (
{/* Regel 1 */}

{task.title}

{task.task_code && }
{/* Regels 2–3 */}
{task.description ? (

{task.description}

) : (
)} {task.pbi_code && }
{/* Regel 4 */}

{task.story_code && {task.story_code}} {task.story_title}

) }