From c1c34eb916c66d6d5c4d42cce7ee196cae21925f Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Mon, 4 May 2026 02:05:20 +0530 Subject: [PATCH] refactor(layout): implement background color management in DashboardClientLayout; streamline RightPanel and LayoutShell styles for consistency --- .../[search_space_id]/client-layout.tsx | 22 +++++++++++++++---- .../layout/ui/right-panel/RightPanel.tsx | 2 +- .../layout/ui/shell/LayoutShell.tsx | 4 ++-- .../components/layout/ui/tabs/TabBar.tsx | 4 ++-- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx b/surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx index d95aab6e8..759539ce3 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx @@ -144,6 +144,19 @@ export function DashboardClientLayout({ const electronAPI = useElectronAPI(); + useEffect(() => { + const htmlBackground = document.documentElement.style.backgroundColor; + const bodyBackground = document.body.style.backgroundColor; + + document.documentElement.style.backgroundColor = "var(--panel)"; + document.body.style.backgroundColor = "var(--panel)"; + + return () => { + document.documentElement.style.backgroundColor = htmlBackground; + document.body.style.backgroundColor = bodyBackground; + }; + }, []); + useEffect(() => { if (!electronAPI?.onChatScreenCapture) return; return electronAPI.onChatScreenCapture((dataUrl: string) => { @@ -163,12 +176,13 @@ export function DashboardClientLayout({ setActiveSearchSpaceIdState(activeSeacrhSpaceId); // Sync to Electron store if stored value is null (first navigation) - if (electronAPI?.setActiveSearchSpace) { + if (electronAPI?.getActiveSearchSpace && electronAPI.setActiveSearchSpace) { + const setActiveSearchSpace = electronAPI.setActiveSearchSpace; electronAPI - .getActiveSearchSpace?.() - .then((stored) => { + .getActiveSearchSpace() + .then((stored: string | null) => { if (!stored) { - electronAPI.setActiveSearchSpace!(activeSeacrhSpaceId); + setActiveSearchSpace(activeSeacrhSpaceId); } }) .catch(() => {}); diff --git a/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx b/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx index 1e543c885..a647ba26d 100644 --- a/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx +++ b/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx @@ -203,7 +203,7 @@ export function RightPanel({ documentsPanel }: RightPanelProps) { return (