| 55 | } |
| 56 | |
| 57 | function getFileColor(name: string, type: string): string { |
| 58 | if (type === "folder") return "#F59E0B"; |
| 59 | const ext = name.split(".").pop()?.toLowerCase() || ""; |
| 60 | if (["ts", "tsx"].includes(ext)) return "#60A5FA"; |
| 61 | if (["js", "jsx"].includes(ext)) return "#FCD34D"; |
| 62 | if (["json"].includes(ext)) return "#4ADE80"; |
| 63 | if (["py"].includes(ext)) return "#93C5FD"; |
| 64 | if (["md", "mdx"].includes(ext)) return "var(--text-secondary)"; |
| 65 | if (["png", "jpg", "jpeg", "gif", "webp", "svg"].includes(ext)) return "#C084FC"; |
| 66 | return "var(--text-secondary)"; |
| 67 | } |
| 68 | |
| 69 | function formatFileSize(bytes: number): string { |
| 70 | if (bytes === 0) return "—"; |