Add loading skeleton to NostrSettings page

This commit is contained in:
Alex Gleason committed 2025-09-19 12:22:10 -05:00
1 parent 6f399af544
commit 1cccd8c254
4 files changed
+37 -9

No files matched your search

+23 -2
View File
@@ -3,6 +3,7 @@ import { Button } from '@/components/ui/button';
import { Label } from '@/components/ui/label';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
import { Skeleton } from '@/components/ui/skeleton';
import { RelaySelector } from '@/components/RelaySelector';
import LoginDialog from '@/components/auth/LoginDialog';
import SignupDialog from '@/components/auth/SignupDialog';
@@ -15,7 +16,7 @@ import { useState } from 'react';
export function NostrSettings() {
const isMobile = useIsMobile();
const navigate = useNavigate();
const { authors, currentUser, setLogin, removeLogin } = useLoggedInAccounts();
const { authors, currentUser, setLogin, removeLogin, isLoading } = useLoggedInAccounts();
const [showLoginDialog, setShowLoginDialog] = useState(false);
const [showSignupDialog, setShowSignupDialog] = useState(false);
@@ -86,7 +87,27 @@ export function NostrSettings() {
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
{authors.length === 0 ? (
{isLoading ? (
<div className="border rounded-lg overflow-hidden">
{/* Loading skeleton for accounts */}
{[...Array(2)].map((_, i) => (
<div key={i} className="flex items-center gap-3 p-3 border-b last:border-b-0">
<Skeleton className="h-10 w-10 rounded-full" />
<div className="flex-1 space-y-1">
<Skeleton className="h-4 w-32" />
</div>
<Skeleton className="h-8 w-8 rounded" />
</div>
))}
{/* Add account button skeleton */}
<div className="flex items-center gap-3 p-3">
<Skeleton className="h-10 w-10 rounded-full" />
<div className="flex-1 space-y-1">
<Skeleton className="h-4 w-24" />
</div>
</div>
</div>
) : authors.length === 0 ? (
<div className="text-center py-8">
<User className="h-12 w-12 mx-auto text-muted-foreground mb-4" />
<p className="text-muted-foreground mb-4">