From b6575d890443637339c3ffac1b90f0b9600b166f Mon Sep 17 00:00:00 2001 From: JonathanLab Date: Wed, 22 Apr 2026 13:47:13 +0200 Subject: [PATCH] fix: increase sidebar min width --- apps/code/src/renderer/components/ResizableSidebar.tsx | 7 +++---- apps/code/src/renderer/features/sidebar/constants.ts | 1 + .../src/renderer/features/sidebar/stores/sidebarStore.ts | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 apps/code/src/renderer/features/sidebar/constants.ts diff --git a/apps/code/src/renderer/components/ResizableSidebar.tsx b/apps/code/src/renderer/components/ResizableSidebar.tsx index f415ef63c..2c01de5e2 100644 --- a/apps/code/src/renderer/components/ResizableSidebar.tsx +++ b/apps/code/src/renderer/components/ResizableSidebar.tsx @@ -1,8 +1,7 @@ +import { SIDEBAR_MIN_WIDTH } from "@features/sidebar/constants"; import { Box, Flex } from "@radix-ui/themes"; import React from "react"; -const MIN_WIDTH = 140; - interface ResizableSidebarProps { children: React.ReactNode; open: boolean; @@ -36,9 +35,9 @@ export const ResizableSidebar: React.FC = ({ const maxWidth = window.innerWidth * 0.5; const newWidth = side === "left" - ? Math.max(MIN_WIDTH, Math.min(maxWidth, e.clientX)) + ? Math.max(SIDEBAR_MIN_WIDTH, Math.min(maxWidth, e.clientX)) : Math.max( - MIN_WIDTH, + SIDEBAR_MIN_WIDTH, Math.min(maxWidth, window.innerWidth - e.clientX), ); setWidth(newWidth); diff --git a/apps/code/src/renderer/features/sidebar/constants.ts b/apps/code/src/renderer/features/sidebar/constants.ts new file mode 100644 index 000000000..8058b5952 --- /dev/null +++ b/apps/code/src/renderer/features/sidebar/constants.ts @@ -0,0 +1 @@ +export const SIDEBAR_MIN_WIDTH = 240; diff --git a/apps/code/src/renderer/features/sidebar/stores/sidebarStore.ts b/apps/code/src/renderer/features/sidebar/stores/sidebarStore.ts index b13473435..45203cc03 100644 --- a/apps/code/src/renderer/features/sidebar/stores/sidebarStore.ts +++ b/apps/code/src/renderer/features/sidebar/stores/sidebarStore.ts @@ -1,3 +1,4 @@ +import { SIDEBAR_MIN_WIDTH } from "@features/sidebar/constants"; import { create } from "zustand"; import { persist } from "zustand/middleware"; @@ -126,7 +127,10 @@ export const useSidebarStore = create()( open: persistedState.open ?? current.open, hasUserSetOpen: persistedState.hasUserSetOpen ?? current.hasUserSetOpen, - width: persistedState.width ?? current.width, + width: Math.max( + SIDEBAR_MIN_WIDTH, + persistedState.width ?? current.width, + ), collapsedSections: new Set(persistedState.collapsedSections ?? []), folderOrder: persistedState.folderOrder ?? [], historyVisibleCount: