import type React from "react"; import { Badge, Heading, Link, majorScale, MapMarkerIcon, Pane, } from "evergreen-ui"; import { FiBluetooth, FiTerminal, FiWifi } from "react-icons/fi"; import { toMGRS } from "@app/core/utils/toMGRS.js"; import { useDevice } from "@core/providers/useDevice.js"; import { Hashicon } from "@emeraldpay/hashicon-react"; import { Types } from "@meshtastic/meshtasticjs"; export const DeviceCard = (): JSX.Element => { const { hardware, nodes, status, connection } = useDevice(); const myNode = nodes.find((n) => n.data.num === hardware.myNodeNum); return ( {myNode?.data.user?.longName} {hardware.firmwareVersion} {toMGRS( myNode?.data.position?.latitudeI, myNode?.data.position?.longitudeI )} {connection?.connType === "ble" && } {connection?.connType === "http" && } {connection?.connType === "serial" && } {[ Types.DeviceStatusEnum.DEVICE_CONNECTED, Types.DeviceStatusEnum.DEVICE_CONFIGURED, Types.DeviceStatusEnum.DEVICE_CONFIGURING, ].includes(status) ? "Connected" : [ Types.DeviceStatusEnum.DEVICE_CONNECTING, Types.DeviceStatusEnum.DEVICE_RECONNECTING, Types.DeviceStatusEnum.DEVICE_CONNECTED, ].includes(status) ? "Connecting" : "Disconnected"} ); };