(entry: FileEntry)
| 32 | |
| 33 | // Memoized file icon selector |
| 34 | const getFileIcon = (entry: FileEntry) => { |
| 35 | if (entry.is_directory) return Folder; |
| 36 | |
| 37 | const ext = entry.name.split('.').pop()?.toLowerCase(); |
| 38 | switch (ext) { |
| 39 | case 'js': |
| 40 | case 'jsx': |
| 41 | case 'ts': |
| 42 | case 'tsx': |
| 43 | case 'py': |
| 44 | case 'java': |
| 45 | case 'cpp': |
| 46 | case 'c': |
| 47 | case 'go': |
| 48 | case 'rs': |
| 49 | return FileCode; |
| 50 | case 'md': |
| 51 | case 'txt': |
| 52 | case 'json': |
| 53 | case 'xml': |
| 54 | case 'yaml': |
| 55 | case 'yml': |
| 56 | return FileText; |
| 57 | case 'png': |
| 58 | case 'jpg': |
| 59 | case 'jpeg': |
| 60 | case 'gif': |
| 61 | case 'svg': |
| 62 | case 'webp': |
| 63 | return FileImage; |
| 64 | default: |
| 65 | return File; |
| 66 | } |
| 67 | }; |
| 68 | |
| 69 | const formatFileSize = (bytes: number): string => { |
| 70 | if (bytes === 0) return '0 B'; |
no outgoing calls
no test coverage detected