| 1 | import { CircleCheck, CircleDot, CircleSlash, GitMerge, GitPullRequest, GitPullRequestClosed, GitPullRequestDraft } from "lucide-react"; |
| 2 | |
| 3 | import type { Pull, WorkItem } from "@g1t/contracts"; |
| 4 | |
| 5 | /* |
| 6 | * The state icons of work items and pull requests, apart from the rest of |
| 7 | * work.tsx so that a page listing work does not load the Markdown renderer. |
| 8 | */ |
| 9 | |
| 10 | export function ItemIcon({ item, size = 16 }: { item: Pick<WorkItem, "state" | "reason">; size?: number }) { |
| 11 | if (item.state === "open") return <CircleDot size={size} className="shrink-0 text-success" />; |
| 12 | if (item.reason === "not_planned") { |
| 13 | return <CircleSlash size={size} className="shrink-0 text-faint" />; |
| 14 | } |
| 15 | return <CircleCheck size={size} className="shrink-0 text-merged" />; |
| 16 | } |
| 17 | |
| 18 | export function PullIcon({ status, size = 16 }: { status: Pull["status"]; size?: number }) { |
| 19 | if (status === "merged") return <GitMerge size={size} className="shrink-0 text-merged" />; |
| 20 | if (status === "closed") { |
| 21 | return <GitPullRequestClosed size={size} className="shrink-0 text-danger" />; |
| 22 | } |
| 23 | if (status === "draft") { |
| 24 | return <GitPullRequestDraft size={size} className="shrink-0 text-faint" />; |
| 25 | } |
| 26 | return <GitPullRequest size={size} className="shrink-0 text-success" />; |
| 27 | } |