import { Avatar, AvatarFallback } from "@/components/ui/avatar" interface VendaRecente { id: string valor_centavos: number created_at: string metodo_pagamento: string | null clientes: { nome: string; email: string } | null produtos: { nome: string } | null } export function RecentSales({ vendas }: { vendas: VendaRecente[] }) { if (vendas.length === 0) { return (

Nenhuma venda confirmada ainda.

) } return (
{vendas.map((v) => { const initials = (v.clientes?.nome ?? "?") .split(" ") .slice(0, 2) .map((n) => n[0]) .join("") .toUpperCase() return (
{initials}

{v.clientes?.nome ?? "—"}

{v.produtos?.nome ?? "—"}

{(v.valor_centavos / 100).toLocaleString("pt-BR", { style: "currency", currency: "BRL", })}

{new Date(v.created_at).toLocaleDateString("pt-BR")}

) })}
) }