diff --git a/src/renderer/src/components/layout/RightPanel.tsx b/src/renderer/src/components/layout/RightPanel.tsx
index ec935d1e24..cecd60aa53 100644
--- a/src/renderer/src/components/layout/RightPanel.tsx
+++ b/src/renderer/src/components/layout/RightPanel.tsx
@@ -6,10 +6,13 @@ import * as React from 'react'
import { PanelLeftIcon, PanelRightIcon } from 'lucide-react'
import { cn } from '@/lib/utils'
import { Button } from '@/components/ui/button'
-import { useUIStore } from '@/stores/uiStore'
+import {
+ useUIStore,
+ RIGHT_PANEL_MIN_WIDTH,
+ RIGHT_PANEL_MAX_WIDTH,
+} from '@/stores/uiStore'
import { useSidebar } from '@/components/ui/sidebar'
-
-const RIGHT_PANEL_WIDTH = '20rem' // 320px
+import { useResize } from '@/hooks/useResize'
interface RightPanelProps {
children: React.ReactNode
@@ -18,25 +21,47 @@ interface RightPanelProps {
export function RightPanel({ children, className }: RightPanelProps) {
const isOpen = useUIStore((s) => s.rightPanelOpen)
+ const rightPanelWidth = useUIStore((s) => s.rightPanelWidth)
+ const setRightPanelWidth = useUIStore((s) => s.setRightPanelWidth)
+
+ const { isResizing, handleProps } = useResize({
+ width: rightPanelWidth,
+ minWidth: RIGHT_PANEL_MIN_WIDTH,
+ maxWidth: RIGHT_PANEL_MAX_WIDTH,
+ onWidthChange: setRightPanelWidth,
+ direction: 'left',
+ })
return (
+ {/* Resize handle */}
+ {isOpen && (
+
+ )}
{children}
@@ -97,23 +122,12 @@ export function RightPanelHeader({
children,
...props
}: React.ComponentProps<'div'>) {
- const toggle = useUIStore((s) => s.toggleRightPanel)
-
return (
{children}
-
)
}
diff --git a/src/renderer/src/components/ui/sidebar.tsx b/src/renderer/src/components/ui/sidebar.tsx
index 30638ac35f..b3f8f034fb 100644
--- a/src/renderer/src/components/ui/sidebar.tsx
+++ b/src/renderer/src/components/ui/sidebar.tsx
@@ -6,8 +6,14 @@ import { cva, type VariantProps } from "class-variance-authority"
import { PanelLeftIcon } from "lucide-react"
import { useIsMobile } from "@/hooks/use-mobile"
+import { useResize } from "@/hooks/useResize"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
+import {
+ useUIStore,
+ SIDEBAR_MIN_WIDTH,
+ SIDEBAR_MAX_WIDTH,
+} from "@/stores/uiStore"
import { Input } from "@/components/ui/input"
import { Separator } from "@/components/ui/separator"
import {
@@ -27,7 +33,6 @@ import {
const SIDEBAR_COOKIE_NAME = "sidebar_state"
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
-const SIDEBAR_WIDTH = "16rem"
const SIDEBAR_WIDTH_MOBILE = "18rem"
const SIDEBAR_WIDTH_ICON = "3rem"
const SIDEBAR_KEYBOARD_SHORTCUT = "b"
@@ -126,6 +131,9 @@ function SidebarProvider({
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
)
+ // Get sidebar width from store
+ const sidebarWidth = useUIStore((s) => s.sidebarWidth)
+
return (
@@ -133,7 +141,7 @@ function SidebarProvider({
data-slot="sidebar-wrapper"
style={
{
- "--sidebar-width": SIDEBAR_WIDTH,
+ "--sidebar-width": `${sidebarWidth}px`,
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
...style,
} as React.CSSProperties
@@ -165,6 +173,17 @@ function Sidebar({
}) {
const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
+ // Resize functionality
+ const sidebarWidth = useUIStore((s) => s.sidebarWidth)
+ const setSidebarWidth = useUIStore((s) => s.setSidebarWidth)
+ const { isResizing, handleProps } = useResize({
+ width: sidebarWidth,
+ minWidth: SIDEBAR_MIN_WIDTH,
+ maxWidth: SIDEBAR_MAX_WIDTH,
+ onWidthChange: setSidebarWidth,
+ direction: side === "left" ? "right" : "left",
+ })
+
if (collapsible === "none") {
return (
{children}
+ {/* Resize handle - only show when expanded */}
+ {state === "expanded" && (
+
+ )}