"use client"; import { RiAttachmentLine, RiFilePdf2Line, RiImageLine, } from "@remixicon/react"; import { useRouter } from "next/navigation"; import type React from "react"; import { useState, useTransition } from "react"; import { AttachmentGridItem } from "@/features/attachments/components/attachment-grid-item"; import { AttachmentPreview } from "@/features/attachments/components/attachment-preview"; import { useAttachmentUrl } from "@/features/attachments/hooks/use-attachment-url"; import type { AttachmentForPeriod } from "@/features/attachments/queries"; import { fetchTransactionByIdAction } from "@/features/transactions/actions/fetch-by-id"; import type { TransactionDialogOptions } from "@/features/transactions/actions/fetch-dialog-options"; import { fetchTransactionDialogOptionsAction } from "@/features/transactions/actions/fetch-dialog-options"; import { TransactionDetailsDialog } from "@/features/transactions/components/dialogs/transaction-details-dialog"; import { TransactionDialog } from "@/features/transactions/components/dialogs/transaction-dialog/transaction-dialog"; import type { TransactionItem } from "@/features/transactions/components/types"; import { EmptyState } from "@/shared/components/empty-state"; import { Card, CardContent } from "@/shared/components/ui/card"; import { cn } from "@/shared/utils/ui"; type FilterType = "all" | "images" | "pdfs"; function AttachmentGridItemWithUrl({ attachment, onClick, onDetails, isLoadingDetails, }: { attachment: AttachmentForPeriod; onClick: () => void; onDetails: () => void; isLoadingDetails: boolean; }) { const { url, containerRef } = useAttachmentUrl(attachment.attachmentId); return (
{filteredAttachments.length}{" "} {filteredAttachments.length === 1 ? "anexo" : "anexos"} {filter !== "all" && ` · ${FILTERS.find((f) => f.value === filter)?.label.toLowerCase()}`}