'use client';
import {
File,
FileArchive,
FileAudio,
FileCode,
FileImage,
FileJson,
FileSpreadsheet,
FileText,
FileVideo,
Folder,
} from 'lucide-react';
interface FileIconProps {
name: string;
type: 'file' | 'dir';
className?: string;
}
const ext = (name: string): string =>
name.split('.').pop()?.toLowerCase() ?? '';
const IMAGE_EXTS = new Set([
'jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'bmp', 'ico',
]);
const VIDEO_EXTS = new Set(['mp4', 'webm', 'mov', 'avi', 'mkv']);
const AUDIO_EXTS = new Set(['mp3', 'wav', 'ogg', 'flac', 'm4a']);
const CODE_EXTS = new Set([
'js', 'ts', 'jsx', 'tsx', 'py', 'go', 'rs', 'css', 'html',
'xml', 'yaml', 'yml', 'sh', 'bash',
]);
const ARCHIVE_EXTS = new Set(['zip', 'tar', 'gz', 'rar', '7z']);
const SHEET_EXTS = new Set(['csv', 'xls', 'xlsx']);
const TEXT_EXTS = new Set(['txt', 'md', 'log']);
export default function FileIcon({ name, type, className = 'w-4 h-4' }: FileIconProps) {
if (type === 'dir') {
return ;
}
const e = ext(name);
if (IMAGE_EXTS.has(e)) return ;
if (VIDEO_EXTS.has(e)) return ;
if (AUDIO_EXTS.has(e)) return ;
if (e === 'pdf') return ; // FilePdf niet beschikbaar in deze versie
if (e === 'json') return ;
if (CODE_EXTS.has(e)) return ;
if (ARCHIVE_EXTS.has(e)) return ;
if (SHEET_EXTS.has(e)) return ;
if (TEXT_EXTS.has(e)) return ;
return ;
}