import { IMAGE_EXT, VIDEO_EXT, AUDIO_EXT } from "../utils/mediaTypes"; export function MediaPreview({ projectId, filePath }: { projectId: string; filePath: string }) { const serveUrl = `/api/projects/${projectId}/preview/${filePath}`; const name = filePath.split("/").pop() ?? filePath; if (IMAGE_EXT.test(filePath)) { return (
{name} {filePath}
); } if (VIDEO_EXT.test(filePath)) { return (
); } if (AUDIO_EXT.test(filePath)) { return (
); } // Fonts and other binary — show info instead of binary dump return (
{name} {filePath} Binary file — preview not available
); }