From 8aa10d38b148370f97b5faea679b948cc72b7dc5 Mon Sep 17 00:00:00 2001 From: Khairul Hidayat Date: Fri, 18 Sep 2026 07:10:38 +0800 Subject: [PATCH] feat: add skeleton loader --- ui/src/app/chats.tsx | 18 +++++++++++++++++- ui/src/app/messages.tsx | 29 +++++++++++++++++++++++++---- ui/src/components/ui/skeleton.tsx | 13 +++++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 ui/src/components/ui/skeleton.tsx diff --git a/ui/src/app/chats.tsx b/ui/src/app/chats.tsx index 0b3cf01..513f57e 100644 --- a/ui/src/app/chats.tsx +++ b/ui/src/app/chats.tsx @@ -1,4 +1,5 @@ import Avatar from "@/components/ui/avatar"; +import { Skeleton } from "@/components/ui/skeleton"; import { useChats } from "@/hooks/useChats"; import { useContacts } from "@/hooks/useContact"; import { getFormattedName } from "@/lib/utils"; @@ -23,7 +24,7 @@ export default function ChatsSection({ selected, onSelect }: Props) { const [query, setQuery] = useState(""); const contacts = useContacts(); - const { data: chats } = useChats({ + const { data: chats, isLoading } = useChats({ refetchInterval: 10_000, }); @@ -77,6 +78,21 @@ export default function ChatsSection({ selected, onSelect }: Props) { */}
+ {chats == null || isLoading + ? [...Array(20)].map((_, i) => ( +
+ +
+ + +
+
+ )) + : null} + {filteredChats?.map((chat) => (