import { Cpu, MemoryStick, Star, WifiOff } from "lucide-react"; import type { CSSProperties } from "react"; import { Link } from "react-router-dom"; import type { Device } from "../api/types"; import { colorToHex, formatDate } from "../lib/utils"; import { Badge } from "./ui"; interface DeviceCardProps { device: Device; list?: boolean; moduleLabel?: string; } export function DeviceCard({ device, list = false, moduleLabel }: DeviceCardProps) { const color = colorToHex(device.state.colors?.[0]); const Icon = device.device_type === "dram" ? MemoryStick : Cpu; return

{moduleLabel || device.alias || device.name}

{[device.vendor, device.model].filter(Boolean).join(" · ") || device.source}

{device.favorite ? : null}
{device.online ? "Online" : <> Offline}{device.room_name ? {device.room_name} : null}{device.read_only ? Alleen lezen : null}{device.blocked ? Geblokkeerd : null}
{!list ?
{device.state.mode ?? "Onbekende modus"}{device.led_count} leds
:
{device.state.brightness ?? "—"}%{formatDate(device.last_detected_at)}
}
; }