import { BookOpen, Braces, CassetteTape, ChevronRight, Code2, Cpu, Disc, File, FileText, FileType, Folder, HardDrive, Image as ImageIcon, MoreVertical, Music, Package, Save, SlidersHorizontal, Terminal, } from 'lucide-react'; import { humanFileSize, type EntryInfo } from '../webdav'; // ─── Extension sets ─────────────────────────────────────────────────────────── export const TEXT_EXTS = new Set(['txt', 'cfg', 'ini', 'seq', 'log', 'csv', 'lst']); export const DOC_EXTS = new Set(['doc', 'docx', 'odt', 'rtf', 'pdf', 'pages', 'tex', 'xls', 'xlsx', 'ods', 'ppt', 'pptx', 'odp']); export const CODE_EXTS = new Set(['asm', 'bas', 's', 'js', 'ts', 'jsx', 'tsx', 'css', 'scss', 'py', 'c', 'cpp', 'h', 'hpp', 'lua', 'sh', 'bash', 'php', 'rb', 'rs', 'go', 'java', 'cs', 'kt', 'sql', 'pl']); export const MD_EXTS = new Set(['md', 'markdown']); export const JSON_EXTS = new Set(['json', 'webmanifest']); export const XML_EXTS = new Set(['xml', 'html', 'htm', 'rss', 'atom', 'xsl']); export const IMAGE_EXTS = new Set(['png', 'jpg', 'jpeg', 'gif', 'bmp', 'webp', 'svg', 'ico']); export const AUDIO_EXTS = new Set(['sid', 'psid', 'rsid', 'mus', 'vgm']); export const ROM_EXTS = new Set(['bin', 'rom', 'crt']); export const TAPE_EXTS = new Set(['tap', 'htap', 't64', 'tcrt']); export const DISK_EXTS = new Set(['c64', 'd41', 'd64', 'd67', 'd71', 'd80', 'd81', 'd82', 'd88', 'f64', 'g41', 'g64', 'g71', 'g81', 'm2i', 'nbz', 'nib', 'p64', 'p71', 'p81', 'scp', 'x64']); export const DISC_EXTS = new Set(['iso', 'img', 'cue']); export const HD_EXTS = new Set(['d1m', 'd2m', 'd4m', 'd90', 'dhd', 'hdd', 'bbt', 'd8b', 'dfi']); export const ARCHIVE_EXTS = new Set(['zip', '7z', 'tar', 'gz', 'bz2', 'xz', 'rar', 'arj', 'lzh', 'ace', 'z', 'lha', 'cab', 'lbr', 'arc', 'ark', 'lnx']); export const CONFIG_EXTS = new Set(['config']); // ─── EntryIcon ──────────────────────────────────────────────────────────────── export function EntryIcon({ entry }: { entry: EntryInfo }) { if (entry.type === 'folder') return ; const ext = entry.name.split('.').pop()?.toLowerCase() ?? ''; if (IMAGE_EXTS.has(ext)) return ; if (DISK_EXTS.has(ext)) return ; if (HD_EXTS.has(ext)) return ; if (DISC_EXTS.has(ext)) return ; if (TAPE_EXTS.has(ext)) return ; if (ROM_EXTS.has(ext)) return ; if (AUDIO_EXTS.has(ext)) return ; if (ARCHIVE_EXTS.has(ext)) return ; if (CONFIG_EXTS.has(ext)) return ; if (JSON_EXTS.has(ext)) return ; if (XML_EXTS.has(ext)) return ; if (MD_EXTS.has(ext)) return ; if (DOC_EXTS.has(ext)) return ; if (CODE_EXTS.has(ext)) return ; if (TEXT_EXTS.has(ext)) return ; return ; } // ─── MediaEntry ─────────────────────────────────────────────────────────────── export interface MediaEntryProps { entry: EntryInfo; onPrimaryClick: () => void; onActionsClick: (e: React.MouseEvent) => void; /** Optional leading slot — e.g. a checkbox in MediaManager. */ leftSlot?: React.ReactNode; /** Replaces the filename text — e.g. an inline rename input. */ nameSlot?: React.ReactNode; selected?: boolean; className?: string; } export function MediaEntry({ entry, onPrimaryClick, onActionsClick, leftSlot, nameSlot, selected, className, }: MediaEntryProps) { return (
{leftSlot}
); }