import { Link } from "@tanstack/react-router";
import { Badge, EmptyState, LabelChip, RelativeTime } from "./ui/Primitives";
import { cn } from "~/utils/cn";
type Item = {
number: number;
title: string;
state: "open" | "closed";
author: { name: string };
commentsCount: number;
createdAt: number;
labels: Array<{ id: string; name: string; color: string }>;
draft: boolean;
merged: boolean;
};
function StateIcon({ item, kind }: { item: Item; kind: "issue" | "pull" }) {
const tone = item.merged
? "text-violet-400"
: item.state === "open"
? item.draft
? "text-gray-400"
: "text-emerald-400"
: kind === "pull"
? "text-red-400"
: "text-violet-400";
const glyph = kind === "pull" ? (item.merged ? "⇢" : "⇄") : item.state === "open" ? "◉" : "✓";
return (
<span aria-hidden className={cn("w-4 text-center font-mono", tone)}>
{glyph}
</span>
);
}
export function IssueList({
owner,
repo,
items,
kind,
}: {