| 1 | import { |
| 2 | GitMergeIcon, |
| 3 | GitPullRequestArrowIcon, |
| 4 | GitPullRequestClosedIcon, |
| 5 | GitPullRequestDraftIcon, |
| 6 | LayersIcon, |
| 7 | Link2Icon, |
| 8 | Unlink2Icon, |
| 9 | TriangleAlertIcon, |
| 10 | } from "lucide-react"; |
| 11 | import type { PullRequestState } from "@t3tools/contracts"; |
| 12 | |
| 13 | export const PullRequestGlyph = { |
| 14 | pullRequest: GitPullRequestArrowIcon, |
| 15 | reopen: GitPullRequestArrowIcon, |
| 16 | draft: GitPullRequestDraftIcon, |
| 17 | closed: GitPullRequestClosedIcon, |
| 18 | merged: GitMergeIcon, |
| 19 | conflicting: TriangleAlertIcon, |
| 20 | stack: LayersIcon, |
| 21 | link: Link2Icon, |
| 22 | unlink: Unlink2Icon, |
| 23 | } as const; |
| 24 | |
| 25 | export type PullRequestGlyphIcon = (typeof PullRequestGlyph)[keyof typeof PullRequestGlyph]; |
| 26 | |
| 27 | export interface PullRequestStatePresentation { |
| 28 | readonly label: string; |
| 29 | readonly toneClassName: string; |
| 30 | readonly Icon: PullRequestGlyphIcon; |
| 31 | } |
| 32 | |
| 33 | export const PULL_REQUEST_STATE_PRESENTATION = { |
| 34 | open: { |
| 35 | label: "Open", |
| 36 | toneClassName: "text-emerald-600 dark:text-emerald-300/90", |
| 37 | Icon: PullRequestGlyph.pullRequest, |
| 38 | }, |
| 39 | draft: { |
| 40 | label: "Draft", |
| 41 | toneClassName: "text-zinc-500 dark:text-zinc-400/80", |
| 42 | Icon: PullRequestGlyph.draft, |
| 43 | }, |
| 44 | closed: { |
| 45 | label: "Closed", |
| 46 | toneClassName: "text-red-600 dark:text-red-300/90", |
| 47 | Icon: PullRequestGlyph.closed, |
| 48 | }, |
| 49 | merged: { |
| 50 | label: "Merged", |
| 51 | toneClassName: "text-violet-600 dark:text-violet-300/90", |
| 52 | Icon: PullRequestGlyph.merged, |
| 53 | }, |
| 54 | } as const satisfies Record<PullRequestState | "draft", PullRequestStatePresentation>; |