The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { Chip } from "../../components/ui/Chip"; |
| 2 | import { PullRequestSectionHeading } from "./PullRequestSectionHeading"; |
| 3 | import type { PullRequestListEntry, PullRequestSummary } from "@t3tools/contracts"; |
| 4 | import { T, useGT, useMessages } from "gt-react-native"; |
| 5 | import { View } from "react-native"; |
| 6 | import { PullRequestCardGroup, PullRequestCardRow } from "./PullRequestControls"; |
| 7 | import { PullRequestStackCard } from "./PullRequestStackCard"; |
| 8 | import type { PullRequestParams } from "./usePullRequestDiff"; |
| 9 | import type { PullRequestStackState } from "./usePullRequestStack"; |
| 10 | import { pullRequestListReviewStatus } from "./pullRequestList"; |
| 11 | import { PullRequestGlyph } from "./pullRequestGlyphs"; |
| 12 | |
| 13 | export function PullRequestOverviewLoading({ |
| 14 | summary, |
| 15 | params, |
| 16 | stack, |
| 17 | }: { |
| 18 | readonly summary: PullRequestListEntry | PullRequestSummary; |
| 19 | readonly params: PullRequestParams; |
| 20 | readonly stack: PullRequestStackState; |
| 21 | }) { |
| 22 | const gt = useGT(); |
| 23 | const m = useMessages(); |
| 24 | const review = pullRequestListReviewStatus( |
| 25 | { |
| 26 | reviewDecision: summary.reviewDecision ?? undefined, |
| 27 | viewerReviewRequested: "viewerReviewRequested" in summary && summary.viewerReviewRequested, |
| 28 | }, |
| 29 | m, |
| 30 | ); |
| 31 | const conflicting = summary.mergeability === "conflicting"; |
| 32 | const clean = summary.mergeability === "mergeable"; |
| 33 | return ( |
| 34 | <View |
| 35 | className="gap-5" |
| 36 | accessibilityLabel={gt("Loading pull request details")} |
| 37 | accessibilityState={{ busy: true }} |
| 38 | > |
| 39 | <PullRequestStackCard params={params} state={stack} /> |
| 40 | <PullRequestCardGroup> |
| 41 | <PullRequestCardRow |
| 42 | compact |
| 43 | title={ |
| 44 | summary.checksState === "passing" |
| 45 | ? gt("Checks completed") |
| 46 | : summary.checksState === "failing" |
| 47 | ? gt("Checks failing") |
| 48 | : summary.checksState === "pending" |
| 49 | ? gt("Checks running") |
| 50 | : gt("Checks", { $context: "CI checks row" }) |
| 51 | } |
| 52 | icon={ |
| 53 | summary.checksState === "passing" |
| 54 | ? "checkmark.circle" |
| 55 | : summary.checksState === "failing" |
| 56 | ? "exclamationmark.circle" |
| 57 | : "clock" |
| 58 | } |
| 59 | tint={ |
| 60 | summary.checksState === "passing" |
| 61 | ? "accent-adaptive-emerald-600-400" |
| 62 | : summary.checksState === "failing" |
| 63 | ? "accent-danger-foreground" |
| 64 | : "accent-icon-muted" |
| 65 | } |
| 66 | > |
| 67 | <View className="h-3 w-16 rounded bg-subtle-strong" /> |
| 68 | </PullRequestCardRow> |
| 69 | <PullRequestCardRow |
| 70 | compact |
| 71 | title={review?.accessibleLabel ?? gt("Reviews")} |
| 72 | icon={review?.icon ?? "bubble.left"} |
| 73 | tint={review?.tint} |
| 74 | > |
| 75 | <View className="h-3 w-20 rounded bg-subtle-strong" /> |
| 76 | </PullRequestCardRow> |
| 77 | <PullRequestCardRow |
| 78 | compact |
| 79 | title={ |
| 80 | conflicting |
| 81 | ? gt("Conflicts with {branch}", { branch: summary.baseBranch }) |
| 82 | : clean |
| 83 | ? gt("No conflicts with {branch}", { branch: summary.baseBranch }) |
| 84 | : gt("Branch", { $context: "git branch" }) |
| 85 | } |
| 86 | icon={ |
| 87 | conflicting ? PullRequestGlyph.conflicting : clean ? "checkmark.circle" : "arrow.branch" |
| 88 | } |
| 89 | tint={ |
| 90 | conflicting |
| 91 | ? "accent-danger-foreground" |
| 92 | : clean |
| 93 | ? "accent-adaptive-emerald-600-400" |
| 94 | : undefined |
| 95 | } |
| 96 | /> |
| 97 | <View className="border-t border-border-subtle p-3"> |
| 98 | <View className="h-11 rounded-xl bg-subtle-strong" /> |
| 99 | </View> |
| 100 | </PullRequestCardGroup> |
| 101 | {"labels" in summary && summary.labels.length ? ( |
| 102 | <View className="flex-row flex-wrap gap-2"> |
| 103 | {summary.labels.map((label) => ( |
| 104 | <Chip key={label.name} label={label.name} size="small" /> |
| 105 | ))} |
| 106 | </View> |
| 107 | ) : null} |
| 108 | <View className="gap-3"> |
| 109 | <PullRequestSectionHeading> |
| 110 | <T>Description</T> |
| 111 | </PullRequestSectionHeading> |
| 112 | <View className="gap-3 py-1"> |
| 113 | <View className="h-4 w-full rounded bg-subtle-strong" /> |
| 114 | <View className="h-4 w-full rounded bg-subtle-strong" /> |
| 115 | <View className="h-4 w-3/4 rounded bg-subtle-strong" /> |
| 116 | </View> |
| 117 | </View> |
| 118 | </View> |
| 119 | ); |
| 120 | } |