From 77e56b7837d738204e853aea8e4610142cfc1de4 Mon Sep 17 00:00:00 2001 From: Ryan Moon Date: Sun, 29 Mar 2026 10:55:16 -0500 Subject: [PATCH] Make photos and documents clickable, show PDFs with file icon Photos open in new tab on click. PDFs display as a file icon with filename instead of broken image. Both images and PDFs are clickable to view full size in a new browser tab. --- .../src/components/repairs/ticket-photos.tsx | 55 +++++++++++++------ 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/packages/admin/src/components/repairs/ticket-photos.tsx b/packages/admin/src/components/repairs/ticket-photos.tsx index 1e2757c..b529a79 100644 --- a/packages/admin/src/components/repairs/ticket-photos.tsx +++ b/packages/admin/src/components/repairs/ticket-photos.tsx @@ -4,7 +4,7 @@ import { queryOptions } from '@tanstack/react-query' import { api } from '@/lib/api-client' import { useAuthStore } from '@/stores/auth.store' import { Button } from '@/components/ui/button' -import { ImageIcon, Plus, Trash2 } from 'lucide-react' +import { FileText, ImageIcon, Plus, Trash2 } from 'lucide-react' import { toast } from 'sonner' interface FileRecord { @@ -140,22 +140,43 @@ function PhotoSection({

No photos

) : (
- {photos.map((photo) => ( -
- {photo.filename} - -
- ))} + {photos.map((photo) => { + const isPdf = photo.filename?.endsWith('.pdf') || photo.path?.endsWith('.pdf') + return ( +
+ {isPdf ? ( + + + {photo.filename} + + ) : ( + + {photo.filename} + + )} + +
+ ) + })}
)}