diff --git a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx index 7fc862e49..682d2923e 100644 --- a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx +++ b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx @@ -631,6 +631,9 @@ export function LayoutDataProvider({ const isArtifactsPage = pathname?.endsWith("/artifacts") === true; const isPlaygroundPage = pathname?.includes("/playground") === true; const isAllChatsPage = pathname?.endsWith("/chats") === true; + const handleChatsClick = useCallback(() => { + router.push(`/dashboard/${workspaceId}/chats`); + }, [router, workspaceId]); const handleViewAllChats = useCallback(() => { router.push( isAllChatsPage ? `/dashboard/${workspaceId}/new-chat` : `/dashboard/${workspaceId}/chats` @@ -671,6 +674,7 @@ export function LayoutDataProvider({ onChatRename={handleChatRename} onChatDelete={handleChatDelete} onChatArchive={handleChatArchive} + onChatsClick={handleChatsClick} onViewAllChats={handleViewAllChats} user={{ email: user?.email || "", diff --git a/surfsense_web/components/layout/ui/shell/LayoutShell.tsx b/surfsense_web/components/layout/ui/shell/LayoutShell.tsx index 8578b7dec..44a2259ee 100644 --- a/surfsense_web/components/layout/ui/shell/LayoutShell.tsx +++ b/surfsense_web/components/layout/ui/shell/LayoutShell.tsx @@ -106,6 +106,7 @@ interface LayoutShellProps { onChatRename?: (chat: ChatItem) => void; onChatDelete?: (chat: ChatItem) => void; onChatArchive?: (chat: ChatItem) => void; + onChatsClick?: () => void; onViewAllChats?: () => void; user: User; onSettings?: () => void; @@ -208,6 +209,7 @@ export function LayoutShell({ onChatRename, onChatDelete, onChatArchive, + onChatsClick, onViewAllChats, user, onSettings, @@ -289,6 +291,7 @@ export function LayoutShell({ onChatRename={onChatRename} onChatDelete={onChatDelete} onChatArchive={onChatArchive} + onChatsClick={onChatsClick} onViewAllChats={onViewAllChats} isAllChatsActive={isAllChatsPage} user={user} @@ -388,6 +391,7 @@ export function LayoutShell({ onChatRename={onChatRename} onChatDelete={onChatDelete} onChatArchive={onChatArchive} + onChatsClick={onChatsClick} onViewAllChats={onViewAllChats} isAllChatsActive={isAllChatsPage} user={user} diff --git a/surfsense_web/components/layout/ui/sidebar/MobileSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/MobileSidebar.tsx index 1d02b56f4..de1b08a6a 100644 --- a/surfsense_web/components/layout/ui/sidebar/MobileSidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/MobileSidebar.tsx @@ -28,6 +28,7 @@ interface MobileSidebarProps { onChatRename?: (chat: ChatItem) => void; onChatDelete?: (chat: ChatItem) => void; onChatArchive?: (chat: ChatItem) => void; + onChatsClick?: () => void; onViewAllChats?: () => void; isAllChatsActive?: boolean; user: User; @@ -77,6 +78,7 @@ export function MobileSidebar({ onChatRename, onChatDelete, onChatArchive, + onChatsClick, onViewAllChats, isAllChatsActive = false, user, @@ -194,6 +196,14 @@ export function MobileSidebar({ onChatRename={onChatRename} onChatDelete={onChatDelete} onChatArchive={onChatArchive} + onChatsClick={ + onChatsClick + ? () => { + onOpenChange(false); + onChatsClick(); + } + : undefined + } onViewAllChats={ onViewAllChats ? () => { diff --git a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx index 7862ae90e..e24523448 100644 --- a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx @@ -1,6 +1,6 @@ "use client"; -import { CreditCard, SquarePen, Zap } from "lucide-react"; +import { CreditCard, MessageCircleMore, SquarePen, Zap } from "lucide-react"; import Link from "next/link"; import { useParams } from "next/navigation"; import { useTranslations } from "next-intl"; @@ -62,6 +62,7 @@ interface SidebarProps { onChatRename?: (chat: ChatItem) => void; onChatDelete?: (chat: ChatItem) => void; onChatArchive?: (chat: ChatItem) => void; + onChatsClick?: () => void; onViewAllChats?: () => void; isAllChatsActive?: boolean; user: User; @@ -101,6 +102,7 @@ export function Sidebar({ onChatRename, onChatDelete, onChatArchive, + onChatsClick, onViewAllChats, isAllChatsActive = false, user, @@ -222,6 +224,16 @@ export function Sidebar({ onScroll={(event) => setIsSidebarNavScrolled(event.currentTarget.scrollTop > 0)} >
+ {onChatsClick && ( + + )} {automationsItem && (