From 6231c08b8bdc6fb78f576854db755d4eecfcf1c3 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Tue, 28 Apr 2026 20:21:18 +0530 Subject: [PATCH] refactor(sidebar): standardize padding, font sizes, and icon dimensions across sidebar components for improved consistency --- .../announcements/AnnouncementsEmptyState.tsx | 10 +- .../ui/sidebar/AllPrivateChatsSidebar.tsx | 183 ++++++++++-------- .../ui/sidebar/AllSharedChatsSidebar.tsx | 183 ++++++++++-------- .../ui/sidebar/AnnouncementsSidebar.tsx | 6 +- .../layout/ui/sidebar/ChatListItem.tsx | 2 +- .../layout/ui/sidebar/InboxSidebar.tsx | 38 ++-- .../layout/ui/sidebar/NavSection.tsx | 2 +- .../components/layout/ui/sidebar/Sidebar.tsx | 6 +- .../layout/ui/sidebar/SidebarButton.tsx | 6 +- .../layout/ui/sidebar/SidebarHeader.tsx | 6 +- .../layout/ui/sidebar/SidebarSection.tsx | 4 +- 11 files changed, 234 insertions(+), 212 deletions(-) diff --git a/surfsense_web/components/announcements/AnnouncementsEmptyState.tsx b/surfsense_web/components/announcements/AnnouncementsEmptyState.tsx index 9ed1ea45d..329a284db 100644 --- a/surfsense_web/components/announcements/AnnouncementsEmptyState.tsx +++ b/surfsense_web/components/announcements/AnnouncementsEmptyState.tsx @@ -2,12 +2,12 @@ import { BellOff } from "lucide-react"; export function AnnouncementsEmptyState() { return ( -
-
- +
+
+
-

No announcements

-

+

No announcements

+

You're all caught up! New announcements will appear here.

diff --git a/surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx index ab5213db2..8630c5a9b 100644 --- a/surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx @@ -252,7 +252,7 @@ export function AllPrivateChatsSidebarContent({ return ( <> -
+
{isMobile && ( )} - -

{t("chats") || "Private Chats"}

+ +

{t("chats") || "Private Chats"}

- + setSearchQuery(e.target.value)} - className="pl-9 pr-8 h-9" + className="h-8 pl-8 pr-7 text-sm" /> {searchQuery && ( @@ -382,7 +379,13 @@ export function AllPrivateChatsSidebarContent({ type="button" onClick={() => handleThreadClick(thread.id)} disabled={isBusy} - className="flex items-center gap-2 flex-1 min-w-0 text-left overflow-hidden" + className={cn( + "flex w-full items-center gap-2 overflow-hidden rounded-md px-2 py-1.5 text-xs text-left", + "group-hover/item:bg-accent group-hover/item:text-accent-foreground", + "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", + isActive && "bg-accent text-accent-foreground", + isBusy && "opacity-50 pointer-events-none" + )} > {thread.title || "New Chat"} @@ -396,89 +399,97 @@ export function AllPrivateChatsSidebarContent({ )} - setOpenDropdownId(isOpen ? thread.id : null)} +
- - - - - {!thread.archived && ( - handleStartRename(thread.id, thread.title || "New Chat")} + setOpenDropdownId(isOpen ? thread.id : null)} + > + + + + + {!thread.archived && ( + handleStartRename(thread.id, thread.title || "New Chat")} + > + + {t("rename") || "Rename"} + )} - - handleDeleteThread(thread.id)}> - - {t("delete") || "Delete"} - - - + handleToggleArchive(thread.id, thread.archived)} + disabled={isArchiving} + > + {thread.archived ? ( + <> + + {t("unarchive") || "Restore"} + + ) : ( + <> + + {t("archive") || "Archive"} + + )} + + handleDeleteThread(thread.id)}> + + {t("delete") || "Delete"} + + + +
); })}
) : isSearchMode ? (
- -

+ +

{t("no_chats_found") || "No chats found"}

-

+

{t("try_different_search") || "Try a different search term"}

) : (
- -

+ +

{showArchived ? t("no_archived_chats") || "No archived chats" : t("no_chats") || "No private chats"}

{!showArchived && ( -

+

{t("start_new_chat_hint") || "Start a new chat from the chat page"}

)} diff --git a/surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx index ab1072459..26556b0bd 100644 --- a/surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx @@ -251,7 +251,7 @@ export function AllSharedChatsSidebarContent({ return ( <> -
+
{isMobile && ( )} - -

{t("shared_chats") || "Shared Chats"}

+ +

{t("shared_chats") || "Shared Chats"}

- + setSearchQuery(e.target.value)} - className="pl-9 pr-8 h-9" + className="h-8 pl-8 pr-7 text-sm" /> {searchQuery && ( @@ -381,7 +378,13 @@ export function AllSharedChatsSidebarContent({ type="button" onClick={() => handleThreadClick(thread.id)} disabled={isBusy} - className="flex items-center gap-2 flex-1 min-w-0 text-left overflow-hidden" + className={cn( + "flex w-full items-center gap-2 overflow-hidden rounded-md px-2 py-1.5 text-xs text-left", + "group-hover/item:bg-accent group-hover/item:text-accent-foreground", + "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", + isActive && "bg-accent text-accent-foreground", + isBusy && "opacity-50 pointer-events-none" + )} > {thread.title || "New Chat"} @@ -395,89 +398,97 @@ export function AllSharedChatsSidebarContent({ )} - setOpenDropdownId(isOpen ? thread.id : null)} +
- - - - - {!thread.archived && ( - handleStartRename(thread.id, thread.title || "New Chat")} + setOpenDropdownId(isOpen ? thread.id : null)} + > + + + + + {!thread.archived && ( + handleStartRename(thread.id, thread.title || "New Chat")} + > + + {t("rename") || "Rename"} + )} - - handleDeleteThread(thread.id)}> - - {t("delete") || "Delete"} - - - + handleToggleArchive(thread.id, thread.archived)} + disabled={isArchiving} + > + {thread.archived ? ( + <> + + {t("unarchive") || "Restore"} + + ) : ( + <> + + {t("archive") || "Archive"} + + )} + + handleDeleteThread(thread.id)}> + + {t("delete") || "Delete"} + + + +
); })}
) : isSearchMode ? (
- -

+ +

{t("no_chats_found") || "No chats found"}

-

+

{t("try_different_search") || "Try a different search term"}

) : (
- -

+ +

{showArchived ? t("no_archived_chats") || "No archived chats" : t("no_shared_chats") || "No shared chats"}

{!showArchived && ( -

+

Share a chat to collaborate with your team

)} diff --git a/surfsense_web/components/layout/ui/sidebar/AnnouncementsSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/AnnouncementsSidebar.tsx index 6a1233537..d6729eec4 100644 --- a/surfsense_web/components/layout/ui/sidebar/AnnouncementsSidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/AnnouncementsSidebar.tsx @@ -31,7 +31,7 @@ export function AnnouncementsSidebarContent({ return (
-
+
{isMobile && ( @@ -48,12 +48,12 @@ export function AnnouncementsSidebarContent({ Close )} -

Announcements

+

Announcements

-
+
{announcements.length === 0 ? ( ) : ( diff --git a/surfsense_web/components/layout/ui/sidebar/ChatListItem.tsx b/surfsense_web/components/layout/ui/sidebar/ChatListItem.tsx index bfc930b25..d8fe5465f 100644 --- a/surfsense_web/components/layout/ui/sidebar/ChatListItem.tsx +++ b/surfsense_web/components/layout/ui/sidebar/ChatListItem.tsx @@ -61,7 +61,7 @@ export function ChatListItem({ onClick={handleClick} {...(isMobile ? longPressHandlers : {})} className={cn( - "flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-sm text-left", + "flex w-full items-center gap-2 overflow-hidden rounded-md px-2 py-1.5 text-xs text-left", "group-hover/item:bg-accent group-hover/item:text-accent-foreground", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", isActive && "bg-accent text-accent-foreground" diff --git a/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx index fa05559d7..76cb985b9 100644 --- a/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx @@ -178,7 +178,7 @@ export function InboxSidebarContent({ const [mounted, setMounted] = useState(false); const [openDropdown, setOpenDropdown] = useState<"filter" | null>(null); const [connectorScrollPos, setConnectorScrollPos] = useState<"top" | "middle" | "bottom">("top"); - const connectorRafRef = useRef(); + const connectorRafRef = useRef(null); const handleConnectorScroll = useCallback((e: React.UIEvent) => { const el = e.currentTarget; if (connectorRafRef.current) return; @@ -186,7 +186,7 @@ export function InboxSidebarContent({ const atTop = el.scrollTop <= 2; const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight <= 2; setConnectorScrollPos(atTop ? "top" : atBottom ? "bottom" : "middle"); - connectorRafRef.current = undefined; + connectorRafRef.current = null; }); }, []); useEffect( @@ -528,7 +528,7 @@ export function InboxSidebarContent({ return ( <> -
+
{isMobile && ( @@ -542,7 +542,7 @@ export function InboxSidebarContent({ {t("close") || "Close"} )} -

{t("inbox") || "Inbox"}

+

{t("inbox") || "Inbox"}

{isMobile ? ( @@ -811,19 +811,19 @@ export function InboxSidebarContent({
- + setSearchQuery(e.target.value)} - className="pl-9 pr-8 h-9" + className="h-8 pl-8 pr-7 text-sm" /> {searchQuery && (
) : isSearchMode ? (
- -

+ +

{t("no_results_found") || "No results found"}

-

+

{t("try_different_search") || "Try a different search term"}

) : (
{activeTab === "comments" ? ( - + ) : ( - + )} -

{getEmptyStateMessage().title}

-

{getEmptyStateMessage().hint}

+

{getEmptyStateMessage().title}

+

{getEmptyStateMessage().hint}

)}
diff --git a/surfsense_web/components/layout/ui/sidebar/NavSection.tsx b/surfsense_web/components/layout/ui/sidebar/NavSection.tsx index 0781a66c2..658067f3f 100644 --- a/surfsense_web/components/layout/ui/sidebar/NavSection.tsx +++ b/surfsense_web/components/layout/ui/sidebar/NavSection.tsx @@ -159,7 +159,7 @@ export function NavSection({ items, onItemClick, isCollapsed = false }: NavSecti } trailingContent={} diff --git a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx index f00fcee81..1064d2adc 100644 --- a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx @@ -113,7 +113,7 @@ export function Sidebar({ > {/* Header - search space name or collapse button when collapsed */} {isCollapsed ? ( -
+
{})} @@ -121,7 +121,7 @@ export function Sidebar({ />
) : ( -
+
+
- + {collapsedOverlay} {label} @@ -87,7 +87,7 @@ export function SidebarButton({ className={cn(expandedClassName, isActive && activeClassName, className)} {...buttonProps} > - {expandedIconNode ?? } + {expandedIconNode ?? } {label} {trailingContent} {badge && typeof badge !== "string" ? badge : null} diff --git a/surfsense_web/components/layout/ui/sidebar/SidebarHeader.tsx b/surfsense_web/components/layout/ui/sidebar/SidebarHeader.tsx index 2c8539dc8..2a5761d6f 100644 --- a/surfsense_web/components/layout/ui/sidebar/SidebarHeader.tsx +++ b/surfsense_web/components/layout/ui/sidebar/SidebarHeader.tsx @@ -36,14 +36,14 @@ export function SidebarHeader({ diff --git a/surfsense_web/components/layout/ui/sidebar/SidebarSection.tsx b/surfsense_web/components/layout/ui/sidebar/SidebarSection.tsx index b8ea5e1ee..5ef037fa0 100644 --- a/surfsense_web/components/layout/ui/sidebar/SidebarSection.tsx +++ b/surfsense_web/components/layout/ui/sidebar/SidebarSection.tsx @@ -39,8 +39,8 @@ export function SidebarSection({ className )} > -
- +
+ {title}