221 lines · 6.7 KB
import { Link } from "@tanstack/react-router";
import { CommitAuthor } from "./CommitAuthor";
import { Markdown } from "~/ui/Markdown";
import { Panel } from "~/ui/Panel";
import { RelativeTime } from "~/ui/RelativeTime";
import { StatusDot } from "~/ui/StatusDot";
import { SkeletonLine } from "@cloudflare/kumo/components/loader";
import {
  ArrowBendLeftUpIcon,
  BookOpenTextIcon,
  FileIcon,
  FolderSimpleIcon,
  type Icon as PhosphorIcon,
  LinkSimpleIcon,
  PackageIcon,
  TerminalWindowIcon,
} from "@phosphor-icons/react";
import { TreeToolbar } from "./TreeToolbar";
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 & { authorAccount: string | null };
  commitStatus: StatusState | null;
  /** Latest workflow run for the commit; the status dot links to it, else to the commit's checks. */
  commitRun: number | null;
  readme: { path: string; html: string | null; text: string | null } | null;
  branches: string[];
  tags: string[];
  canWrite: boolean;
  /** The viewer may boot editor containers here (write access, containers on, plan includes them). */
  containersAllowed: boolean;
};