From 4e1422248737ec03c61ebcf9fd6493e5abd325df Mon Sep 17 00:00:00 2001
From: simos
Date: Fri, 31 Oct 2025 09:36:14 +0000
Subject: [PATCH] feat(ui): add collapsible sidebar functionality
Implement a collapsible sidebar feature for the desktop view that allows
users to toggle between expanded and collapsed states. The sidebar state
is persisted using localStorage to maintain user preference across
sessions.
Changes include:
- Add sidebarVisible state with localStorage persistence
- Import Sparkles and SettingsIcon from lucide-react
- Implement smooth transition animation (300ms) for sidebar collapse
- Add collapsed sidebar view with icon-only navigation buttons
- Pass onToggleSidebar prop to Sidebar component
- Adjust sidebar width dynamically (80 -> 14 when collapsed)
This improves the user experience by providing more screen real estate
for the main content area when needed, while keeping quick access to
essential navigation through the collapsed icon view.
---
src/App.jsx | 95 +++++++++++++++++++++++++-------
src/components/ChatInterface.jsx | 1 -
src/components/Sidebar.jsx | 76 ++++++++++++++++---------
3 files changed, 124 insertions(+), 48 deletions(-)
diff --git a/src/App.jsx b/src/App.jsx
index c018dc3..3a84f0f 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -20,6 +20,7 @@
import React, { useState, useEffect, useCallback } from 'react';
import { BrowserRouter as Router, Routes, Route, useNavigate, useParams } from 'react-router-dom';
+import { Settings as SettingsIcon, Sparkles } from 'lucide-react';
import Sidebar from './components/Sidebar';
import MainContent from './components/MainContent';
import MobileNav from './components/MobileNav';
@@ -60,6 +61,7 @@ function AppContent() {
const [showThinking, setShowThinking] = useLocalStorage('showThinking', true);
const [autoScrollToBottom, setAutoScrollToBottom] = useLocalStorage('autoScrollToBottom', true);
const [sendByCtrlEnter, setSendByCtrlEnter] = useLocalStorage('sendByCtrlEnter', false);
+ const [sidebarVisible, setSidebarVisible] = useLocalStorage('sidebarVisible', true);
// Session Protection System: Track sessions with active conversations to prevent
// automatic project updates from interrupting ongoing chats. When a user sends
// a message, the session is marked as "active" and project updates are paused
@@ -734,28 +736,78 @@ function AppContent() {