import type { TreeEntry } from "../../services/git.ts"; interface FileTreeTableProps { repoName: string; treeRef: string; subpath: string; entries: TreeEntry[]; } export function FileTreeTable({ repoName, treeRef, subpath, entries, }: FileTreeTableProps) { const parts = subpath ? subpath.split("/") : []; const parentPath = parts.slice(0, -1).join("/"); const parentHref = parentPath ? `/${repoName}/tree/${treeRef}/${parentPath}` : `/${repoName}/tree/${treeRef}`; const sorted = [...entries].sort((a, b) => { if (a.type !== b.type) return a.type === "tree" ? -1 : 1; return a.name.localeCompare(b.name); }); return (
| {DirIcon()} | .. | |
| {entry.type === "tree" ? DirIcon() : FileIcon()} | {entry.name} | {entry.type === "blob" && entry.size !== "-" ? formatSize(parseInt(entry.size, 10)) : ""} |