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