pr_01m47d15m3e54sn21z27rpy5n9/apps/web/app/components/work-icons.tsx
| 1 | import { CircleCheck, CircleDot, CircleSlash, GitMerge, GitPullRequest, GitPullRequestClosed, GitPullRequestDraft } from "lucide-react"; |
| 2 | |
| 3 | import type { Issue, Pull } from "@g1t/contracts"; |
| 4 | |
| 5 | /* |
| 6 | * The state icons of issues 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 IssueIcon({ |
| 11 | issue, |
| 12 | size = 16, |
| 13 | }: { |
| 14 | issue: Pick<Issue, "state" | "reason">; |
| 15 | size?: number; |
| 16 | }) { |
| 17 | if (issue.state === "open") return <CircleDot size={size} className="shrink-0 text-accent" />; |
| 18 | if (issue.reason === "not_planned") { |
| 19 | return <CircleSlash size={size} className="shrink-0 text-faint" />; |
| 20 | } |
| 21 | return <CircleCheck size={size} className="shrink-0 text-merged" />; |
| 22 | } |
| 23 | |
| 24 | export function PullIcon({ status, size = 16 }: { status: Pull["status"]; size?: number }) { |
| 25 | if (status === "merged") return <GitMerge size={size} className="shrink-0 text-merged" />; |
| 26 | if (status === "closed") { |
| 27 | return <GitPullRequestClosed size={size} className="shrink-0 text-danger" />; |
| 28 | } |
| 29 | if (status === "draft") { |
| 30 | return <GitPullRequestDraft size={size} className="shrink-0 text-faint" />; |
| 31 | } |
| 32 | return <GitPullRequest size={size} className="shrink-0 text-accent" />; |
| 33 | } |