From c1804173294c6754b9a976c5e8118c89a1a3709e Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Thu, 14 May 2026 23:28:41 +0530 Subject: [PATCH] refactor: enhance loading and sidebar components with improved skeleton loading states and styling --- .../[search_space_id]/new-chat/loading.tsx | 85 +++++++++++-------- .../components/layout/ui/sidebar/Sidebar.tsx | 41 ++++----- 2 files changed, 72 insertions(+), 54 deletions(-) diff --git a/surfsense_web/app/dashboard/[search_space_id]/new-chat/loading.tsx b/surfsense_web/app/dashboard/[search_space_id]/new-chat/loading.tsx index 6eb9223ca..e18100e6a 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/new-chat/loading.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/new-chat/loading.tsx @@ -2,42 +2,59 @@ import { Skeleton } from "@/components/ui/skeleton"; export default function Loading() { return ( -
-
- {/* User message */} -
- +
+
+
+
+ {/* User message */} +
+ +
+ + {/* Assistant message */} +
+ + + +
+ + {/* User message */} +
+ +
+ + {/* Assistant message */} +
+ + + +
+ + {/* User message */} +
+ +
- {/* Assistant message */} -
- - - -
- - {/* User message */} -
- -
- - {/* Assistant message */} -
- - - -
- - {/* User message */} -
- -
-
- - {/* Input bar */} -
-
- + {/* Input bar */} +
+
+ +
diff --git a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx index 7cc65d2b8..a55909ab2 100644 --- a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx @@ -23,11 +23,24 @@ import { SidebarHeader } from "./SidebarHeader"; import { SidebarSection } from "./SidebarSection"; import { SidebarUserProfile } from "./SidebarUserProfile"; -function ChatListItemSkeleton() { +const CHAT_LIST_SKELETON_WIDTHS = ["w-[78%]", "w-[64%]", "w-[86%]", "w-[58%]", "w-[72%]"]; + +function ChatListItemSkeleton({ widthClass }: { widthClass: string }) { return ( -
- - +
+
+ +
+
+ ); +} + +function ChatListSkeletonRows() { + return ( +
+ {CHAT_LIST_SKELETON_WIDTHS.map((widthClass) => ( + + ))}
); } @@ -217,13 +230,7 @@ export function Sidebar({ } > {isLoadingChats ? ( -
- - - - - -
+ ) : sharedChats.length > 0 ? (
) : ( -

{t("no_shared_chats")}

+

{t("no_shared_chats")}

)} @@ -274,13 +281,7 @@ export function Sidebar({ } > {isLoadingChats ? ( -
- - - - - -
+ ) : chats.length > 0 ? (
) : ( -

{t("no_chats")}

+

{t("no_chats")}

)}