"use client" import { Card } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Smartphone, Battery, Users, MessageCircle, Clock } from "lucide-react" import { Checkbox } from "@/components/ui/checkbox" import { ImeiDisplay } from "@/components/ImeiDisplay" export interface Device { id: string imei: string name: string remark: string status: "online" | "offline" battery: number wechatId: string friendCount: number todayAdded: number messageCount: number lastActive: string addFriendStatus: "normal" | "abnormal" } interface DeviceGridProps { devices: Device[] selectable?: boolean selectedDevices?: string[] onSelect?: (deviceIds: string[]) => void deviceStatuses?: Record } export function DeviceGrid({ devices, selectable, selectedDevices, onSelect, deviceStatuses }: DeviceGridProps) { return (
{devices.map((device) => { const currentStatus = deviceStatuses?.[device.id] || device return ( {selectable && (
{ if (checked) { onSelect?.([...(selectedDevices ?? []), device.id]) } else { onSelect?.(selectedDevices?.filter((id) => id !== device.id) ?? []) } }} />
)}
{currentStatus.status === "online" ? "在线" : "离线"}
{currentStatus.battery}%
{device.name}
IMEI:
{device.remark &&
备注: {device.remark}
}
{device.friendCount}
{device.messageCount}
微信号:{device.wechatId}
今日添加:{device.todayAdded}
加友状态: {device.addFriendStatus === "normal" ? "正常" : "异常"}
) })}
) }