Skip to content

Commit 3fd02a9

Browse files
committed
fix(dashboard): refine modal loading skeletons
1 parent d53f974 commit 3fd02a9

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

dashboard/src/features/groups/dialogs/group-modal.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import { useCreateGroup, useModifyGroup, useGetInbounds } from '@/service/api'
99
import { toast } from 'sonner'
1010
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem } from '@/components/ui/command'
1111
import { Badge } from '@/components/ui/badge'
12-
import { Pencil, Loader2, X, Group } from 'lucide-react'
12+
import { Skeleton } from '@/components/ui/skeleton'
13+
import { Pencil, X, Group } from 'lucide-react'
1314
import { cn } from '@/lib/utils'
1415
import { queryClient } from '@/utils/query-client'
1516
import useDynamicErrorHandler from '@/hooks/use-dynamic-errors.ts'
@@ -133,12 +134,16 @@ export default function GroupModal({ isDialogOpen, onOpenChange, form, editingGr
133134
)}
134135
<Command className="mb-3 rounded-md border">
135136
<CommandInput placeholder={t('searchInbounds')} disabled={isLoadingInbounds} />
136-
<CommandEmpty>{isLoadingInbounds ? t('loading', { defaultValue: 'Loading...' }) : t('noInboundsFound')}</CommandEmpty>
137+
{!isLoadingInbounds && <CommandEmpty>{t('noInboundsFound')}</CommandEmpty>}
137138
<CommandGroup dir="ltr" className="max-h-40 overflow-auto">
138139
{isLoadingInbounds ? (
139-
<div className="flex items-center justify-center gap-2 px-2 py-3 text-xs text-muted-foreground">
140-
<Loader2 className="h-3 w-3 animate-spin" />
141-
<span>{t('loading', { defaultValue: 'Loading...' })}</span>
140+
<div className="space-y-2 px-2 py-3">
141+
{Array.from({ length: 4 }).map((_, index) => (
142+
<div key={index} className="flex items-center gap-2">
143+
<Skeleton className="h-4 w-4 rounded-sm" />
144+
<Skeleton className="h-4 w-full max-w-[220px]" />
145+
</div>
146+
))}
142147
</div>
143148
) : (
144149
inbounds?.map(inbound => (

dashboard/src/features/users/dialogs/set-owner-modal.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,7 @@ export default function SetOwnerModal({ open, onClose, userId, username, userIds
128128
</div>
129129
)}
130130
{isLoading ? (
131-
<div className="space-y-2 p-2">
132-
<Skeleton className="h-10 w-full" />
133-
<div className="space-y-1 rounded-md border p-2">
134-
<Skeleton className="h-4 w-32" />
135-
</div>
136-
</div>
131+
<Skeleton className="h-10 w-full rounded-md" />
137132
) : isError ? (
138133
<div className="p-2 text-destructive">{t('setOwnerModal.loadError', { defaultValue: 'Failed to load admins.' })}</div>
139134
) : admins.length > 0 ? (

0 commit comments

Comments
 (0)