mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 16:33:36 +00:00
loading state copy
This commit is contained in:
1 parent
67658eb446
commit
d72b28cf77
1 file changed
+19
-7
@@ -122,14 +122,26 @@ const ChatHeader = ({ pubkey, onBack }: { pubkey: string; onBack?: () => void })
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const EmptyState = () => {
|
const EmptyState = ({ isLoading }: { isLoading: boolean }) => {
|
||||||
return (
|
return (
|
||||||
<div className="h-full flex items-center justify-center p-8">
|
<div className="h-full flex items-center justify-center p-8">
|
||||||
<div className="text-center text-muted-foreground max-w-sm">
|
<div className="text-center text-muted-foreground max-w-sm">
|
||||||
<p className="text-sm">Select a conversation to start messaging</p>
|
{isLoading ? (
|
||||||
<p className="text-xs mt-2">
|
<>
|
||||||
Your messages are encrypted and stored locally
|
<Loader2 className="h-8 w-8 animate-spin mx-auto mb-4" />
|
||||||
</p>
|
<p className="text-sm">Loading conversations...</p>
|
||||||
|
<p className="text-xs mt-2">
|
||||||
|
Fetching encrypted messages from relays
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<p className="text-sm">Select a conversation to start messaging</p>
|
||||||
|
<p className="text-xs mt-2">
|
||||||
|
Your messages are encrypted and stored locally
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -137,7 +149,7 @@ const EmptyState = () => {
|
|||||||
|
|
||||||
export const ChatArea = ({ pubkey, onBack, className }: ChatAreaProps) => {
|
export const ChatArea = ({ pubkey, onBack, className }: ChatAreaProps) => {
|
||||||
const { user } = useCurrentUser();
|
const { user } = useCurrentUser();
|
||||||
const { sendMessage, protocolMode } = useDMContext();
|
const { sendMessage, protocolMode, isLoading } = useDMContext();
|
||||||
const { messages } = useConversationMessages(pubkey || '');
|
const { messages } = useConversationMessages(pubkey || '');
|
||||||
|
|
||||||
const [messageText, setMessageText] = useState('');
|
const [messageText, setMessageText] = useState('');
|
||||||
@@ -196,7 +208,7 @@ export const ChatArea = ({ pubkey, onBack, className }: ChatAreaProps) => {
|
|||||||
if (!pubkey) {
|
if (!pubkey) {
|
||||||
return (
|
return (
|
||||||
<Card className={cn("h-full", className)}>
|
<Card className={cn("h-full", className)}>
|
||||||
<EmptyState />
|
<EmptyState isLoading={isLoading} />
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user