"use client"; import { useSortable } from "@dnd-kit/sortable"; import { CSS } from "@dnd-kit/utilities"; import { cn } from "@/lib/utils"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Feature } from "@/store/app-store"; import { GripVertical, Edit, CheckCircle2, Circle, Loader2, Trash2, Eye, PlayCircle, RotateCcw, StopCircle } from "lucide-react"; import { CountUpTimer } from "@/components/ui/count-up-timer"; interface KanbanCardProps { feature: Feature; onEdit: () => void; onDelete: () => void; onViewOutput?: () => void; onVerify?: () => void; onResume?: () => void; onForceStop?: () => void; hasContext?: boolean; isCurrentAutoTask?: boolean; } export function KanbanCard({ feature, onEdit, onDelete, onViewOutput, onVerify, onResume, onForceStop, hasContext, isCurrentAutoTask }: KanbanCardProps) { // Disable dragging if the feature is in progress or verified const isDraggable = feature.status === "backlog"; const { attributes, listeners, setNodeRef, transform, transition, isDragging, } = useSortable({ id: feature.id, disabled: !isDraggable, }); const style = { transform: CSS.Transform.toString(transform), transition, }; return ( {isCurrentAutoTask && (
Running... {feature.startedAt && ( )}
)} {/* Show timer for in_progress cards that aren't currently running */} {!isCurrentAutoTask && feature.status === "in_progress" && feature.startedAt && (
)}
{isDraggable && (
)}
{feature.description} {feature.category}
{/* Steps Preview */} {feature.steps.length > 0 && (
{feature.steps.slice(0, 3).map((step, index) => (
{feature.status === "verified" ? ( ) : ( )} {step}
))} {feature.steps.length > 3 && (

+{feature.steps.length - 3} more steps

)}
)} {/* Actions */}
{isCurrentAutoTask && ( <> {onViewOutput && ( )} {onForceStop && ( )} )} {!isCurrentAutoTask && feature.status === "in_progress" && ( <> {hasContext && onResume ? ( ) : onVerify ? ( ) : null} {onViewOutput && ( )} )} {!isCurrentAutoTask && feature.status !== "in_progress" && ( <> )}
); }