import type { RepositoryRow } from "../../db/index.ts"; import type { SessionUser } from "../../middleware/session.ts"; import type { TreeEntry } from "../../services/git.ts"; import { Layout } from "../layout.tsx"; import { RepoHeader } from "../repos/RepoHeader.tsx"; import { BranchSelector } from "./BranchSelector.tsx"; import { FileTreeTable } from "./FileTreeTable.tsx"; import { RepoNav } from "./RepoNav.tsx"; interface FileTreeProps { user: SessionUser | null; repo: RepositoryRow; ref: string; subpath: string; entries: TreeEntry[]; branches: string[]; tags?: string[]; readmeHtml?: string | null; readmePath?: string; } export function FileTree({ user, repo, ref: treeRef, subpath, entries, branches, tags, readmeHtml, readmePath, }: FileTreeProps) { const parts = subpath ? subpath.split("/") : []; return (
{branches.includes(treeRef) && user?.isAdmin && ( New file )}
{!!subpath && ( )} {!!readmeHtml && (
README {!!readmePath && ( Raw )}
{readmeHtml as "safe"}
)}
); }