From 65f3916fc38abebeb271ff0141015601719e9ab3 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 29 Apr 2026 03:46:40 +0530 Subject: [PATCH] refactor(header, layout): simplify header component by removing unused tabs and mobile checks; enhance RightPanel and LayoutShell with improved styling and sidebar functionality --- .../components/layout/ui/header/Header.tsx | 8 +-- .../layout/ui/right-panel/RightPanel.tsx | 11 +++- .../layout/ui/shell/LayoutShell.tsx | 59 +++++++++++-------- .../layout/ui/sidebar/DocumentsSidebar.tsx | 4 +- .../ui/sidebar/SidebarCollapseButton.tsx | 7 ++- .../components/layout/ui/tabs/TabBar.tsx | 14 ++--- 6 files changed, 59 insertions(+), 44 deletions(-) diff --git a/surfsense_web/components/layout/ui/header/Header.tsx b/surfsense_web/components/layout/ui/header/Header.tsx index ec54cb901..fc80bb4d2 100644 --- a/surfsense_web/components/layout/ui/header/Header.tsx +++ b/surfsense_web/components/layout/ui/header/Header.tsx @@ -4,12 +4,10 @@ import { useAtomValue } from "jotai"; import { usePathname } from "next/navigation"; import { currentThreadAtom } from "@/atoms/chat/current-thread.atom"; import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms"; -import { activeTabAtom, tabsAtom } from "@/atoms/tabs/tabs.atom"; +import { activeTabAtom } from "@/atoms/tabs/tabs.atom"; import { ChatHeader } from "@/components/new-chat/chat-header"; import { ChatShareButton } from "@/components/new-chat/chat-share-button"; -import { useIsMobile } from "@/hooks/use-mobile"; import type { ChatVisibility, ThreadRecord } from "@/lib/chat/thread-persistence"; -import { RightPanelExpandButton } from "../right-panel/RightPanel"; interface HeaderProps { mobileMenuTrigger?: React.ReactNode; @@ -18,14 +16,11 @@ interface HeaderProps { export function Header({ mobileMenuTrigger }: HeaderProps) { const pathname = usePathname(); const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom); - const isMobile = useIsMobile(); const activeTab = useAtomValue(activeTabAtom); - const tabs = useAtomValue(tabsAtom); const isFreePage = pathname?.startsWith("/free") ?? false; const isChatPage = pathname?.includes("/new-chat") ?? false; const isDocumentTab = activeTab?.type === "document"; - const hasTabBar = tabs.length > 1; const currentThreadState = useAtomValue(currentThreadAtom); @@ -72,7 +67,6 @@ export function Header({ mobileMenuTrigger }: HeaderProps) { {hasThread && ( )} - {!isMobile && !hasTabBar && } ); diff --git a/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx b/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx index c26cc9b23..f9c02b197 100644 --- a/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx +++ b/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx @@ -48,7 +48,12 @@ function CollapseButton({ onClick }: { onClick: () => void }) { return ( - @@ -88,7 +93,7 @@ export function RightPanelExpandButton() { variant="ghost" size="icon" onClick={() => startTransition(() => setCollapsed(false))} - className="h-8 w-8 shrink-0 -m-0.5" + className="h-8 w-8 shrink-0 -m-0.5 text-muted-foreground hover:text-foreground hover:bg-muted/40" > Expand panel @@ -161,7 +166,7 @@ export function RightPanel({ documentsPanel }: RightPanelProps) { return (