fix(web): better right panel (new diffs styling) #5260
Mergedmaria-rcksmerged 15 commits into
main fromrefs/pull/5260/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/components/DiffPanel.tsx line 721Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -455,5 +504,8 @@455504 const diffFileKeys = useMemo(() => codeViewFiles.map((file) => file.fileKey), [codeViewFiles]);456505 const allDiffFilesCollapsed = areAllDiffFilesCollapsed(diffFileKeys, collapsedDiffFileKeys);457506 const diffLineStat = useMemo(() => getDiffLineStat(renderableFiles), [renderableFiles]);507+ const selectedDiffFileKey = selectedFilePath508+ ? (codeViewFiles.find((candidate) => candidate.filePath === selectedFilePath)?.fileKey ?? null)509+ : null;458510459511 useEffect(() => {
maria-rcks changed the title
- apps/web/src/components/ChatView.tsx line 5652Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -5643,4 +5643,8 @@56435643 />56445644 );56455645 const panelLayoutControls = (5646- <div className="workspace-titlebar-controls z-50 mr-px gap-1 [-webkit-app-region:no-drag]">5646+ <div5647+ className={cn(5648+ "workspace-titlebar-controls z-50 gap-1 [-webkit-app-region:no-drag]",5649+ rightPanelOpen && !shouldUsePlanSidebarSheet ? "right-2" : "mr-px",5650+ )}
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/web/src/components/DiffPanel.tsx lines 768 to 769OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -506,3 +765,4 @@506765 );507766508767 const toggleDiffFileCollapse = useCallback(() => {768+ setCodeViewRevision((current) => current + 1);
- apps/server/src/review/ReviewService.ts lines 117 to 117OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -106,3 +111,7 @@106111 return yield* getDriverDiffPreview(input);107112 });108113114+ const getDiffFileContents: ReviewService["Service"]["getDiffFileContents"] = Effect.fn(115+ "ReviewService.getDiffFileContents",116+ )(function* (input) {117+ yield* assertWorkspaceBoundCwd(input.cwd);
- apps/web/src/components/DiffPanel.tsx line 609OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -365,0 +588,21 @@588+ });589+ if (result._tag !== "Success") {590+ throw squashAtomCommandFailure(result);591+ }592+593+ const newFile = {594+ name: newPath,595+ contents: result.value.newContents,596+ cacheKey: `${source.diffHash}:new:${newPath}`,597+ };598+ if (fileDiff.type === "rename-pure") {599+ return { oldFile: null, newFile };600+ }601+ return {602+ oldFile: {603+ name: oldPath,604+ contents: result.value.oldContents,605+ cacheKey: `${source.diffHash}:old:${oldPath}`,606+ },607+ newFile,608+ };apps/web/src/components/DiffPanel.tsx line 283OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -139,0 +263,21 @@263+:is([data-separator="line-info"], [data-separator="line-info-basic"])[data-expand-index]264+ [data-separator-wrapper] {265+ grid-template-columns: 0 minmax(0, 1fr) !important;266+}267+268+:is([data-separator="line-info"], [data-separator="line-info-basic"])[data-expand-index]269+ [data-separator-content] {270+ grid-column: 2 !important;271+}272+273+:is([data-separator="line-info"], [data-separator="line-info-basic"])274+ [data-expand-button] {275+ display: none !important;276+}277+278+:is([data-separator="line-info"], [data-separator="line-info-basic"]):has(279+ [data-expand-button]280+ )281+ [data-separator-content] {282+ cursor: pointer;283+}
- apps/server/src/vcs/GitVcsDriverCore.ts lines 2275 to 2286OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2270,3 +2272,15 @@22702272 };22712273 });227222742275+ const reviewDiffFileError = (2276+ input: ReviewDiffFileContentsInput,2277+ detail: string,2278+ cause?: unknown,2279+ ) =>2280+ new GitCommandError({2281+ operation: "GitVcsDriver.getReviewDiffFileContents",2282+ command: "git",2283+ cwd: input.cwd,2284+ detail,2285+ ...(cause === undefined ? {} : { cause }),2286+ });
- apps/web/src/components/diffs/AnnotatableCodeView.tsx line 251OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -241,11 +248,10 @@241248 ...options,242249 enableGutterUtility: !hasOpenComment,243250 enableLineSelection: !hasOpenComment,244- onLineSelectionEnd: beginComment,251+ onGutterUtilityClick: beginComment,245252 }}246253 renderHeaderPrefix={(item) =>247254 item.type === "diff"248255 ? renderHeaderPrefix(item.fileDiff, item.id, item.collapsed === true)249256 : null250257 }251- renderAnnotation={(annotation) => (
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XL
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- packages/client-runtime/src/state/review.ts lines 27 to 37Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -11,5 +16,21 @@1116 diffPreview: createEnvironmentRpcQueryAtomFamily(runtime, {1217 label: "environment-data:review:diff-preview",1318 tag: WS_METHODS.reviewGetDiffPreview,1419 staleTimeMs: 5_000,1520 }),21+ diffFileContents: createEnvironmentRpcCommand(runtime, {22+ label: "environment-data:review:diff-file-contents",23+ tag: WS_METHODS.reviewGetDiffFileContents,24+ scheduler: diffFileScheduler,25+ concurrency: {26+ mode: "singleFlight",27+ key: ({ environmentId, input }) =>28+ JSON.stringify([29+ environmentId,30+ input.cwd,31+ input.sourceKind,32+ input.baseRef,33+ input.headRef,34+ input.oldPath,35+ input.newPath,36+ ]),apps/web/src/components/DiffPanel.tsx line 545Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -360,3 +528,18 @@360528 const branchDiffPreview = shouldRetryBranchDiffAtEnvironmentCwd361529 ? fallbackBranchDiffPreview362530 : primaryBranchDiffPreview;531+ const refreshBranchDiffPreview = branchDiffPreview.refresh;532+ const canRefreshGitDiff =533+ isGitRepo && selectedTurnId === null && activeThread != null && activeCwd != null;534+ const activeThreadRefreshKey = routeThreadRef535+ ? `${routeThreadRef.environmentId}:${routeThreadRef.threadId}`536+ : null;537+538+ useEffect(() => {539+ if (!canRefreshGitDiff) return;540+ const refreshOnFocus = () => refreshBranchDiffPreview();541+ window.addEventListener("focus", refreshOnFocus);542+ return () => window.removeEventListener("focus", refreshOnFocus);543+ }, [canRefreshGitDiff, refreshBranchDiffPreview]);544+545+ useEffect(() => {
juliusmarminge merged this4fb03af
juliusmarminge closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
358cd34c-18d8-43d5-81ca-64ba4a52983cYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share