"use client"; import Link from "next/link"; import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardFooter, CardHeader } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Progress } from "@/components/ui/progress"; import { cn, getInitials, formatRelativeDate } from "@/lib/utils"; import { Film, Layers, CheckCircle2, Clock, Users, ArrowUpRight, } from "lucide-react"; interface ProjectCardProps { project: { id: string; name: string; code: string; status: string; description?: string | null; deadline?: Date | null; createdAt: Date; client?: { company: string } | null; producer?: { name: string | null; image: string | null } | null; _count?: { shots: number }; shotStats?: { total: number; approved: number; inProgress: number; }; }; } const STATUS_STYLES: Record = { ACTIVE: "bg-green-900/60 text-green-300", ON_HOLD: "bg-yellow-900/60 text-yellow-300", COMPLETED: "bg-blue-900/60 text-blue-300", ARCHIVED: "bg-zinc-800 text-zinc-500", }; export function ProjectCard({ project }: ProjectCardProps) { const total = project.shotStats?.total ?? project._count?.shots ?? 0; const approved = project.shotStats?.approved ?? 0; const progress = total > 0 ? Math.round((approved / total) * 100) : 0; return (
{project.code} {project.client && ( • {project.client.company} )}

{project.name}

{project.status.replace("_", " ")}
{project.description && (

{project.description}

)}
{/* Progress */} {total > 0 && (
Shot progress {approved}/{total} approved
)} {/* Stats */}
{total} shots
{approved} done
{project.shotStats?.inProgress ?? 0} active
{project.producer ? ( <> {project.producer.image && } {getInitials(project.producer.name)} {project.producer.name ?? "Producer"} ) : ( <> {formatRelativeDate(project.createdAt)} )} {project.deadline && ( Due {formatRelativeDate(project.deadline)} )}
); }