import Link from "next/link"; import type { FeedItem } from "@/lib/types"; import { relativeTime } from "@/lib/github"; const KIND_LABEL: Record = { issue: { label: "Issue", cn: "议题" }, pull: { label: "Pull", cn: "合并" }, release: { label: "Release", cn: "发布" }, discussion: { label: "Talk", cn: "讨论" }, }; function statePill(state: FeedItem["state"]) { const map: Record = { open: "pill pill-jade", closed: "pill pill-ghost", merged: "pill pill-hot", draft: "pill pill-ghost", published: "pill pill-ochre", }; return {state}; } export function FeedCard({ item, dense = false }: { item: FeedItem; dense?: boolean }) { const k = KIND_LABEL[item.kind]; return (
{k.label} {k.cn} #{item.number} {relativeTime(item.updatedAt)}

{item.title}

{statePill(item.state)} {item.labels.slice(0, 3).map((l) => ( {l.name} ))} @{item.author} {item.comments > 0 && · {item.comments} reply{item.comments === 1 ? "" : "s"}}
); }