'use client' import type { EvidenceStage } from '@/lib/supabase/storage' type EvidenceFile = { id: string stage: string file_url: string file_type: string uploaded_at: string } interface Props { files: EvidenceFile[] stage?: EvidenceStage } function isImage(type: string) { return type.startsWith('image/') } function isVideo(type: string) { return type.startsWith('video/') } // Supabase Storage image transform endpoint. Falls back to the original object // URL via onError if the project plan has no image transformation. function thumbnailUrl(url: string, width = 320): string { if (!url.includes('/storage/v1/object/public/')) return url return `${url.replace('/storage/v1/object/public/', '/storage/v1/render/image/public/')}?width=${width}&quality=60` } export function EvidenceGallery({ files, stage }: Props) { const filtered = stage ? files.filter(f => f.stage === stage) : files if (filtered.length === 0) return
No files for this stage
return ( ) }