import { Link } from "@tanstack/react-router"; import { Icon } from "~/ui/Icon"; import { cn } from "~/utils/cn"; import type { usePull } from "~/hooks/use-pull"; type StackEntry = ReturnType["stack"][number]; function stateOf(entry: StackEntry): { label: string; dot: string } { if (entry.merged) return { label: "Merged", dot: "bg-merged-500" }; if (entry.state === "closed") return { label: "Closed", dot: "bg-danger-500" }; if (entry.draft) return { label: "Draft", dot: "bg-gray-500" }; return { label: "Open", dot: "bg-success-500" }; } /** The stack this pull request belongs to, newest on top and the trunk at the bottom, like `gt log`. */ export function PullStack({ owner, repo, stack }: { owner: string; repo: string; stack: StackEntry[] }) { if (stack.length === 0) return null; const trunk = stack[0]?.baseRef; const position = stack.findIndex((entry) => entry.current) + 1; return ( ); }