Misc fixes and additions
Some checks failed
Automated Container Build / build-and-push (push) Failing after 8s

This commit is contained in:
Elijah 2026-05-22 14:27:45 -07:00
parent 724d70e58b
commit 02eefdac0e
9 changed files with 311 additions and 65 deletions

View file

@ -137,6 +137,14 @@ export default function FilePreview({ file, onClose }: FilePreviewProps) {
</div>
)}
{previewType === 'pdf' && (
<iframe
src={`${downloadUrl}#navpanes=0&view=FitH`}
title={file.name}
className="w-full h-full rounded-lg border-0 bg-white"
/>
)}
{(previewType === 'text' || previewType === 'code') && (
<div className="absolute inset-0 p-4">
{loading ? (
@ -200,11 +208,12 @@ export default function FilePreview({ file, onClose }: FilePreviewProps) {
// --- Helpers ---
type PreviewType = 'image' | 'video' | 'audio' | 'text' | 'code' | 'unsupported';
type PreviewType = 'image' | 'video' | 'audio' | 'text' | 'code' | 'pdf' | 'unsupported';
function getPreviewType(file: { name: string; mime_type: string }): PreviewType {
const ext = file.name.split('.').pop()?.toLowerCase() || '';
if (ext === 'pdf' || file.mime_type === 'application/pdf') return 'pdf';
if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'bmp'].includes(ext)) return 'image';
if (['mp4', 'webm', 'ogg'].includes(ext)) return 'video'; // Only browser-supported videos
if (['mp3', 'wav', 'flac', 'm4a', 'aac'].includes(ext)) return 'audio';