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 24, 15:15 UTC
fix(web): label pull request merge actions (#7381)
Taras committed
Aug 18, 2026 at 23:51 UTC
26af903b9bec7f8da56bb5f545d9980d08d418e1
1 file changed
+26
-12
apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
+26
-12
@@ -147,6 +147,12 @@ const ACTION_SUCCESS_LABELS: Record<PullRequestAction, string> = {
147
"disable-auto-merge": "Auto-merge turned off",
148
};
149
150
+const MERGE_METHOD_LABELS: Record<PullRequestMergeMethod, string> = {
151
+ merge: "Merge",
152
+ squash: "Squash",
153
+ rebase: "Rebase",
154
+};
155
+
156
/** Said as the thing that did not happen, rather than as the operation that returned an error. */
157
const ACTION_FAILURE_LABELS: Record<PullRequestAction, string> = {
158
merge: "Could not merge this pull request",
@@ -460,9 +466,11 @@ export function PullRequestDetailPanel({
466
if (scroller) scroller.scrollTop = Math.max(0, scroller.scrollTop + delta);
467
}, [condensed]);
468
const [mergeMethod, setMergeMethod] = useState<PullRequestMergeMethod>("merge");
463
- const [confirmAction, setConfirmAction] = useState<
464
- "merge" | "close" | "enable-auto-merge" | null
465
- >(null);
469
+ const [confirmation, setConfirmation] = useState<{
470
+ readonly open: boolean;
471
+ readonly action: "merge" | "close" | "enable-auto-merge";
472
+ }>({ open: false, action: "merge" });
473
+ const confirmAction = confirmation.action;
474
// Which handoff is preparing, keyed so a per-finding button can say "Preparing..." on itself
475
// alone. One at a time whatever the key: they all check the same pull request out.
476
const [handoff, setHandoff] = useState<string | null>(null);
@@ -1013,6 +1021,7 @@ export function PullRequestDetailPanel({
1021
const selectedMergeMethod = allowedMergeMethods.includes(mergeMethod)
1022
? mergeMethod
1023
: (allowedMergeMethods[0] ?? "merge");
1024
+ const selectedMergeMethodLabel = MERGE_METHOD_LABELS[selectedMergeMethod];
1025
const conflicting = detail?.state === "open" && detail.mergeability === "conflicting";
1026
// Only an outright yes arms it. A host that reports nothing has not said the merge is already
1027
// spoken for, and an off switch for something that may not be on says the wrong thing twice.
@@ -1297,7 +1306,9 @@ export function PullRequestDetailPanel({
1306
allowedMergeMethods.length > 0 ? (
1307
<MenuItem
1308
disabled={actionPending}
1300
- onClick={() => setConfirmAction("enable-auto-merge")}
1309
+ onClick={() =>
1310
+ setConfirmation({ open: true, action: "enable-auto-merge" })
1311
+ }
1312
>
1313
<GitMergeIcon className="size-3.5" />
1314
Enable auto-merge
@@ -1326,7 +1337,7 @@ export function PullRequestDetailPanel({
1337
icon and the label need their own row to share a line. */}
1338
<span className="flex min-w-0 items-center gap-2">
1339
<GitMergeIcon className="size-3.5" />
1329
- <span className="capitalize">{method}</span>
1340
+ <span>{MERGE_METHOD_LABELS[method]}</span>
1341
</span>
1342
</MenuRadioItem>
1343
))}
@@ -1363,7 +1374,7 @@ export function PullRequestDetailPanel({
1374
<MenuItem
1375
variant="destructive"
1376
disabled={actionPending}
1366
- onClick={() => setConfirmAction("close")}
1377
+ onClick={() => setConfirmation({ open: true, action: "close" })}
1378
>
1379
<GitPullRequestClosedIcon className="size-3.5" />
1380
Close pull request
@@ -1461,9 +1472,9 @@ export function PullRequestDetailPanel({
1472
<Button
1473
size="xs"
1474
disabled={actionPending}
1464
- onClick={() => setConfirmAction("merge")}
1475
+ onClick={() => setConfirmation({ open: true, action: "merge" })}
1476
>
1466
- {pendingAction === "merge" ? "Merging..." : "Merge"}
1477
+ {pendingAction === "merge" ? "Merging..." : selectedMergeMethodLabel}
1478
</Button>
1479
) : null}
1480
</>
@@ -1980,8 +1991,11 @@ export function PullRequestDetailPanel({
1991
</div>
1992
1993
<AlertDialog
1983
- open={confirmAction !== null}
1984
- onOpenChange={(open) => !open && setConfirmAction(null)}
1994
+ open={confirmation.open}
1995
+ onOpenChange={(open) => setConfirmation((current) => ({ ...current, open }))}
1996
+ onOpenChangeComplete={(open) => {
1997
+ if (!open) setConfirmation({ open: false, action: "merge" });
1998
+ }}
1999
>
2000
<AlertDialogPopup>
2001
<AlertDialogHeader>
@@ -2013,7 +2027,7 @@ export function PullRequestDetailPanel({
2027
disabled={actionPending}
2028
onClick={() => {
2029
const action = confirmAction;
2016
- setConfirmAction(null);
2030
+ setConfirmation((current) => ({ ...current, open: false }));
2031
if (action === "merge") void perform("merge", selectedMergeMethod);
2032
if (action === "enable-auto-merge")
2033
void perform("enable-auto-merge", selectedMergeMethod);
@@ -2021,7 +2035,7 @@ export function PullRequestDetailPanel({
2035
}}
2036
>
2037
{confirmAction === "merge"
2024
- ? "Merge"
2038
+ ? selectedMergeMethodLabel
2039
: confirmAction === "enable-auto-merge"
2040
? "Enable auto-merge"
2041
: "Close"}