"use client"; import { RiArrowDownSFill, RiArrowUpSFill, RiExternalLinkLine, RiGroupLine, RiVerifiedBadgeFill, } from "@remixicon/react"; import Link from "next/link"; import MoneyValues from "@/components/money-values"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { CardContent } from "@/components/ui/card"; import type { DashboardPagador } from "@/lib/dashboard/pagadores"; import { getAvatarSrc } from "@/lib/pagadores/utils"; import { WidgetEmptyState } from "../widget-empty-state"; type PagadoresWidgetProps = { pagadores: DashboardPagador[]; }; const formatPercentage = (value: number) => { return `${Math.abs(value).toFixed(0)}%`; }; const buildInitials = (value: string) => { const parts = value.trim().split(/\s+/).filter(Boolean); if (parts.length === 0) { return "??"; } if (parts.length === 1) { const firstPart = parts[0]; return firstPart ? firstPart.slice(0, 2).toUpperCase() : "??"; } const firstChar = parts[0]?.[0] ?? ""; const secondChar = parts[1]?.[0] ?? ""; return `${firstChar}${secondChar}`.toUpperCase() || "??"; }; export function PagadoresWidget({ pagadores }: PagadoresWidgetProps) { return ( {pagadores.length === 0 ? ( } title="Nenhum pagador para o período" description="Quando houver despesas associadas a pagadores, eles aparecerão aqui." /> ) : ( )} ); }