import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { Badge } from "@/components/ui/badge"; import { Monitor, Wifi, WifiOff } from "lucide-react"; import { cn } from "@/lib/utils"; export function ComputerCard({ device, position, }: { device: any | undefined; position: number; }) { if (!device) { return (
{position}
Trống
); } const isOffline = device.isOffline; const firstNetworkInfo = device.networkInfos?.[0]; const DeviceInfo = () => (
Thời gian thiết bị
{new Date(device.deviceTime).toLocaleDateString("vi-VN")}
{new Date(device.deviceTime).toLocaleTimeString("vi-VN")}
Phiên bản
v{device.version}
Phòng
{device.room}
{device.networkInfos?.length > 0 && (
Thông tin mạng
{device.networkInfos.map((info: any, idx: number) => (
MAC: {info.macAddress ?? "-"}
IP: {info.ipAddress ?? "-"}
))}
)}
Trạng thái
{isOffline ? : } {isOffline ? "Offline" : "Online"}
); return (
{position}
{firstNetworkInfo?.ipAddress && (
{firstNetworkInfo.ipAddress}
)}
{isOffline ? ( ) : ( )} {isOffline ? "Off" : "On"}
); }