diff --git a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx index 633ce9552..d161d8dbe 100644 --- a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx +++ b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx @@ -628,17 +628,25 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid }, [router]); const handleViewAllSharedChats = useCallback(() => { - setIsAllSharedChatsSidebarOpen(true); - setIsAllPrivateChatsSidebarOpen(false); - setIsInboxSidebarOpen(false); - setIsAnnouncementsSidebarOpen(false); + setIsAllSharedChatsSidebarOpen((prev) => { + if (!prev) { + setIsAllPrivateChatsSidebarOpen(false); + setIsInboxSidebarOpen(false); + setIsAnnouncementsSidebarOpen(false); + } + return !prev; + }); }, []); const handleViewAllPrivateChats = useCallback(() => { - setIsAllPrivateChatsSidebarOpen(true); - setIsAllSharedChatsSidebarOpen(false); - setIsInboxSidebarOpen(false); - setIsAnnouncementsSidebarOpen(false); + setIsAllPrivateChatsSidebarOpen((prev) => { + if (!prev) { + setIsAllSharedChatsSidebarOpen(false); + setIsInboxSidebarOpen(false); + setIsAnnouncementsSidebarOpen(false); + } + return !prev; + }); }, []); // Delete handlers diff --git a/surfsense_web/components/layout/ui/shell/LayoutShell.tsx b/surfsense_web/components/layout/ui/shell/LayoutShell.tsx index 5141ffe9e..cb3b6c41f 100644 --- a/surfsense_web/components/layout/ui/shell/LayoutShell.tsx +++ b/surfsense_web/components/layout/ui/shell/LayoutShell.tsx @@ -187,6 +187,8 @@ export function LayoutShell({ onChatArchive={onChatArchive} onViewAllSharedChats={onViewAllSharedChats} onViewAllPrivateChats={onViewAllPrivateChats} + isSharedChatsPanelOpen={allSharedChatsPanel?.open} + isPrivateChatsPanelOpen={allPrivateChatsPanel?.open} user={user} onSettings={onSettings} onManageMembers={onManageMembers} @@ -305,6 +307,8 @@ export function LayoutShell({ onChatArchive={onChatArchive} onViewAllSharedChats={onViewAllSharedChats} onViewAllPrivateChats={onViewAllPrivateChats} + isSharedChatsPanelOpen={allSharedChatsPanel?.open} + isPrivateChatsPanelOpen={allPrivateChatsPanel?.open} user={user} onSettings={onSettings} onManageMembers={onManageMembers} diff --git a/surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx index 6b8f440db..37871fd50 100644 --- a/surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx @@ -305,9 +305,9 @@ export function AllPrivateChatsSidebar({ - + Active @@ -317,9 +317,9 @@ export function AllPrivateChatsSidebar({ - + Archived @@ -334,8 +334,8 @@ export function AllPrivateChatsSidebar({
{isLoading ? (
- {[75, 90, 55, 80, 65, 85].map((titleWidth, i) => ( -
+ {[75, 90, 55, 80, 65, 85].map((titleWidth) => ( +
diff --git a/surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx index ab0c03fc1..843eb13f1 100644 --- a/surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx @@ -305,9 +305,9 @@ export function AllSharedChatsSidebar({ - + Active @@ -317,9 +317,9 @@ export function AllSharedChatsSidebar({ - + Archived @@ -334,8 +334,8 @@ export function AllSharedChatsSidebar({
{isLoading ? (
- {[75, 90, 55, 80, 65, 85].map((titleWidth, i) => ( -
+ {[75, 90, 55, 80, 65, 85].map((titleWidth) => ( +
diff --git a/surfsense_web/components/layout/ui/sidebar/MobileSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/MobileSidebar.tsx index 18dafd5d8..def40f24f 100644 --- a/surfsense_web/components/layout/ui/sidebar/MobileSidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/MobileSidebar.tsx @@ -14,8 +14,6 @@ interface MobileSidebarProps { searchSpaces: SearchSpace[]; activeSearchSpaceId: number | null; onSearchSpaceSelect: (id: number) => void; - onSearchSpaceDelete?: (searchSpace: SearchSpace) => void; - onSearchSpaceSettings?: (searchSpace: SearchSpace) => void; onAddSearchSpace: () => void; searchSpace: SearchSpace | null; navItems: NavItem[]; @@ -30,6 +28,8 @@ interface MobileSidebarProps { onChatArchive?: (chat: ChatItem) => void; onViewAllSharedChats?: () => void; onViewAllPrivateChats?: () => void; + isSharedChatsPanelOpen?: boolean; + isPrivateChatsPanelOpen?: boolean; user: User; onSettings?: () => void; onManageMembers?: () => void; @@ -56,8 +56,7 @@ export function MobileSidebar({ searchSpaces, activeSearchSpaceId, onSearchSpaceSelect, - onSearchSpaceDelete, - onSearchSpaceSettings, + onAddSearchSpace, searchSpace, navItems, @@ -72,6 +71,8 @@ export function MobileSidebar({ onChatArchive, onViewAllSharedChats, onViewAllPrivateChats, + isSharedChatsPanelOpen = false, + isPrivateChatsPanelOpen = false, user, onSettings, onManageMembers, @@ -165,6 +166,8 @@ export function MobileSidebar({ } : undefined } + isSharedChatsPanelOpen={isSharedChatsPanelOpen} + isPrivateChatsPanelOpen={isPrivateChatsPanelOpen} user={user} onSettings={ onSettings diff --git a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx index 8a9376af3..eacaabda1 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 { FolderOpen, PenSquare } from "lucide-react"; +import { PenSquare } from "lucide-react"; import { useTranslations } from "next-intl"; import { useState } from "react"; import { Button } from "@/components/ui/button"; @@ -42,6 +42,8 @@ interface SidebarProps { onChatArchive?: (chat: ChatItem) => void; onViewAllSharedChats?: () => void; onViewAllPrivateChats?: () => void; + isSharedChatsPanelOpen?: boolean; + isPrivateChatsPanelOpen?: boolean; user: User; onSettings?: () => void; onManageMembers?: () => void; @@ -73,6 +75,8 @@ export function Sidebar({ onChatArchive, onViewAllSharedChats, onViewAllPrivateChats, + isSharedChatsPanelOpen = false, + isPrivateChatsPanelOpen = false, user, onSettings, onManageMembers, @@ -158,34 +162,16 @@ export function Sidebar({ defaultOpen={true} fillHeight={false} className="shrink-0 max-h-[50%] flex flex-col" + alwaysShowAction={!disableTooltips && isSharedChatsPanelOpen} action={ onViewAllSharedChats ? ( - disableTooltips ? ( - - ) : ( - - - - - - {t("view_all_shared_chats") || "View all shared chats"} - - - ) + ) : undefined } > @@ -232,34 +218,16 @@ export function Sidebar({ title={t("chats")} defaultOpen={true} fillHeight={true} + alwaysShowAction={!disableTooltips && isPrivateChatsPanelOpen} action={ onViewAllPrivateChats ? ( - disableTooltips ? ( - - ) : ( - - - - - - {t("view_all_private_chats") || "View all private chats"} - - - ) + ) : undefined } > diff --git a/surfsense_web/components/layout/ui/sidebar/SidebarSection.tsx b/surfsense_web/components/layout/ui/sidebar/SidebarSection.tsx index 776aa2244..48135ff10 100644 --- a/surfsense_web/components/layout/ui/sidebar/SidebarSection.tsx +++ b/surfsense_web/components/layout/ui/sidebar/SidebarSection.tsx @@ -10,6 +10,7 @@ interface SidebarSectionProps { defaultOpen?: boolean; children: React.ReactNode; action?: React.ReactNode; + alwaysShowAction?: boolean; persistentAction?: React.ReactNode; className?: string; fillHeight?: boolean; @@ -20,6 +21,7 @@ export function SidebarSection({ defaultOpen = true, children, action, + alwaysShowAction = false, persistentAction, className, fillHeight = false, @@ -37,29 +39,30 @@ export function SidebarSection({ className )} > -
- - - {title} - +
+ + {title} + + - {/* Action button - visible on hover (always visible on mobile) */} - {action && ( -
- {action} -
- )} + {action && ( +
+ {action} +
+ )} - {/* Persistent action - always visible */} - {persistentAction && ( -
{persistentAction}
- )} -
+ {persistentAction && ( +
{persistentAction}
+ )} +
diff --git a/surfsense_web/messages/en.json b/surfsense_web/messages/en.json index a454ea5c9..172ba215b 100644 --- a/surfsense_web/messages/en.json +++ b/surfsense_web/messages/en.json @@ -655,6 +655,8 @@ "no_shared_chats": "No shared chats", "view_all_shared_chats": "View all shared chats", "view_all_private_chats": "View all private chats", + "show_all": "Show all", + "hide": "Hide", "no_chats": "No chats yet", "start_new_chat_hint": "Start a new chat", "error_loading_chats": "Error loading chats", diff --git a/surfsense_web/messages/es.json b/surfsense_web/messages/es.json index bd7c716ff..849ffa69a 100644 --- a/surfsense_web/messages/es.json +++ b/surfsense_web/messages/es.json @@ -655,6 +655,8 @@ "no_shared_chats": "No hay chats compartidos", "view_all_shared_chats": "Ver todos los chats compartidos", "view_all_private_chats": "Ver todos los chats privados", + "show_all": "Ver todo", + "hide": "Ocultar", "no_chats": "Aún no hay chats", "start_new_chat_hint": "Iniciar un nuevo chat", "error_loading_chats": "Error al cargar chats", diff --git a/surfsense_web/messages/hi.json b/surfsense_web/messages/hi.json index af8fc7062..d2847623f 100644 --- a/surfsense_web/messages/hi.json +++ b/surfsense_web/messages/hi.json @@ -655,6 +655,8 @@ "no_shared_chats": "कोई साझा चैट नहीं", "view_all_shared_chats": "सभी साझा चैट देखें", "view_all_private_chats": "सभी निजी चैट देखें", + "show_all": "सभी देखें", + "hide": "छिपाएँ", "no_chats": "अभी तक कोई चैट नहीं", "start_new_chat_hint": "नई चैट शुरू करें", "error_loading_chats": "चैट लोड करने में त्रुटि", diff --git a/surfsense_web/messages/pt.json b/surfsense_web/messages/pt.json index 2a15f51f3..d475035a5 100644 --- a/surfsense_web/messages/pt.json +++ b/surfsense_web/messages/pt.json @@ -655,6 +655,8 @@ "no_shared_chats": "Nenhum chat compartilhado", "view_all_shared_chats": "Ver todos os chats compartilhados", "view_all_private_chats": "Ver todos os chats privados", + "show_all": "Ver tudo", + "hide": "Ocultar", "no_chats": "Nenhum chat ainda", "start_new_chat_hint": "Iniciar um novo chat", "error_loading_chats": "Erro ao carregar chats", diff --git a/surfsense_web/messages/zh.json b/surfsense_web/messages/zh.json index 477fc7b49..ef2d18a32 100644 --- a/surfsense_web/messages/zh.json +++ b/surfsense_web/messages/zh.json @@ -639,6 +639,8 @@ "no_shared_chats": "暂无共享对话", "view_all_shared_chats": "查看所有共享对话", "view_all_private_chats": "查看所有私人对话", + "show_all": "查看全部", + "hide": "隐藏", "no_chats": "暂无对话", "start_new_chat_hint": "开始新对话", "error_loading_chats": "加载对话时出错",