From 4ea0a4bb56a23ba5dcee750f7f6bb104d9da8a15 Mon Sep 17 00:00:00 2001 From: Ammar Date: Fri, 12 Dec 2025 11:00:13 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20fix:=20align=20diff=20styling=20?= =?UTF-8?q?with=20app=20theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RightSidebar/CodeReview/HunkViewer.tsx | 38 +++++----- .../components/shared/DiffRenderer.tsx | 73 ++++++++++++------- .../components/tools/FileEditToolCall.tsx | 20 ++--- 3 files changed, 78 insertions(+), 53 deletions(-) diff --git a/src/browser/components/RightSidebar/CodeReview/HunkViewer.tsx b/src/browser/components/RightSidebar/CodeReview/HunkViewer.tsx index 8b88107415..c4762d5084 100644 --- a/src/browser/components/RightSidebar/CodeReview/HunkViewer.tsx +++ b/src/browser/components/RightSidebar/CodeReview/HunkViewer.tsx @@ -248,25 +248,25 @@ export const HunkViewer = React.memo( Renamed from {hunk.oldPath} ) : isExpanded ? ( -
- { - // Create synthetic event with data-hunk-id for parent handler - const syntheticEvent = { - currentTarget: { dataset: { hunkId } }, - } as unknown as React.MouseEvent; - onClick?.(syntheticEvent); - }} - searchConfig={searchConfig} - enableHighlighting={isVisible} - /> -
+ { + // Create synthetic event with data-hunk-id for parent handler + const syntheticEvent = { + currentTarget: { dataset: { hunkId } }, + } as unknown as React.MouseEvent; + onClick?.(syntheticEvent); + }} + searchConfig={searchConfig} + enableHighlighting={isVisible} + /> ) : (
{ switch (type) { case "add": - return "rgba(46, 160, 67, 0.15)"; + return "color-mix(in srgb, var(--color-success), transparent 90%)"; case "remove": - return "rgba(248, 81, 73, 0.15)"; + return "color-mix(in srgb, var(--color-danger), transparent 90%)"; + case "header": + return "color-mix(in srgb, var(--color-accent), transparent 92%)"; + case "context": default: return "transparent"; } }; -// Helper function for getting diff line text color -const getDiffLineColor = (type: DiffLineType): string => { +const getDiffLineBorderColor = (type: DiffLineType): string => { switch (type) { case "add": - return "#4caf50"; + return "color-mix(in srgb, var(--color-success), transparent 35%)"; case "remove": - return "#f44336"; + return "color-mix(in srgb, var(--color-danger), transparent 35%)"; case "header": - return "#2196f3"; + return "color-mix(in srgb, var(--color-accent), transparent 45%)"; case "context": default: - return "var(--color-text)"; + return "transparent"; } }; -// Helper function for getting line content color +// Helper function for getting line content color. +// Only headers/context are tinted; actual code stays the normal foreground color. const getLineContentColor = (type: DiffLineType): string => { switch (type) { case "header": - return "#2196f3"; + return "var(--color-accent-light)"; case "context": return "var(--color-text-secondary)"; case "add": case "remove": + default: return "var(--color-text)"; } }; -// Helper function for computing contrast color for add/remove indicators +// Used for the +/- marker and line numbers. const getContrastColor = (type: DiffLineType): string => { - return type === "add" || type === "remove" - ? "color-mix(in srgb, var(--color-text-secondary), white 50%)" - : "var(--color-text-secondary)"; + switch (type) { + case "add": + return "var(--color-success-light)"; + case "remove": + return "var(--color-danger-soft)"; + case "header": + return "var(--color-accent-light)"; + case "context": + default: + return "var(--color-text-secondary)"; + } }; /** @@ -115,7 +128,12 @@ export const DiffContainer: React.FC< const showOverflowControls = clampContent && isOverflowing; return ( -
+
= ({ return (
( filePath, fontSize, maxHeight, + className, onReviewNote, onLineClick, searchConfig, @@ -556,7 +578,7 @@ export const SelectableDiffRenderer = React.memo( // Show loading state while highlighting if (!highlightedChunks || highlightedLineData.length === 0) { return ( - +
Processing...
); @@ -566,7 +588,7 @@ export const SelectableDiffRenderer = React.memo( const lines = content.split("\n").filter((line) => line.length > 0); return ( - + {highlightedLineData.map((lineInfo, displayIndex) => { const isSelected = isLineSelected(displayIndex); const indicator = lineInfo.type === "add" ? "+" : lineInfo.type === "remove" ? "-" : " "; @@ -576,12 +598,13 @@ export const SelectableDiffRenderer = React.memo(
@@ -618,8 +641,8 @@ export const SelectableDiffRenderer = React.memo(
= ({ )} - {result.success && result.diff && ( - - {showRaw ? ( -
{result.diff}
- ) : ( - renderDiff(result.diff, filePath, onReviewNote) - )} -
- )} + {result.success && + result.diff && + (showRaw ? ( + +
+                      {result.diff}
+                    
+
+ ) : ( + renderDiff(result.diff, filePath, onReviewNote) + ))} )}