MCPcopy Create free account
hub / github.com/winfunc/opcode / getFileIcon

Function getFileIcon

src/components/FilePicker.tsx:54–76  ·  view source on GitHub ↗
(entry: FileEntry)

Source from the content-addressed store, hash-verified

52
53// File icon mapping based on extension
54const getFileIcon = (entry: FileEntry) => {
55 if (entry.is_directory) return Folder;
56
57 const ext = entry.extension?.toLowerCase();
58 if (!ext) return File;
59
60 // Code files
61 if (['ts', 'tsx', 'js', 'jsx', 'py', 'rs', 'go', 'java', 'cpp', 'c', 'h'].includes(ext)) {
62 return FileCode;
63 }
64
65 // Text/Markdown files
66 if (['md', 'txt', 'json', 'yaml', 'yml', 'toml', 'xml', 'html', 'css'].includes(ext)) {
67 return FileText;
68 }
69
70 // Image files
71 if (['png', 'jpg', 'jpeg', 'gif', 'svg', 'webp', 'ico'].includes(ext)) {
72 return FileImage;
73 }
74
75 return File;
76};
77
78// Format file size to human readable
79const formatFileSize = (bytes: number): string => {

Callers 1

FilePickerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected