diff --git a/packages/admin/src/components/repairs/ticket-photos.tsx b/packages/admin/src/components/repairs/ticket-photos.tsx index b529a79..91f78f4 100644 --- a/packages/admin/src/components/repairs/ticket-photos.tsx +++ b/packages/admin/src/components/repairs/ticket-photos.tsx @@ -7,6 +7,15 @@ import { Button } from '@/components/ui/button' import { FileText, ImageIcon, Plus, Trash2 } from 'lucide-react' import { toast } from 'sonner' +async function openSignedFile(fileId: string) { + try { + const res = await api.get<{ url: string }>(`/v1/files/signed-url/${fileId}`) + window.open(res.url, '_blank') + } catch { + toast.error('Failed to open file') + } +} + interface FileRecord { id: string path: string @@ -145,27 +154,22 @@ function PhotoSection({ return (
{isPdf ? ( - openSignedFile(photo.id)} + className="h-20 w-20 rounded-md border flex flex-col items-center justify-center bg-muted hover:bg-muted/80 transition-colors cursor-pointer" > {photo.filename} - + ) : ( - + )}