From ed27eb724b4d7963b59de8fd2e51d6b877004163 Mon Sep 17 00:00:00 2001 From: oliver <97427849+flamboh@users.noreply.github.com> Date: Wed, 7 Oct 2026 22:45:07 -0700 Subject: [PATCH] fix(web): PR code toolbar no longer overlaps in narrow panels (#15561) --- .../pullRequest/PullRequestCodeTab.tsx | 178 +++++++++++------- 1 file changed, 115 insertions(+), 63 deletions(-) diff --git a/apps/web/src/components/pullRequest/PullRequestCodeTab.tsx b/apps/web/src/components/pullRequest/PullRequestCodeTab.tsx index d531259e5781a1b616c10d6461635ebde93e4d3a..7c631825dc456deb726b2d7a484bc39553cfbfd9 100644 --- a/apps/web/src/components/pullRequest/PullRequestCodeTab.tsx +++ b/apps/web/src/components/pullRequest/PullRequestCodeTab.tsx @@ -19,6 +19,7 @@ import { MessageSquareOffIcon, PilcrowIcon, Rows3Icon, + Settings2Icon, TextWrapIcon, TriangleAlertIcon, } from "lucide-react"; @@ -69,10 +70,12 @@ import { Checkbox } from "../ui/checkbox"; import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "../ui/collapsible"; import { DropdownMenu, + DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, + DropdownMenuSeparator, DropdownMenuTrigger, } from "../ui/menu"; import { toastManager } from "../ui/toast"; @@ -1075,8 +1078,13 @@ function PullRequestCodeTab({ } }, [commit, onSelectedCommitChange, selectedCommit]); const scopeLabel = selectedCommit ? selectedCommit.messageHeadline : "All commits"; + const changeIgnoreWhitespace = (next: boolean) => { + setIgnoreWhitespace(next); + setDraft(null); + setSelectedLines(null); + }; const toolbar = ( -
+
{/* A host that reports no commits has nothing to scope by, and a dropdown whose only entry is the scope already showing is a control that does nothing. */} @@ -1133,7 +1141,7 @@ function PullRequestCodeTab({ ) : null} {/* One count, and the caveats as icons that carry their own words. Spelled out they competed for a strip this narrow and every one of them truncated to nothing. */} - + {files.length} {files.length === 1 ? "file" : "files"} {nextCursor === null ? "" : "+"} @@ -1224,30 +1232,113 @@ function PullRequestCodeTab({
- - + + } + className="@lg:hidden" + aria-label="Diff options" + /> + } + > + + + Diff options + + + changeIgnoreWhitespace(checked)} + > + Hide whitespace changes + + setWordWrap(checked)} + > + Wrap lines + + + { + if (value === "stacked" || value === "split") { + updateClientSettings({ diffLayout: value }); } - variant="ghost" - size="sm" - pressed={ignoreWhitespace} - onPressedChange={(pressed) => { - setIgnoreWhitespace(Boolean(pressed)); - setDraft(null); - setSelectedLines(null); - }} - /> - } + }} + > + + Stacked + + + Split + + + + +
+ + changeIgnoreWhitespace(Boolean(pressed))} + /> + } + > + + + + {ignoreWhitespace ? "Show whitespace changes" : "Hide whitespace changes"} + + + { + const next = value[0]; + if (next === "stacked" || next === "split") { + updateClientSettings({ diffLayout: next }); + } + }} > - - - - {ignoreWhitespace ? "Show whitespace changes" : "Hide whitespace changes"} - - + + + + + + + + + { + setWordWrap(Boolean(pressed)); + }} + /> + } + > + + + + {wordWrap ? "Disable line wrapping" : "Enable line wrapping"} + + +
{fileKeys.length > 0 ? ( ) : null} - { - const next = value[0]; - if (next === "stacked" || next === "split") { - updateClientSettings({ diffLayout: next }); - } - }} - > - - - - - - - - - { - setWordWrap(Boolean(pressed)); - }} - /> - } - > - - - - {wordWrap ? "Disable line wrapping" : "Enable line wrapping"} - - {fileKeys.length > 0 ? (