"use client"; import { RiAttachmentLine, RiFileLine, RiFilePdf2Line, RiImageLine, } from "@remixicon/react"; import { useState } from "react"; import { AttachmentPreview } from "@/features/attachments/components/attachment-preview"; import type { AttachmentForPeriod } from "@/features/attachments/queries"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/shared/components/ui/tooltip"; import { WidgetEmptyState } from "@/shared/components/widgets/widget-empty-state"; import { formatDateOnly } from "@/shared/utils/date"; import { formatBytes } from "@/shared/utils/number"; type AttachmentsSnapshot = { totalCount: number; totalBytes: number; imageCount: number; pdfCount: number; recentAttachments: AttachmentForPeriod[]; }; type AttachmentsWidgetProps = { snapshot: AttachmentsSnapshot; }; export function AttachmentsWidget({ snapshot }: AttachmentsWidgetProps) { const [selectedIndex, setSelectedIndex] = useState(-1); if (snapshot.totalCount === 0) { return ( } title="Nenhum anexo no período" description="Adicione comprovantes nos seus lançamentos para vê-los aqui." /> ); } return ( <>
{snapshot.totalCount} {snapshot.totalCount === 1 ? "anexo" : "anexos"} {formatBytes(snapshot.totalBytes)} {snapshot.imageCount > 0 && ( {snapshot.imageCount} )} {snapshot.pdfCount > 0 && ( {snapshot.pdfCount} )}
setSelectedIndex(-1)} /> ); }