// ── Dashboard: Recent Leads Table ── // Compact table showing the most recent leads with company (linked), contact, status badge, // assigned user avatar, and date. "View all" link navigates to /leads. "use client" import Link from "next/link" import { motion } from "framer-motion" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Lead } from "@/types" import { ArrowRight } from "lucide-react" /** Color-coded status badge classes */ const statusStyles: Record = { open: "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20", contacted: "bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20", pending: "bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20", closed: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20", ignored: "bg-zinc-500/10 text-zinc-600 dark:text-zinc-400 border-zinc-500/20", } interface RecentLeadsTableProps { leads: Lead[] } /** * RecentLeadsTable — dashboard widget showing the latest leads in a responsive table. * Supports hover row highlighting and staggered-row animations. */ export function RecentLeadsTable({ leads }: RecentLeadsTableProps) { return ( Recent Leads View all
{leads.map((lead, i) => ( ))}
Company Contact Status Assigned Date
{lead.companyName} {lead.contactName} {lead.status.charAt(0).toUpperCase() + lead.status.slice(1)} {lead.assignedUser ? (
{lead.assignedUser.name[0]} {lead.assignedUser.name}
) : ( Unassigned )}
{new Date(lead.createdAt).toLocaleDateString()}
) }