feat(codebase): add file-type specific subtle colored icons to the file tree
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user