import { Badge, Box, Button, Group, Paper, Text, ThemeIcon, Tooltip } from "@mantine/core"; import { Download, Eye, FileText } from "lucide-react"; import { isViewable } from "@edr/ui-common"; import { fileViewUrl } from "@/constants/apiConfig"; export interface PhasedUploadedFileRowProps { label: string; file: { id: string; name: string }; onView?: (file: { name: string; url: string }) => void; onDownload?: (file: { id: string; name: string }) => void; compact?: boolean; } /** Inline preview row for a phased customs upload (declaration, transit permit, DO, etc.). */ export function PhasedUploadedFileRow({ label, file, onView, onDownload, compact = false, }: PhasedUploadedFileRowProps) { const viewUrl = fileViewUrl(file.id); const canPreview = isViewable({ name: file.name, url: viewUrl }); return ( {label} Uploaded {file.name} {canPreview && onView ? ( ) : null} {onDownload ? ( ) : null} ); } export function findWorkflowFile( files: Array<{ code: string; file: { id: string; name: string } | null }> | undefined, code: string, ): { id: string; name: string } | null { return files?.find((f) => f.code === code)?.file ?? null; }