Skip to content

Commit 3f15e4b

Browse files
committed
chore(usage-modal): enhance loading state
1 parent d91293f commit 3f15e4b

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

dashboard/src/components/dialogs/usage-modal.tsx

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,39 @@ const UsageModal = ({ open, onClose, username }: UsageModalProps) => {
690690
<CardContent dir="ltr" className="mb-0 p-0">
691691
<div className="w-full">
692692
{isLoading ? (
693-
<div className="flex h-60 w-full items-center justify-center">
694-
<div className="h-40 w-full animate-pulse rounded-lg" />
693+
<div className="mx-auto w-full">
694+
<div className={`w-full px-4 py-2 ${width < 500 ? 'h-[200px]' : 'h-[320px]'}`}>
695+
<div className="flex h-full flex-col">
696+
<div className="flex-1">
697+
<div className="flex h-full items-end justify-center">
698+
<div className={`flex items-end gap-2 ${width < 500 ? 'h-40' : 'h-48'}`}>
699+
{[1, 2, 3, 4, 5, 6, 7, 8].map(i => {
700+
const isMobile = width < 500
701+
let heightClass = ''
702+
if (i === 4 || i === 5) {
703+
heightClass = isMobile ? 'h-28' : 'h-32'
704+
} else if (i === 3 || i === 6) {
705+
heightClass = isMobile ? 'h-20' : 'h-24'
706+
} else if (i === 2 || i === 7) {
707+
heightClass = isMobile ? 'h-12' : 'h-16'
708+
} else {
709+
heightClass = isMobile ? 'h-16' : 'h-20'
710+
}
711+
return (
712+
<div key={i} className="animate-pulse">
713+
<div className={`w-6 rounded-t-lg bg-muted sm:w-8 ${heightClass}`} />
714+
</div>
715+
)
716+
})}
717+
</div>
718+
</div>
719+
</div>
720+
<div className="mt-4 flex justify-between px-2">
721+
<div className="h-3 w-12 animate-pulse rounded bg-muted sm:h-4 sm:w-16" />
722+
<div className="h-3 w-12 animate-pulse rounded bg-muted sm:h-4 sm:w-16" />
723+
</div>
724+
</div>
725+
</div>
695726
</div>
696727
) : processedChartData.length === 0 ? (
697728
<div className="flex h-60 flex-col items-center justify-center gap-2 text-muted-foreground">

0 commit comments

Comments
 (0)