import { Monitor, DoorOpen } from "lucide-react"; import { ComputerCard } from "./computer-card"; import { useMachineNumber } from "../hooks/useMachineNumber"; export function DeviceGrid({ devices }: { devices: any[] }) { const getMachineNumber = useMachineNumber(); const deviceMap = new Map(); devices.forEach((device) => { const number = getMachineNumber(device.id || ""); if (number > 0 && number <= 40) deviceMap.set(number, device); }); const totalRows = 5; const renderRow = (rowIndex: number) => { // Trái: 1–20 const leftStart = rowIndex * 4 + 1; // Phải: 21–40 const rightStart = 21 + rowIndex * 4; return (
{/* Bên trái (1–20) */} {Array.from({ length: 4 }).map((_, i) => { const pos = leftStart + i; return ( ); })} {/* Đường chia giữa */}
{/* Bên phải (21–40) */} {Array.from({ length: 4 }).map((_, i) => { const pos = rightStart + i; return ( ); })}
); }; return (
Bàn Giảng Viên
Cửa Ra Vào
{Array.from({ length: totalRows }).map((_, i) => renderRow(i))}
); }