From d72b28cf77efea309bd66b3494b4194cba5d43e1 Mon Sep 17 00:00:00 2001 From: sam Date: Sun, 19 Oct 2025 13:24:12 +0700 Subject: [PATCH] loading state copy --- src/components/dm/ChatArea.tsx | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/components/dm/ChatArea.tsx b/src/components/dm/ChatArea.tsx index cc69c04..bfff943 100644 --- a/src/components/dm/ChatArea.tsx +++ b/src/components/dm/ChatArea.tsx @@ -122,14 +122,26 @@ const ChatHeader = ({ pubkey, onBack }: { pubkey: string; onBack?: () => void }) ); }; -const EmptyState = () => { +const EmptyState = ({ isLoading }: { isLoading: boolean }) => { return (
-

Select a conversation to start messaging

-

- Your messages are encrypted and stored locally -

+ {isLoading ? ( + <> + +

Loading conversations...

+

+ Fetching encrypted messages from relays +

+ + ) : ( + <> +

Select a conversation to start messaging

+

+ Your messages are encrypted and stored locally +

+ + )}
); @@ -137,7 +149,7 @@ const EmptyState = () => { export const ChatArea = ({ pubkey, onBack, className }: ChatAreaProps) => { const { user } = useCurrentUser(); - const { sendMessage, protocolMode } = useDMContext(); + const { sendMessage, protocolMode, isLoading } = useDMContext(); const { messages } = useConversationMessages(pubkey || ''); const [messageText, setMessageText] = useState(''); @@ -196,7 +208,7 @@ export const ChatArea = ({ pubkey, onBack, className }: ChatAreaProps) => { if (!pubkey) { return ( - + ); }