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 type { CommitSummary, StatusState, TreeEntry } from "~/lib/types";
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;
};
const ICONS: Record<TreeEntry["type"], string> = { 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("/");
return (
<div className="space-y-4">
<div className="flex flex-wrap items-center gap-3">
<RefSwitcher