From 312ae6f7535b4307c91ba75989a9b07a18e0e749 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Mon, 6 Jul 2026 11:28:41 +0530 Subject: [PATCH] feat(sidebar): refactor DocumentsSidebar to utilize SidebarSection for improved layout - Replaced div wrappers in AuthenticatedDocumentsSidebarBase and AnonymousDocumentsSidebar with SidebarSection for better structure and consistency. - Updated EmbeddedDocumentsMenu to enhance document management functionality. - Changed icon from MoreHorizontal to SlidersVertical for improved visual representation. - Adjusted SidebarSection styling for better alignment and spacing. --- .../layout/ui/sidebar/DocumentsSidebar.tsx | 33 ++++++++++++------- .../components/layout/ui/sidebar/Sidebar.tsx | 9 ++--- .../layout/ui/sidebar/SidebarSection.tsx | 12 +++++-- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx index 1f038a39b..09f53db11 100644 --- a/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx @@ -11,9 +11,9 @@ import { Laptop, ListFilter, Lock, - MoreHorizontal, Paperclip, Server, + SlidersVertical, Trash2, Upload, X, @@ -92,6 +92,7 @@ import { uploadFolderScan } from "@/lib/folder-sync-upload"; import { getWorkspaceIdNumber } from "@/lib/route-params"; import { getSupportedExtensionsSet } from "@/lib/supported-extensions"; import { queries } from "@/zero/queries/index"; +import { SidebarSection } from "./SidebarSection"; import { SidebarSlideOutPanel } from "./SidebarSlideOutPanel"; const DesktopLocalTabContent = dynamic( @@ -133,7 +134,7 @@ function downloadTextFile(content: string, fileName: string, type = "text/markdo URL.revokeObjectURL(url); } -function EmbeddedDocumentsMenu({ +export function EmbeddedDocumentsMenu({ typeCounts, activeTypes, onToggleType, @@ -159,7 +160,7 @@ function EmbeddedDocumentsMenu({ className="relative h-7 w-7 text-muted-foreground hover:bg-accent hover:text-accent-foreground" aria-label="Document actions" > - + {activeTypes.length > 0 ? ( ) : null} @@ -1555,17 +1556,22 @@ function AuthenticatedDocumentsSidebarBase({ if (embedded) { return ( -
-
+ handleCreateFolder(null)} /> -
+ } + > {renderDocumentTree()} -
+ ); } @@ -1934,15 +1940,20 @@ function AnonymousDocumentsSidebar({ if (embedded) { return ( -
-
+ {}} onCreateFolder={() => gate("create folders")} /> -
+ } + > gate("watch local folders")} onExportFolder={() => gate("export folders")} /> -
+ ); } diff --git a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx index 1ad370fab..6477e27a8 100644 --- a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx @@ -336,18 +336,13 @@ export function Sidebar({ )} {documentsPanel?.open ? ( - +
- +
) : null} )} diff --git a/surfsense_web/components/layout/ui/sidebar/SidebarSection.tsx b/surfsense_web/components/layout/ui/sidebar/SidebarSection.tsx index 573173cf5..ac995094a 100644 --- a/surfsense_web/components/layout/ui/sidebar/SidebarSection.tsx +++ b/surfsense_web/components/layout/ui/sidebar/SidebarSection.tsx @@ -41,7 +41,7 @@ export function SidebarSection({ className )} > -
+
{title} {persistentAction}
+
+ {persistentAction} +
)}