Refresh task loading skeletons

Updated loading states across the task dashboard, client detail, and project detail pages to match the current UI structure more closely. This change standardizes placeholder shapes, improves accessibility labels, and refines skeleton layouts for headers, stat blocks, filters, and card grids for a more consistent loading experience.
This commit is contained in:
Ichsan Kurniawan
2026-10-07 11:17:21 +07:00
parent 0d9a284a3f
commit c6ecabd084
3 changed files with 111 additions and 132 deletions
@@ -3,70 +3,59 @@ export default function Loading() {
<div
className="flex-1 space-y-6 p-4 sm:p-8 pt-4 sm:pt-6"
role="status"
aria-label="Loading client details"
aria-label="Loading client detail"
>
{/* Back Link Skeleton */}
<div className="h-5 w-32 animate-pulse rounded-md bg-muted" />
{/* Back link placeholder */}
<div className="h-5 w-32 animate-pulse rounded-lg bg-muted" />
{/* Client Profile Card Skeleton */}
<div className="rounded-2xl border border-border bg-card p-5 sm:p-7">
<div className="flex flex-col gap-6 md:flex-row md:items-start md:justify-between">
<div className="rounded-2xl border border-border bg-card p-5 sm:p-7 shadow-2xs">
<div className="flex flex-col gap-6 sm:flex-row sm:items-start sm:justify-between">
<div className="flex min-w-0 items-start gap-4 sm:gap-5 flex-1">
<div className="h-20 w-20 sm:h-24 sm:w-24 shrink-0 animate-pulse rounded-2xl bg-muted" />
<div className="min-w-0 flex-1 space-y-3">
<div className="flex flex-wrap items-center gap-2">
<div className="h-5 w-16 animate-pulse rounded-lg bg-muted" />
<div className="h-5 w-20 animate-pulse rounded-lg bg-muted" />
<div className="h-16 w-16 sm:h-20 sm:w-20 shrink-0 animate-pulse rounded-2xl bg-muted" />
<div className="min-w-0 flex-1 space-y-2.5">
<div className="flex items-center gap-2">
<div className="h-5 w-20 animate-pulse rounded-md bg-muted" />
<div className="h-5 w-24 animate-pulse rounded-md bg-muted" />
</div>
<div className="h-8 w-3/4 max-w-sm animate-pulse rounded-lg bg-muted" />
<div className="h-4 w-48 animate-pulse rounded bg-muted" />
<div className="h-7 w-2/3 max-w-sm animate-pulse rounded-lg bg-muted" />
<div className="h-4 w-full max-w-md animate-pulse rounded bg-muted" />
</div>
</div>
<div className="h-9 w-36 shrink-0 animate-pulse rounded-lg bg-muted" />
</div>
<div className="mt-7 grid grid-cols-2 gap-x-6 gap-y-5 border-t border-border/70 pt-6 sm:grid-cols-4">
{/* Metrics / Key facts row */}
<div className="mt-7 grid grid-cols-2 gap-4 border-t border-border/70 pt-6 sm:grid-cols-4">
{Array.from({ length: 4 }).map((_, i) => (
<div key={i} className="space-y-2">
<div className="h-3 w-14 animate-pulse rounded bg-muted" />
<div className="h-4 w-24 animate-pulse rounded bg-muted" />
<div key={i} className="space-y-1.5">
<div className="h-3 w-16 animate-pulse rounded bg-muted" />
<div className="h-5 w-24 animate-pulse rounded bg-muted" />
</div>
))}
</div>
</div>
{/* Project Assignments Section Skeleton */}
<div className="space-y-4 pt-2">
<div className="flex items-center justify-between gap-4">
<div className="h-7 w-48 animate-pulse rounded-lg bg-muted" />
<div className="h-6 w-20 animate-pulse rounded-md bg-muted" />
</div>
{/* Filter Bar Skeleton */}
<div className="h-11 w-full animate-pulse rounded-xl border border-border bg-card" />
{/* Filter & Layout Bar Skeleton */}
<div className="h-10 w-full animate-pulse rounded-xl border border-border bg-card" />
{/* Assignment Cards Grid Skeleton */}
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
{Array.from({ length: 3 }).map((_, i) => (
<div key={i} className="rounded-xl border border-border/80 bg-card p-5 space-y-4">
<div className="flex items-center justify-between">
<div className="h-5 w-24 animate-pulse rounded bg-muted" />
<div className="h-4 w-16 animate-pulse rounded bg-muted" />
</div>
<div className="space-y-2">
<div className="h-5 w-3/4 animate-pulse rounded bg-muted" />
<div className="h-3.5 w-full animate-pulse rounded bg-muted" />
</div>
<div className="flex items-center justify-between border-t border-border/60 pt-3">
<div className="h-4 w-28 animate-pulse rounded bg-muted" />
<div className="h-6 w-16 animate-pulse rounded-full bg-muted" />
</div>
{/* Assignment Cards Grid Skeleton */}
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
{Array.from({ length: 6 }).map((_, i) => (
<div key={i} className="rounded-2xl border border-border bg-card p-5 space-y-3.5 shadow-2xs">
<div className="flex items-center justify-between gap-2">
<div className="h-5 w-24 animate-pulse rounded-md bg-muted" />
<div className="h-5 w-16 animate-pulse rounded-md bg-muted" />
</div>
))}
</div>
<div className="space-y-2">
<div className="h-5 w-4/5 animate-pulse rounded bg-muted" />
<div className="h-4 w-3/5 animate-pulse rounded bg-muted" />
</div>
<div className="flex items-center justify-between border-t border-border/60 pt-3">
<div className="h-4 w-32 animate-pulse rounded bg-muted" />
<div className="h-6 w-16 animate-pulse rounded-full bg-muted" />
</div>
</div>
))}
</div>
</div>
);
@@ -5,98 +5,93 @@ export default function Loading() {
role="status"
aria-label="Loading project detail"
>
{/* Back Link Skeleton */}
<div className="h-5 w-32 animate-pulse rounded-md bg-muted" />
{/* Back link placeholder */}
<div className="h-5 w-32 animate-pulse rounded-lg bg-muted" />
{/* Project Header Skeleton */}
<div className="rounded-2xl border border-border bg-card p-5 sm:p-7">
<div className="rounded-2xl border border-border bg-card p-5 sm:p-7 shadow-2xs">
<div className="flex flex-col gap-6 md:flex-row md:items-start md:justify-between">
<div className="flex min-w-0 items-start gap-4 sm:gap-5 flex-1">
<div className="h-14 w-14 sm:h-20 sm:w-20 shrink-0 animate-pulse rounded-2xl bg-muted" />
<div className="min-w-0 flex-1 space-y-3">
<div className="flex flex-wrap items-center gap-2">
<div className="h-5 w-20 animate-pulse rounded-lg bg-muted" />
<div className="h-5 w-16 animate-pulse rounded-lg bg-muted" />
<div className="h-5 w-24 animate-pulse rounded-lg bg-muted" />
<div className="flex items-center gap-2">
<div className="h-5 w-20 animate-pulse rounded-md bg-muted" />
<div className="h-5 w-24 animate-pulse rounded-md bg-muted" />
<div className="h-5 w-28 animate-pulse rounded-md bg-muted" />
</div>
<div className="h-8 w-3/4 max-w-md animate-pulse rounded-lg bg-muted" />
<div className="h-7 w-3/4 max-w-md animate-pulse rounded-lg bg-muted" />
<div className="h-4 w-full max-w-xl animate-pulse rounded bg-muted" />
</div>
</div>
<div className="h-9 w-28 shrink-0 animate-pulse rounded-lg bg-muted" />
</div>
<div className="mt-7 grid grid-cols-2 gap-4 border-t border-border/70 pt-6 sm:grid-cols-4">
{/* Key Facts Grid */}
<div className="mt-7 grid grid-cols-2 gap-x-6 gap-y-5 border-t border-border/70 pt-6 sm:grid-cols-4">
{Array.from({ length: 4 }).map((_, i) => (
<div key={i} className="space-y-2">
<div className="h-3 w-12 animate-pulse rounded bg-muted" />
<div className="h-4 w-24 animate-pulse rounded bg-muted" />
<div key={i} className="space-y-1.5">
<div className="h-3 w-14 animate-pulse rounded bg-muted" />
<div className="h-4 w-28 animate-pulse rounded bg-muted" />
</div>
))}
</div>
{/* Client Link Footer */}
<div className="mt-6 flex items-center justify-between border-t border-border/60 pt-4">
<div className="flex items-center gap-2.5">
<div className="h-6 w-6 animate-pulse rounded-full bg-muted" />
<div className="h-4 w-36 animate-pulse rounded bg-muted" />
</div>
<div className="h-4 w-24 animate-pulse rounded bg-muted" />
</div>
</div>
{/* Delivery Overview Skeleton */}
<div className="rounded-2xl border border-border bg-card p-5 sm:p-6 space-y-5">
<div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
<div className="rounded-2xl border border-border bg-card p-5 sm:p-6 shadow-2xs space-y-5">
<div className="flex items-center justify-between gap-3">
<div className="space-y-1">
<div className="h-4 w-36 animate-pulse rounded bg-muted" />
<div className="h-3 w-48 animate-pulse rounded bg-muted" />
</div>
<div className="h-6 w-24 animate-pulse rounded-md bg-muted" />
<div className="h-7 w-20 animate-pulse rounded-lg bg-muted" />
</div>
<div className="h-2.5 w-full animate-pulse rounded-full bg-muted" />
<div className="h-2 w-full animate-pulse rounded-full bg-muted" />
<div className="grid grid-cols-2 gap-3 sm:grid-cols-4">
{Array.from({ length: 4 }).map((_, i) => (
<div key={i} className="rounded-xl border border-border/70 bg-muted/20 p-3.5 space-y-2">
<div className="h-3 w-16 animate-pulse rounded bg-muted" />
<div className="h-6 w-12 animate-pulse rounded bg-muted" />
<div key={i} className="h-24 animate-pulse rounded-xl border border-border/60 bg-muted/20 p-3.5 space-y-2">
<div className="h-3 w-16 rounded bg-muted" />
<div className="h-6 w-12 rounded bg-muted" />
</div>
))}
</div>
</div>
{/* Work Orders List Skeleton */}
<div className="space-y-4 pt-2">
<div className="flex items-center gap-2">
<div className="h-6 w-28 animate-pulse rounded-md bg-muted" />
<div className="h-5 w-8 animate-pulse rounded-md bg-muted" />
</div>
{/* Filter Skeleton */}
<div className="h-11 w-full animate-pulse rounded-xl border border-border bg-card" />
{/* Filter Bar Skeleton */}
<div className="h-10 w-full animate-pulse rounded-xl border border-border bg-card" />
{/* Work Order Cards */}
<div className="space-y-4">
{Array.from({ length: 2 }).map((_, i) => (
<div key={i} className="rounded-2xl border border-border/80 bg-card p-4 sm:p-6 space-y-4">
<div className="flex items-start justify-between gap-4">
<div className="flex items-start gap-4 flex-1">
<div className="h-11 w-11 shrink-0 animate-pulse rounded-xl bg-muted" />
<div className="space-y-2 flex-1">
<div className="flex items-center gap-2">
<div className="h-5 w-20 animate-pulse rounded-md bg-muted" />
<div className="h-5 w-16 animate-pulse rounded-md bg-muted" />
</div>
<div className="h-5 w-2/3 max-w-sm animate-pulse rounded bg-muted" />
<div className="h-3.5 w-full max-w-md animate-pulse rounded bg-muted" />
</div>
{/* Work Order Cards Skeleton */}
<div className="space-y-4">
{Array.from({ length: 2 }).map((_, i) => (
<div key={i} className="rounded-2xl border border-border bg-card p-4 sm:p-6 space-y-4">
<div className="flex items-start gap-4">
<div className="h-11 w-11 shrink-0 animate-pulse rounded-xl bg-muted" />
<div className="min-w-0 flex-1 space-y-2">
<div className="flex items-center gap-2">
<div className="h-5 w-24 animate-pulse rounded-md bg-muted" />
<div className="h-5 w-20 animate-pulse rounded-md bg-muted" />
</div>
<div className="h-8 w-28 shrink-0 animate-pulse rounded-md bg-muted" />
</div>
<div className="flex items-center justify-between border-t border-border/60 pt-3.5">
<div className="h-4 w-48 animate-pulse rounded bg-muted" />
<div className="h-6 w-24 animate-pulse rounded-full bg-muted" />
<div className="h-5 w-1/2 animate-pulse rounded bg-muted" />
<div className="h-4 w-3/4 animate-pulse rounded bg-muted" />
</div>
<div className="h-9 w-28 shrink-0 animate-pulse rounded-lg bg-muted" />
</div>
))}
</div>
<div className="flex items-center justify-between border-t border-border/60 pt-3">
<div className="h-4 w-48 animate-pulse rounded bg-muted" />
<div className="h-4 w-32 animate-pulse rounded bg-muted" />
</div>
</div>
))}
</div>
</div>
);
+25 -30
View File
@@ -3,48 +3,43 @@ export default function Loading() {
<div
className="flex-1 space-y-8 p-4 sm:p-8 pt-4 sm:pt-6"
role="status"
aria-label="Loading tasks and clients"
aria-label="Loading tasks"
>
{/* Top Page Header Skeleton */}
{/* Header: Title, Subtitle, and Controls */}
<div className="flex flex-col md:flex-row md:items-center justify-between gap-4">
<div>
<div className="h-8 w-56 animate-pulse rounded-lg bg-muted" />
<div className="mt-2 h-4 w-72 max-w-full animate-pulse rounded bg-muted" />
<div className="space-y-2">
<div className="h-8 w-56 sm:w-64 animate-pulse rounded-lg bg-muted" />
<div className="h-4 w-72 sm:w-96 animate-pulse rounded bg-muted" />
</div>
<div className="flex flex-col sm:flex-row items-stretch sm:items-center gap-2.5 sm:gap-3 w-full md:w-auto">
<div className="h-10 w-full sm:w-44 animate-pulse rounded-md bg-muted" />
<div className="h-10 w-full sm:w-32 animate-pulse rounded-md bg-muted" />
<div className="flex items-center gap-3">
<div className="h-10 w-36 sm:w-44 animate-pulse rounded-lg bg-muted" />
<div className="h-10 w-28 sm:w-32 animate-pulse rounded-lg bg-muted" />
</div>
</div>
{/* Filter and Layout Toolbar Skeleton */}
{/* Filter and Search Bar Skeleton */}
<div className="h-11 w-full animate-pulse rounded-xl border border-border bg-card" />
{/* Client Cards Grid Skeleton */}
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
{/* Content Cards Grid Skeleton */}
<div className="grid gap-4 sm:gap-6 md:grid-cols-2 lg:grid-cols-3">
{Array.from({ length: 6 }).map((_, i) => (
<div
key={i}
className="overflow-hidden rounded-xl border border-border/80 bg-card shadow-2xs"
>
{/* Image Banner Skeleton */}
<div className="h-40 border-b border-border/50 bg-muted/20 animate-pulse" />
{/* Card Content Skeleton */}
<div className="p-5 space-y-3">
<div className="flex items-center justify-between">
<div className="h-4 w-16 animate-pulse rounded bg-muted" />
<div className="h-4 w-14 animate-pulse rounded-full bg-muted" />
<div key={i} className="rounded-2xl border border-border bg-card p-5 space-y-4 shadow-2xs">
{/* Top: Avatar and Title */}
<div className="flex items-start gap-3.5">
<div className="h-12 w-12 shrink-0 animate-pulse rounded-xl bg-muted" />
<div className="min-w-0 flex-1 space-y-2">
<div className="h-5 w-3/4 animate-pulse rounded bg-muted" />
<div className="h-4 w-1/3 animate-pulse rounded bg-muted" />
</div>
</div>
<div className="h-5 w-44 animate-pulse rounded bg-muted" />
<div className="h-3.5 w-32 animate-pulse rounded bg-muted" />
{/* Mid preview strip */}
<div className="h-14 w-full animate-pulse rounded-xl border border-border/50 bg-muted/20" />
<div className="grid grid-cols-3 gap-2 border-t border-border/50 pt-3">
<div className="h-8 animate-pulse rounded bg-muted/20" />
<div className="h-8 animate-pulse rounded bg-muted/20" />
<div className="h-8 animate-pulse rounded bg-muted/20" />
</div>
{/* Bottom metrics row */}
<div className="flex items-center justify-between border-t border-border/60 pt-3">
<div className="h-4 w-28 animate-pulse rounded bg-muted" />
<div className="h-4 w-20 animate-pulse rounded bg-muted" />
</div>
</div>
))}