import { LstCard } from "@/components/extendedUI/LstCard"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Skeleton } from "@/components/ui/skeleton"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table"; import { getPrinters } from "@/utils/querys/production/printers"; import { useQuery } from "@tanstack/react-query"; let printerCols = [ { key: "printer", label: "Printer", }, { key: "statusMessage", label: "Status Message", }, ]; export default function PrinterStatus() { const { data, isError, isLoading } = useQuery(getPrinters()); if (isError) { return ( Printer Staus error {printerCols.map((l) => ( {l.label} ))} {Array(5) .fill(0) .map((_, i) => ( ))} ); } /** * only show the assigned printers */ const assigned = data?.filter((a: any) => a.assigned) || []; return ( {isLoading ? ( Printers status loading... ) : ( Printer Status )} {printerCols.map((l) => ( {l.label} ))} {" "} {isLoading ? ( {Array(5) .fill(0) .map((_, i) => ( ))} ) : ( {assigned?.map((p: any) => ( {p.name} {p.statusText} ))} )} ); }
Printer Staus error
{isLoading ? ( Printers status loading... ) : ( Printer Status )}