From 288abdc180eb096d360037a0352724a4e4725bcd Mon Sep 17 00:00:00 2001 From: Jure <44338+hoornet@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:41:16 +0100 Subject: [PATCH] Sidebar improvements (roadmap #10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - sidebarCollapsed now persisted to localStorage — remembered across sessions - Explicit ‹/› toggle button always visible in the header; no longer requires knowing to click the WRYSTR wordmark - Expanded: WRYSTR on left, ‹ collapse button on right - Collapsed: centered › expand button fills the header - Write article (✦) now visible in collapsed mode as icon-only with tooltip, consistent with the rest of the nav - Nav items have title tooltip in collapsed mode for discoverability - Status footer: collapsed shows just the connection dot with tooltip; expanded shows dot + online/offline text + note count as before Co-Authored-By: Claude Sonnet 4.6 --- src/components/sidebar/Sidebar.tsx | 126 +++++++++++++++++------------ src/stores/ui.ts | 10 ++- 2 files changed, 83 insertions(+), 53 deletions(-) diff --git a/src/components/sidebar/Sidebar.tsx b/src/components/sidebar/Sidebar.tsx index 511d817..f966b16 100644 --- a/src/components/sidebar/Sidebar.tsx +++ b/src/components/sidebar/Sidebar.tsx @@ -18,64 +18,89 @@ export function Sidebar() { const { connected, notes } = useFeedStore(); const { loggedIn } = useUserStore(); + const c = sidebarCollapsed; + return ( - <> - - - + + ); } diff --git a/src/stores/ui.ts b/src/stores/ui.ts index 868843c..89e24ae 100644 --- a/src/stores/ui.ts +++ b/src/stores/ui.ts @@ -19,9 +19,11 @@ interface UIState { toggleSidebar: () => void; } +const SIDEBAR_KEY = "wrystr_sidebar_collapsed"; + export const useUIStore = create((set, _get) => ({ currentView: "feed", - sidebarCollapsed: false, + sidebarCollapsed: localStorage.getItem(SIDEBAR_KEY) === "true", selectedPubkey: null, selectedNote: null, previousView: "feed", @@ -34,5 +36,9 @@ export const useUIStore = create((set, _get) => ({ currentView: s.previousView !== s.currentView ? s.previousView : "feed", selectedNote: null, })), - toggleSidebar: () => set((s) => ({ sidebarCollapsed: !s.sidebarCollapsed })), + toggleSidebar: () => set((s) => { + const next = !s.sidebarCollapsed; + localStorage.setItem(SIDEBAR_KEY, String(next)); + return { sidebarCollapsed: next }; + }), }));