"use client"; import { useEffect, Suspense } from "react"; import { useRouter } from "next/navigation"; import Dashboard from "@/components/dashboard/dashboard"; import { Package } from "lucide-react"; import dynamic from "next/dynamic"; import { Skeleton } from "@/components/ui/skeleton"; import { Card, CardContent, CardHeader } from "@/components/ui/card"; // Lazy load the OrderTable component const OrderTable = dynamic(() => import("@/components/tables/order-table"), { loading: () => }); // Loading skeleton for the order table function OrderTableSkeleton() { return ( {/* Table header skeleton */} {['Order ID', 'Customer', 'Status', 'Total', 'Date', 'Actions'].map((header, i) => ( ))} {/* Table rows skeleton */} {[...Array(8)].map((_, i) => ( ))} ); } export default function OrdersPage() { const router = useRouter(); useEffect(() => { const authToken = document.cookie .split("; ") .find((row) => row.startsWith("Authorization=")) ?.split("=")[1]; if (!authToken) { router.push("/login"); } }, [router]); return ( Orders }> ); }