GeezerVison is showing github.com — fix(clients): change requests use their host's own term · pingdotgg/t3code@fd44c38
File treeExpand file treeCollapse file tree Open diff view settings source-control-azure-devops/src/client source-control-bitbucket/src/client source-control-core/src/client source-control-forgejo/src/client source-control-gitcafe/src/client source-control-github/src/client source-control-gitlab/src/client
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/components/ComposerContextSheet.tsx +8-3Lines changed: 8 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,6 +11,7 @@ import type { | 11 | 11 | ScopedThreadRef, | 12 | 12 | } from "@t3tools/contracts"; | 13 | 13 | import { formatAttachmentSize } from "@t3tools/client-runtime/state/attachments"; | | 14 | +import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients"; | 14 | 15 | import { videoMimeType } from "@t3tools/shared/video"; | 15 | 16 | import { Platform, Pressable, ScrollView, View } from "react-native"; | 16 | 17 | import { useSafeAreaInsets } from "react-native-safe-area-context"; | @@ -182,6 +183,10 @@ export function ComposerContextSheet(props: { | 182 | 183 | record?.kind === "review-comment" && "pullRequest" in record | 183 | 184 | ? record.pullRequest?.url | 184 | 185 | : undefined; | | 186 | + const changeRequestTerm = ( | | 187 | + (pullRequestUrl ? sourceControlClients.findByChangeRequestUrl(pullRequestUrl) : undefined) ?? | | 188 | + sourceControlClients.get(undefined) | | 189 | + ).changeRequest.singular; | 185 | 190 | const terminal = record?.kind === "terminal" && !("payload" in record) ? record : null; | 186 | 191 | return ( | 187 | 192 | <Sheet title={terminal?.terminalLabel ?? props.label} onClose={props.onClose}> | @@ -354,12 +359,12 @@ export function ComposerContextSheet(props: { | 354 | 359 | onPress={() => { | 355 | 360 | props.onClose(); | 356 | 361 | void openPullRequest(pullRequestUrl).catch(() => | 357 | | - Dialog.alert("Could not open pull request", "Try again when connected."), | | 362 | + Dialog.alert(`Could not open ${changeRequestTerm}`, "Try again when connected."), | 358 | 363 | ); | 359 | 364 | }} | 360 | 365 | className="rounded-xl bg-subtle p-4" | 361 | 366 | > | 362 | | - <Text className="text-foreground">Open pull request</Text> | | 367 | + <Text className="text-foreground">Open {changeRequestTerm}</Text> | 363 | 368 | </Pressable> | 364 | 369 | ) : null} | 365 | 370 | {props.onOpenAttachment ? ( | @@ -372,7 +377,7 @@ export function ComposerContextSheet(props: { | 372 | 377 | ) : null} | 373 | 378 | {props.onOpenPullRequest && !pullRequestUrl ? ( | 374 | 379 | <Button | 375 | | - label="Open pull request" | | 380 | + label={`Open ${changeRequestTerm}`} | 376 | 381 | tone="secondary" | 377 | 382 | onPress={props.onOpenPullRequest} | 378 | 383 | fullWidth | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/pull-requests/PullRequestControls.tsx +7-3Lines changed: 7 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients"; | 1 | 2 | import Animated from "react-native-reanimated"; | 2 | 3 | import { PR_ROW_LAYOUT } from "./pullRequestAnimations"; | 3 | 4 | import { useNavigation } from "@react-navigation/native"; | @@ -122,7 +123,10 @@ export function PullRequestActionToolbar(props: { | 122 | 123 | const pendingReview = canReview && draft.comments.length > 0; | 123 | 124 | const showAgentControls = agent.canAsk || !permissions.connected; | 124 | 125 | const canOpenThread = agent.threads.length > 0 || showAgentControls; | 125 | | - const threadLabel = agent.threads.length ? "Continue thread" : "Work on PR"; | | 126 | + const { shortLabel } = sourceControlClients.get( | | 127 | + (props.pr ?? props.params.initialSummary)?.provider, | | 128 | + ).changeRequest; | | 129 | + const threadLabel = agent.threads.length ? "Continue thread" : `Work on ${shortLabel}`; | 126 | 130 | const primaryLabel = pendingReview ? `Submit review · ${draft.comments.length}` : threadLabel; | 127 | 131 | const chooseThread = agent.threads.length > 1; | 128 | 132 | const agentActions = agent.actions.filter((action) => action.task !== "ask"); | @@ -162,7 +166,7 @@ export function PullRequestActionToolbar(props: { | 162 | 166 | <View pointerEvents="none"> | 163 | 167 | <IconButton | 164 | 168 | icon="sparkles" | 165 | | - accessibilityLabel="PR agent actions" | | 169 | + accessibilityLabel={`${shortLabel} agent actions`} | 166 | 170 | disabled={agent.disabled} | 167 | 171 | /> | 168 | 172 | </View> | @@ -245,7 +249,7 @@ export function PullRequestActionToolbar(props: { | 245 | 249 | identifier="pull-request-agent" | 246 | 250 | icon="sparkles" | 247 | 251 | title="AI helpers" | 248 | | - accessibilityLabel="PR agent actions" | | 252 | + accessibilityLabel={`${shortLabel} agent actions`} | 249 | 253 | disabled={agent.disabled} | 250 | 254 | separateBackground | 251 | 255 | > | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/pull-requests/PullRequestFiles.tsx +12-3Lines changed: 12 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients"; | 1 | 2 | import { AnimatedLegendList } from "@legendapp/list/reanimated"; | 2 | 3 | import { | 3 | 4 | StackActions, | @@ -49,10 +50,13 @@ function fileDirectory(path: string) { | 49 | 50 | } | 50 | 51 |
| 51 | 52 | function useChangedFiles(params: PullRequestDiffParams) { | 52 | | - const diff = usePullRequestDiff(params); | 53 | 53 | const detail = useEnvironmentQuery(composerPullRequests.detail(pullRequestTarget(params))); | 54 | 54 | // A commit's diff is part of the pull request, so the PR's file counts and viewed state don't apply. | 55 | 55 | const pr = params.commit ? null : detail.data; | | 56 | + const terminology = sourceControlClients.get( | | 57 | + (detail.data ?? params.initialSummary)?.provider, | | 58 | + ).changeRequest; | | 59 | + const diff = usePullRequestDiff(params, terminology); | 56 | 60 | const viewed = usePullRequestFilesViewed(params, pr); | 57 | 61 | const filter = usePullRequestFileFilter(diff.parsed); | 58 | 62 | const parsed = filter.parsed; | @@ -61,6 +65,7 @@ function useChangedFiles(params: PullRequestDiffParams) { | 61 | 65 | filter, | 62 | 66 | viewed, | 63 | 67 | pr, | | 68 | + terminology, | 64 | 69 | parsed, | 65 | 70 | loading: diff.isPending && parsed.kind === "empty" && !diff.error, | 66 | 71 | }; | @@ -261,7 +266,7 @@ export function usePullRequestFilesSection(params: PullRequestParams) { | 261 | 266 | refresh: diff.refresh, | 262 | 267 | header: ( | 263 | 268 | <> | 264 | | - <PullRequestReadStatus pending={false} error={diff.error} /> | | 269 | + <PullRequestReadStatus pending={false} error={diff.error} terminology={files.terminology} /> | 265 | 270 | {loading ? ( | 266 | 271 | <View | 267 | 272 | accessibilityLabel="Loading changed files" | @@ -474,7 +479,11 @@ export function PullRequestFilesSheet({ route }: StaticScreenProps<PullRequestDi | 474 | 479 | estimatedItemSize={64} | 475 | 480 | ListHeaderComponent={ | 476 | 481 | <> | 477 | | - <PullRequestReadStatus pending={false} error={diff.error} /> | | 482 | + <PullRequestReadStatus | | 483 | + pending={false} | | 484 | + error={diff.error} | | 485 | + terminology={files.terminology} | | 486 | + /> | 478 | 487 | {parsed.kind === "files" ? ( | 479 | 488 | <View className="flex-row items-center gap-2 py-2"> | 480 | 489 | <Text textRole="caption" className="min-w-0 flex-1 text-foreground-muted"> | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/pull-requests/PullRequestListRow.tsx +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import { | | 2 | + capitalizeTerm, | | 3 | + sourceControlClients, | | 4 | +} from "@t3tools/client-runtime/source-control-clients"; | 1 | 5 | import { memo } from "react"; | 2 | 6 | import { Pressable, View } from "react-native"; | 3 | 7 | import { AppText as Text } from "../../components/ui/AppText"; | @@ -70,7 +74,7 @@ export const PullRequestListRow = memo( | 70 | 74 | <Pressable | 71 | 75 | accessibilityRole="button" | 72 | 76 | accessibilityState={{ selected: props.selected, busy: props.busy }} | 73 | | - accessibilityLabel={`Pull request ${item.number}, ${item.title}, ${status.label}${conflict ? `, ${conflict.label.toLowerCase()}` : ""}, by ${item.author?.login ?? "unknown author"}${review ? `, ${review.accessibleLabel}` : ""}${item.checksState ? `, checks ${item.checksState}` : ""}${item.stack ? `, stack ${item.stack.position} of ${item.stack.size}` : ""}${item.labels.length ? `, ${item.labels.map((label) => label.name).join(", ")}` : ""}, ${item.additions} additions, ${item.deletions} deletions`} | | 77 | + accessibilityLabel={`${capitalizeTerm(sourceControlClients.get(item.provider).changeRequest.singular)} ${item.number}, ${item.title}, ${status.label}${conflict ? `, ${conflict.label.toLowerCase()}` : ""}, by ${item.author?.login ?? "unknown author"}${review ? `, ${review.accessibleLabel}` : ""}${item.checksState ? `, checks ${item.checksState}` : ""}${item.stack ? `, stack ${item.stack.position} of ${item.stack.size}` : ""}${item.labels.length ? `, ${item.labels.map((label) => label.name).join(", ")}` : ""}, ${item.additions} additions, ${item.deletions} deletions`} | 74 | 78 | accessibilityHint="Double tap to open. Touch and hold for quick actions." | 75 | 79 | onPress={() => props.onSelect(item)} | 76 | 80 | disabled={props.busy} | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx +8-5Lines changed: 8 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2,6 +2,7 @@ import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator"; | 2 | 2 | import * as Dialog from "../../components/ui/Dialog"; | 3 | 3 | import { useAtomRefresh, useAtomSet, useAtomValue } from "@effect/atom-react"; | 4 | 4 | import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime"; | | 5 | +import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients"; | 5 | 6 | import type { PullRequestDetail, PullRequestMergeMethod } from "@t3tools/contracts"; | 6 | 7 | import { AsyncResult } from "effect/reactivity"; | 7 | 8 | import { useRef, useState } from "react"; | @@ -20,6 +21,7 @@ import { | 20 | 21 | mergeUnavailableReason, | 21 | 22 | MERGE_CONFLICT_REASON, | 22 | 23 | MERGE_METHODS, | | 24 | + pullRequestActionLabel, | 23 | 25 | } from "./pullRequestActions"; | 24 | 26 | import { pullRequestStackMerge, singlePullRequestMergeAllowed } from "./pullRequestStack"; | 25 | 27 | import { pullRequestTarget, type PullRequestParams } from "./usePullRequestDiff"; | @@ -33,6 +35,7 @@ export function PullRequestMergeControls(props: { | 33 | 35 | readonly stack: PullRequestStackState; | 34 | 36 | }) { | 35 | 37 | const { pr, stack } = props; | | 38 | + const terminology = sourceControlClients.get(pr.provider).changeRequest; | 36 | 39 | const target = pullRequestTarget(props.params); | 37 | 40 | const permissions = usePullRequestPermissions(props.params, pr); | 38 | 41 | const preferences = useAtomValue(mobilePreferencesAtom); | @@ -53,7 +56,7 @@ export function PullRequestMergeControls(props: { | 53 | 56 | : methods.includes("squash") | 54 | 57 | ? "squash" | 55 | 58 | : methods[0]; | 56 | | - const scope = stack.stack ? pullRequestStackMerge(stack.stack, pr.number) : null; | | 59 | + const scope = stack.stack ? pullRequestStackMerge(stack.stack, pr.number, terminology) : null; | 57 | 60 | const canMergeSingle = singlePullRequestMergeAllowed({ | 58 | 61 | supportsStackActions: stack.supportsStackActions, | 59 | 62 | hasStack: stack.stack !== null, | @@ -64,7 +67,7 @@ export function PullRequestMergeControls(props: { | 64 | 67 | const reason = | 65 | 68 | (!permissions.connected | 66 | 69 | ? "Reconnect to merge." | 67 | | - : mergeUnavailableReason(pr, permissions.canWrite)) ?? | | 70 | + : mergeUnavailableReason(pr, permissions.canWrite, terminology)) ?? | 68 | 71 | (stack.stack | 69 | 72 | ? !stack.supportsStackActions | 70 | 73 | ? "This environment can display stacks but cannot merge them." | @@ -116,7 +119,7 @@ export function PullRequestMergeControls(props: { | 116 | 119 | !canPerformPullRequestAction(fresh, "merge") || | 117 | 120 | !allowedMergeMethods(fresh).includes(method) | 118 | 121 | ) | 119 | | - throw new Error("The pull request changed. Refresh before merging."); | | 122 | + throw new Error(`The ${terminology.singular} changed. Refresh before merging.`); | 120 | 123 | return method; | 121 | 124 | }, | 122 | 125 | } | @@ -144,7 +147,7 @@ export function PullRequestMergeControls(props: { | 144 | 147 | action === "merge" | 145 | 148 | ? scope && scope.layers.length > 1 | 146 | 149 | ? `Merge ${scope.layers.length} stack layers?` | 147 | | - : "Merge pull request?" | | 150 | + : `${pullRequestActionLabel("merge", terminology)}?` | 148 | 151 | : action === "enable-auto-merge" | 149 | 152 | ? "Enable auto-merge?" | 150 | 153 | : "Disable auto-merge?"; | @@ -154,7 +157,7 @@ export function PullRequestMergeControls(props: { | 154 | 157 | : action === "enable-auto-merge" | 155 | 158 | ? `Merge #${pr.number} using ${method} when its requirements are met. This may happen immediately.` | 156 | 159 | : action === "disable-auto-merge" | 157 | | - ? "Stop the provider from automatically merging this pull request." | | 160 | + ? `Stop the provider from automatically merging this ${terminology.singular}.` | 158 | 161 | : `Merge #${pr.number} into ${pr.baseBranch} using ${method}.`; | 159 | 162 | Dialog.alert(title, message, [ | 160 | 163 | { text: "Cancel", style: "cancel" }, | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/pull-requests/PullRequestPresentation.tsx +7-1Lines changed: 7 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator"; | | 2 | +import type { ChangeRequestTerminology } from "@t3tools/client-runtime/source-control-clients"; | 2 | 3 | import type { PullRequestActor } from "@t3tools/contracts"; | 3 | 4 | import IconAlertTriangle from "@tabler/icons-react-native/IconAlertTriangle"; | 4 | 5 | import { Image } from "expo-image"; | @@ -12,11 +13,16 @@ import { EmptyState } from "../../components/ui/EmptyState"; | 12 | 13 | export function PullRequestReadStatus(props: { | 13 | 14 | readonly pending: boolean; | 14 | 15 | readonly error: string | null; | | 16 | + readonly terminology: ChangeRequestTerminology; | 15 | 17 | }) { | 16 | 18 | return props.pending ? ( | 17 | 19 | <AppActivityIndicator className="my-12" colorClassName="accent-icon" /> | 18 | 20 | ) : props.error ? ( | 19 | | - <EmptyState title="Couldn't load this pull request" detail={props.error} variant="plain" /> | | 21 | + <EmptyState | | 22 | + title={`Couldn't load this ${props.terminology.singular}`} | | 23 | + detail={props.error} | | 24 | + variant="plain" | | 25 | + /> | 20 | 26 | ) : null; | 21 | 27 | } | 22 | 28 |
| |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/pull-requests/PullRequestReviewSheet.tsx +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -241,7 +241,9 @@ export function PullRequestReviewSheet({ | 241 | 241 | ) : null} | 242 | 242 | {reviewing && !canSubmitComments ? ( | 243 | 243 | <Text className="text-sm text-danger-foreground"> | 244 | | - You can no longer submit line comments on this pull request. Your drafts are kept here. | | 244 | + You can no longer submit line comments on this{" "} | | 245 | + {sourceControlClients.get(result.data?.provider).changeRequest.singular}. Your drafts are | | 246 | + kept here. | 245 | 247 | </Text> | 246 | 248 | ) : null} | 247 | 249 | {submission.error || result.error || store.error ? ( | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx +6-2Lines changed: 6 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,6 +5,7 @@ import { usePullRequestConnected } from "./usePullRequestConnected"; | 5 | 5 | import { useAtomValue } from "@effect/atom-react"; | 6 | 6 | import { useNavigation, type StaticScreenProps } from "@react-navigation/native"; | 7 | 7 | import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime"; | | 8 | +import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients"; | 8 | 9 | import type { PullRequestReviewerCandidate } from "@t3tools/contracts"; | 9 | 10 | import { useEffect, useRef, useState } from "react"; | 10 | 11 | import { | @@ -61,6 +62,9 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ | 61 | 62 | const target = pullRequestTarget(route.params); | 62 | 63 | const detail = useEnvironmentQuery(composerPullRequests.detail(target)); | 63 | 64 | const pr = detail.data; | | 65 | + const { singular } = sourceControlClients.get( | | 66 | + (pr ?? route.params.initialSummary)?.provider, | | 67 | + ).changeRequest; | 64 | 68 | const canWrite = useAtomValue( | 65 | 69 | composerPullRequests.requestReviewers.permissionAtom(target.environmentId), | 66 | 70 | ); | @@ -194,7 +198,7 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ | 194 | 198 | ) : null} | 195 | 199 | {!allowed ? ( | 196 | 200 | <Text className="text-xs text-foreground-muted"> | 197 | | - Requesting reviews requires write access and an open pull request. | | 201 | + Requesting reviews requires write access and an open {singular}. | 198 | 202 | </Text> | 199 | 203 | ) : null} | 200 | 204 | {error ? ( | @@ -279,7 +283,7 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ | 279 | 283 | <AppActivityIndicator /> | 280 | 284 | ) : ( | 281 | 285 | <Text className="text-danger-foreground"> | 282 | | - {detail.error ?? "Couldn't load this pull request."} | | 286 | + {detail.error ?? `Couldn't load this ${singular}.`} | 283 | 287 | </Text> | 284 | 288 | ) | 285 | 289 | ) : ( | |
|