chore: add skeletons to tables and loading.tsx files for routes and run formatting ♻️
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 12m20s

This commit is contained in:
2025-09-20 20:42:14 +05:00
parent 5277c13fb7
commit a60e9a9c85
45 changed files with 3539 additions and 3041 deletions

View File

@@ -0,0 +1,66 @@
import { Skeleton } from "@/components/ui/skeleton";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { cn } from "@/lib/utils";
type TableSkeletonProps = {
headers: string[];
length: number;
};
export default function TableSkeleton({ headers, length }: TableSkeletonProps) {
return (
<>
<div className="hidden sm:block w-full">
<Table className="overflow-scroll w-full">
<TableHeader>
<TableRow>
{headers.map((header, index) => (
<TableHead key={`${index + 1}`}>{header}</TableHead>
))}
</TableRow>
</TableHeader>
<TableBody className="overflow-scroll">
{Array.from({ length }).map((_, i) => (
<TableRow key={`${i + 1}`}>
{headers.map((_, index) => (
<TableCell key={`${index + 1}`}>
<Skeleton className="w-full h-10 rounded" />
</TableCell>
))}
</TableRow>
))}
</TableBody>
</Table>
</div>
<div className="sm:hidden my-4 w-full">
{Array.from({ length }).map((_, i) => (
<DeviceCardSkeleton key={`${i + 1}`} />
))}
</div>
</>
);
}
function DeviceCardSkeleton() {
return (
<div
className={cn(
"flex text-sm justify-between items-center my-2 p-4 border rounded-md w-full",
)}
>
<div className="font-semibold flex w-full flex-col items-start gap-2 mb-2 relative">
<Skeleton className="w-32 h-6" />
<Skeleton className="w-36 h-6" />
<Skeleton className="w-32 h-4" />
<Skeleton className="w-40 h-8" />
</div>
</div>
);
}