"use client"; import { useState } from "react"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { TaskList } from "@/components/tasks/TaskList"; import { NewTaskDialog } from "@/components/tasks/NewTaskDialog"; import { cn } from "@/lib/utils"; import { getInitials } from "@/lib/utils"; import { ChevronDown, ChevronRight, Package, CalendarDays, CheckCircle2, } from "lucide-react"; import { ShotStatus } from "@prisma/client"; import { formatDistanceToNow } from "date-fns"; const STATUS_CONFIG: Record< ShotStatus, { label: string; color: string } > = { WAITING: { label: "Waiting", color: "bg-zinc-500/10 text-zinc-400 border-zinc-500/20" }, IN_PROGRESS: { label: "In Progress", color: "bg-blue-500/10 text-blue-400 border-blue-500/20" }, IN_REVIEW: { label: "In Review", color: "bg-purple-500/10 text-purple-400 border-purple-500/20" }, REVISIONS: { label: "Revisions", color: "bg-orange-500/10 text-orange-400 border-orange-500/20" }, COMPLETE: { label: "Complete", color: "bg-emerald-500/10 text-emerald-400 border-emerald-500/20" }, }; const PRIORITY_DOT: Record = { LOW: "bg-zinc-500", NORMAL: "bg-blue-500", HIGH: "bg-amber-500", URGENT: "bg-red-500", }; interface Artist { id: string; name: string | null; email: string; } interface AssetCardProps { asset: { id: string; assetCode: string; name: string; description: string | null; status: ShotStatus; priority: string; dueDate: Date | null; lead?: { id: string; name: string | null; email: string; image: string | null } | null; tasks: any[]; _count?: { tasks: number }; }; projectId: string; artists: Artist[]; canManage?: boolean; } export function AssetCard({ asset, projectId, artists, canManage = false }: AssetCardProps) { const [expanded, setExpanded] = useState(false); const statusCfg = STATUS_CONFIG[asset.status] ?? STATUS_CONFIG.WAITING; const doneTasks = asset.tasks.filter((t: any) => t.status === "DONE").length; return (
{/* Header */} {/* Expanded task list */} {expanded && (
)}
); }