@devries-cameron20 / t3code Mirror · read-only / commits / 8c628f1499
Fork 0

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, 16:30 UTC

fix(web): align pull request action menu rows (#6534)

Co-authored-by: Nickolas Kyryliuk <nickolaskyryliuk@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

Bilal Bakr committed Aug 15, 2026 at 05:48 UTC 8c628f14993cb159d467e7a0f8c52578dde77005
5 files changed +74 -9
apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
+34 -8
@@ -103,6 +103,7 @@ import {
103 handoffPrompt,
104 handoffReviewComments,
105 pullRequestActionNeedsHostRefresh,
106 + pullRequestActionMenuHasGroup,
107 pullRequestFindingKey,
108 pullRequestHandoffLabels,
109 readableFailure,
@@ -1033,6 +1034,26 @@ export function PullRequestDetailPanel({
1034 : allowedMergeMethods.length > 0
1035 ? "merge"
1036 : null;
1037 + // What the menu's action group holds. Named once so the separators around it are drawn from
1038 + // the same answer as its contents, rather than on the assumption that it has any.
1039 + const showsDraftToggle =
1040 + detail?.state === "open" &&
1041 + can(detail.isDraft ? "ready" : "draft") &&
1042 + !(detail.isDraft && primaryAction === "ready");
1043 + const showsAutoMerge =
1044 + detail?.state === "open" &&
1045 + ((autoMergeArmed && can("disable-auto-merge")) ||
1046 + (!autoMergeArmed &&
1047 + !detail.isDraft &&
1048 + !conflicting &&
1049 + can("enable-auto-merge") &&
1050 + allowedMergeMethods.length > 0));
1051 + const showsMergeMethods =
1052 + detail?.state === "open" &&
1053 + can("merge") &&
1054 + !detail.isDraft &&
1055 + !conflicting &&
1056 + allowedMergeMethods.length > 1;
1057 // The pull request number carries this state in the overview and the right-panel tab mirrors
1058 // it. Conflicts keep their own row below: an open pull request remains green there.
1059 const statePresentation = detail
@@ -1191,8 +1212,7 @@ export function PullRequestDetailPanel({
1212 {/* Only where the button row could not take it: "Ready for review" on a
1213 draft is the primary header button, so offering it here as well would
1214 show the same action twice. */}
1194 - {can(detail.isDraft ? "ready" : "draft") &&
1195 - !(detail.isDraft && primaryAction === "ready") ? (
1215 + {showsDraftToggle ? (
1216 <MenuItem
1217 disabled={actionPending}
1218 onClick={() => void perform(detail.isDraft ? "ready" : "draft")}
@@ -1236,12 +1256,12 @@ export function PullRequestDetailPanel({
1256 Hidden while conflicting: every method would fail. */}
1257 {/* Only where merging is on offer at all: a strategy to merge with is not
1258 a choice for someone who may not merge. */}
1239 - {can("merge") &&
1240 - !detail.isDraft &&
1241 - !conflicting &&
1242 - allowedMergeMethods.length > 1 ? (
1259 + {showsMergeMethods ? (
1260 <>
1244 - <MenuSeparator />
1261 + {/* Only below the draft control. A host with no draft of its own, or
1262 + a draft whose control is already the header button, would leave
1263 + this against the separator that opened the group. */}
1264 + {showsDraftToggle ? <MenuSeparator /> : null}
1265 <MenuRadioGroup
1266 value={selectedMergeMethod}
1267 onValueChange={(method) =>
@@ -1261,7 +1281,13 @@ export function PullRequestDetailPanel({
1281 </MenuRadioGroup>
1282 </>
1283 ) : null}
1264 - <MenuSeparator />
1284 + {pullRequestActionMenuHasGroup(
1285 + showsDraftToggle,
1286 + showsAutoMerge,
1287 + showsMergeMethods,
1288 + ) ? (
1289 + <MenuSeparator />
1290 + ) : null}
1291 </>
1292 ) : null}
1293 <MenuItem onClick={() => void readLocalApi()?.shell.openExternal(detail.url)}>
apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts
+7
@@ -19,6 +19,7 @@ import {
19 isThreadOwnPullRequest,
20 orderPullRequestComments,
21 pullRequestActionNeedsHostRefresh,
22 + pullRequestActionMenuHasGroup,
23 pullRequestFindingKey,
24 pullRequestHandoffLabels,
25 readableFailure,
@@ -53,6 +54,12 @@ const TIMELINE_SOURCE: Pick<
54 closedAt: null,
55 };
56
57 +describe("pull request action menu", () => {
58 + it("keeps the group divider when auto-merge is the only action", () => {
59 + expect(pullRequestActionMenuHasGroup(false, true, false)).toBe(true);
60 + });
61 +});
62 +
63 describe("pull request state description", () => {
64 it("keeps draft and conflicts orthogonal to the terminal states", () => {
65 expect(describePullRequestState("open", true)).toBe("Draft");
apps/web/src/components/pullRequest/pullRequestDetail.logic.ts
+9
@@ -57,6 +57,15 @@ export function pullRequestHandoffLabels(inThisThread: boolean) {
57 };
58 }
59
60 +/** Whether the open pull-request action group contains at least one action. */
61 +export function pullRequestActionMenuHasGroup(
62 + showsDraftToggle: boolean,
63 + showsAutoMerge: boolean,
64 + showsMergeMethods: boolean,
65 +): boolean {
66 + return showsDraftToggle || showsAutoMerge || showsMergeMethods;
67 +}
68 +
69 /** Plain-language state, shown beside the author. Conflicts are a merge signal, not a state. */
70 export function describePullRequestState(state: PullRequestState, isDraft: boolean): string {
71 if (state === "merged") return "Merged";
apps/web/src/components/ui/menu.test.tsx new
+23
@@ -0,0 +1,23 @@
1 +import { renderToStaticMarkup } from "react-dom/server";
2 +import { describe, expect, it } from "vite-plus/test";
3 +
4 +import { Menu, MenuRadioGroup, MenuRadioItem } from "./menu";
5 +
6 +describe("menu radio item geometry", () => {
7 + it("keeps radio-item icons on the same text grid as menu items", () => {
8 + const html = renderToStaticMarkup(
9 + <Menu>
10 + <MenuRadioGroup value="merge">
11 + <MenuRadioItem value="merge">
12 + <span className="flex items-center gap-2">
13 + <svg aria-hidden className="size-3.5" />
14 + <span>Merge</span>
15 + </span>
16 + </MenuRadioItem>
17 + </MenuRadioGroup>
18 + </Menu>,
19 + );
20 +
21 + expect(html).toContain("-mx-0.5");
22 + });
23 +});
apps/web/src/components/ui/menu.tsx
+1 -1
@@ -166,7 +166,7 @@ function MenuRadioItem({
166 return (
167 <MenuPrimitive.RadioItem
168 className={cn(
169 - "flex min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-pointer items-center rounded-sm px-2 py-1 text-base text-foreground outline-none data-checked:bg-foreground/[0.08] data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
169 + "[&_svg]:-mx-0.5 flex min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-pointer items-center rounded-sm px-2 py-1 text-base text-foreground outline-none data-checked:bg-foreground/[0.08] data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
170 className,
171 )}
172 data-slot="menu-radio-item"