feat(codebase): add file-type specific subtle colored icons to the file tree

This commit is contained in:
2026-06-14 12:59:07 -07:00
parent bb5d879a0d
commit 249d88f405
2 changed files with 68 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import { useEffect, useState, useCallback } from "react";
import { Loader2, AlertCircle } from "lucide-react";
import { Tree, Folder, File } from "@/components/ui/file-tree";
import { THEME } from "@/components/project/dashboard-ui";
import { getFileIconAndColor } from "@/components/project/file-icons";
interface TreeItem {
name: string;
@@ -240,6 +241,9 @@ export function GiteaFileTree({
</Folder>
);
}
const { icon: FileIconComponent, color } = getFileIconAndColor(item.name);
return (
<File
key={item.path}
@@ -247,6 +251,9 @@ export function GiteaFileTree({
handleSelect={() => onSelectFile?.(item.path)}
isSelectable={!!onSelectFile}
isSelect={selectedPath === item.path}
fileIcon={
<FileIconComponent size={15} style={{ color, marginRight: 2 }} />
}
>
<span>{item.name}</span>
</File>