The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type { PullRequestInvolvement, PullRequestListState } from "@t3tools/contracts"; |
| 2 | import { |
| 3 | CalendarArrowDownIcon, |
| 4 | CalendarArrowUpIcon, |
| 5 | ClockIcon, |
| 6 | EyeIcon, |
| 7 | LayersIcon, |
| 8 | ListChecksIcon, |
| 9 | Maximize2Icon, |
| 10 | Minimize2Icon, |
| 11 | PenLineIcon, |
| 12 | UserLockIcon, |
| 13 | } from "lucide-react"; |
| 14 | import { msg } from "gt-react"; |
| 15 | |
| 16 | import type { MessageResolver } from "~/i18n/messages"; |
| 17 | |
| 18 | import type { PullRequestFilterOption } from "./PullRequestListFilters"; |
| 19 | import type { PullRequestListSort } from "./pullRequestListPreferences"; |
| 20 | import { PullRequestGlyph } from "./pullRequestIcons"; |
| 21 | |
| 22 | export const INVOLVEMENT_TABS = [ |
| 23 | { value: "all", label: msg("All", { $context: "pull request filter" }), Icon: LayersIcon }, |
| 24 | { |
| 25 | value: "reviewing", |
| 26 | label: msg("Reviewing", { $context: "pull request filter" }), |
| 27 | Icon: EyeIcon, |
| 28 | }, |
| 29 | { |
| 30 | value: "authored", |
| 31 | label: msg("Authored", { $context: "pull request filter" }), |
| 32 | Icon: PenLineIcon, |
| 33 | }, |
| 34 | ] as const satisfies ReadonlyArray<PullRequestFilterOption<PullRequestInvolvement>>; |
| 35 | |
| 36 | export const STATE_TABS = [ |
| 37 | { value: "all", label: msg("All", { $context: "pull request filter" }), Icon: LayersIcon }, |
| 38 | { |
| 39 | value: "open", |
| 40 | label: msg("Open", { $context: "pull request state" }), |
| 41 | Icon: PullRequestGlyph.pullRequest, |
| 42 | }, |
| 43 | { |
| 44 | value: "closed", |
| 45 | label: msg("Closed", { $context: "pull request state" }), |
| 46 | Icon: PullRequestGlyph.closed, |
| 47 | }, |
| 48 | { |
| 49 | value: "merged", |
| 50 | label: msg("Merged", { $context: "pull request state" }), |
| 51 | Icon: PullRequestGlyph.merged, |
| 52 | }, |
| 53 | ] as const satisfies ReadonlyArray<PullRequestFilterOption<PullRequestListState>>; |
| 54 | |
| 55 | export const SORT_OPTIONS = [ |
| 56 | { value: "ready", label: msg("Merge readiness"), Icon: ListChecksIcon }, |
| 57 | { value: "blocked", label: msg("Blocked on me"), Icon: UserLockIcon }, |
| 58 | { value: "updated", label: msg("Recently updated"), Icon: ClockIcon }, |
| 59 | { value: "newest", label: msg("Newest shown"), Icon: CalendarArrowDownIcon }, |
| 60 | { value: "oldest", label: msg("Oldest shown"), Icon: CalendarArrowUpIcon }, |
| 61 | { value: "largest", label: msg("Largest shown"), Icon: Maximize2Icon }, |
| 62 | { value: "smallest", label: msg("Smallest shown"), Icon: Minimize2Icon }, |
| 63 | ] as const satisfies ReadonlyArray<PullRequestFilterOption<PullRequestListSort>>; |
| 64 | |
| 65 | /** Static option tables hold `msg()` labels; components resolve them with `useMessages()`. */ |
| 66 | export function resolveFilterOptions<Option extends { readonly label: string }>( |
| 67 | options: ReadonlyArray<Option>, |
| 68 | resolve: MessageResolver, |
| 69 | ): Option[] { |
| 70 | return options.map((option) => ({ ...option, label: resolve(option.label) })); |
| 71 | } |