import { Link } from "@tanstack/react-router"; import { Markdown, Panel, RelativeTime, StatusDot } from "./ui/Primitives"; import { buttonClass } from "./ui/Button"; import { Breadcrumbs, RefSwitcher } from "./RefNavigation"; import { useLastCommits } from "~/hooks/use-last-commits"; import type { CommitSummary, StatusState, TreeEntry } from "~/lib/types"; import type { CommitBrief } from "~/lib/code-intel"; type Props = { owner: string; repo: string; gitRef: { kind: string; name: string; sha: string }; path: string; entries: TreeEntry[]; commit: CommitSummary; commitStatus: StatusState | null; readme: { path: string; html: string | null; text: string | null } | null; branches: string[]; tags: string[]; canWrite: boolean; }; function EntryCommit({ commit }: { commit: CommitBrief | null | undefined }) { if (commit === undefined) return ; if (commit === null) return null; return ( {commit.subject} ); } const ICONS: Record = { tree: "▸", blob: "·", exec: "⚙", symlink: "↪", gitlink: "⊙" }; export function TreeView({ owner, repo, gitRef, path, entries, commit, commitStatus, readme, branches, tags, canWrite, }: Props) { const parent = path.split("/").slice(0, -1).join("/"); const lastCommits = useLastCommits(owner, repo, gitRef.sha, path); return (
Go to file Search code History {branches.length} branches {canWrite && gitRef.kind === "branch" && ( Add file )} Download
{commit.authorName} {commit.subject}
} actions={ {commit.shortSha} · } > {readme && ( {readme.path}
}>
{readme.html !== null ? ( ) : (
{readme.text}
)}
)} ); }