Skip to content

Commit 2511659

Browse files
committed
fix: simplify sidebar - always animate width, remove debug logs
1 parent 92040c4 commit 2511659

File tree

3 files changed

+2
-36
lines changed

3 files changed

+2
-36
lines changed

src/browser/components/AIView.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,6 @@ const AIViewInner: React.FC<AIViewProps> = ({
124124

125125
// Derive active sidebar props based on selected tab
126126
const sidebarWidth = selectedRightTab === "review" ? reviewSidebar.width : costsSidebar.width;
127-
console.log("[AIView] tab switch:", {
128-
selectedRightTab,
129-
reviewWidth: reviewSidebar.width,
130-
costsWidth: costsSidebar.width,
131-
derivedWidth: sidebarWidth,
132-
});
133127
const isResizing =
134128
selectedRightTab === "review" ? reviewSidebar.isResizing : costsSidebar.isResizing;
135129
const startResize =

src/browser/components/RightSidebar.tsx

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,13 @@ const SidebarContainer: React.FC<SidebarContainerProps> = ({
5555
: wide
5656
? "min(1200px, calc(100vw - 400px))"
5757
: "300px";
58-
console.log("[SidebarContainer] width calc:", { isCollapsed, customWidth, wide, computedWidth: width });
59-
60-
// Track previous width to detect tab switches vs resize drags
61-
// Tab switches: large width jumps (e.g., 400→976) - no animation wanted
62-
// Resize drags: small incremental changes - smooth animation wanted
63-
const prevWidthRef = React.useRef<string>(width);
64-
const widthDelta = Math.abs(
65-
parseInt(width) - parseInt(prevWidthRef.current)
66-
);
67-
// Consider it a "tab switch" if width changes by more than 50px in one render
68-
const isTabSwitch = !isNaN(widthDelta) && widthDelta > 50;
69-
70-
React.useEffect(() => {
71-
prevWidthRef.current = width;
72-
}, [width]);
73-
74-
// Only animate during resize (small incremental changes), not tab switches
75-
const shouldAnimate = !isResizing && !isTabSwitch;
76-
console.log("[SidebarContainer] animation:", { width, prevWidth: prevWidthRef.current, widthDelta, isTabSwitch, shouldAnimate });
7758

7859
return (
7960
<div
8061
className={cn(
8162
"bg-sidebar border-l border-border-light flex flex-col overflow-hidden flex-shrink-0",
82-
shouldAnimate && "transition-[width] duration-200",
63+
// Animate width changes (tab switches, collapse/expand) - disable during drag resize
64+
!isResizing && "transition-[width] duration-200",
8365
// Mobile: full width
8466
"max-md:border-l-0 max-md:border-t max-md:border-border-light max-md:w-full max-md:relative max-md:max-h-[50vh]"
8567
)}
@@ -228,13 +210,6 @@ const RightSidebarComponent: React.FC<RightSidebarProps> = ({
228210
// Use isCollapsed prop instead of returning null to keep DOM present for CSS transitions
229211
const isCollapsed = isHidden;
230212
const wide = selectedTab === "review" && !width;
231-
console.log("[RightSidebar] render:", {
232-
selectedTab,
233-
width,
234-
wide,
235-
isCollapsed,
236-
isHidden,
237-
});
238213

239214
return (
240215
<SidebarContainer

src/browser/hooks/useResizableSidebar.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export function useResizableSidebar({
6060
const [customWidth, setCustomWidth] = useState<number | null>(() => {
6161
try {
6262
const stored = localStorage.getItem(storageKey);
63-
console.log(`[useResizableSidebar INIT] ${storageKey}: stored=${stored}`);
6463
if (stored) {
6564
const parsed = parseInt(stored, 10);
6665
if (!isNaN(parsed) && parsed >= minWidth && parsed <= maxWidth) {
@@ -72,8 +71,6 @@ export function useResizableSidebar({
7271
}
7372
return null; // No custom width - use default/auto
7473
});
75-
76-
console.log(`[useResizableSidebar] ${storageKey}: enabled=${enabled}, customWidth=${customWidth}, returning=${customWidth ?? undefined}`);
7774

7875
const [isResizing, setIsResizing] = useState(false);
7976

0 commit comments

Comments
 (0)