From ee561f42ff7fa96543be2948370f2da39ac73e89 Mon Sep 17 00:00:00 2001 From: Yuhong Sun Date: Thu, 18 Jul 2024 11:13:16 -0700 Subject: [PATCH] Cleaner Layout (#1857) --- web/src/app/chat/sessionSidebar/PagesTab.tsx | 72 +++++++++++--------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/web/src/app/chat/sessionSidebar/PagesTab.tsx b/web/src/app/chat/sessionSidebar/PagesTab.tsx index 137cb6a60..09d3d737d 100644 --- a/web/src/app/chat/sessionSidebar/PagesTab.tsx +++ b/web/src/app/chat/sessionSidebar/PagesTab.tsx @@ -54,11 +54,13 @@ export function PagesTab({ } }; + const isHistoryEmpty = !existingChats || existingChats.length === 0; + return (
{folders && folders.length > 0 && (
-
+
Folders
{(page == "chat" || page == "search") && ( -

+

{page == "chat" && "Chat "} {page == "search" && "Search "} History

)} - {Object.entries(groupedChatSessions).map( - ([dateRange, chatSessions], ind) => { - if (chatSessions.length > 0) { - return ( -
-
- {dateRange} + {isHistoryEmpty ? ( +

+ {page === "search" + ? "Try running a search! Your search history will appear here." + : "Try sending a message! Your chat history will appear here."} +

+ ) : ( + Object.entries(groupedChatSessions).map( + ([dateRange, chatSessions], ind) => { + if (chatSessions.length > 0) { + return ( +
+
+ {dateRange} +
+ {chatSessions + .filter((chat) => chat.folder_id === null) + .map((chat) => { + const isSelected = currentChatId === chat.id; + return ( +
+ +
+ ); + })}
- {chatSessions - .filter((chat) => chat.folder_id === null) - .map((chat) => { - const isSelected = currentChatId === chat.id; - return ( -
- -
- ); - })} -
- ); + ); + } } - } + ) )}