MDK Logo

Card Hooks

Card component state and interaction hooks

Hooks for card component state management.

Package

@tetherto/mdk-react-devkit

Hooks

@tetherto/mdk-react-devkit

useCabinetDetail

Reads the selected LV cabinet from devicesStore, re-fetches its family of powermeters and temperature sensors by root (useCabinetDevices) at the realtime cadence, and shapes them into the read-only rows the CabinetDetailCard renders — powermeter readings (→ kW), the root plus per-position temperature readings (severity-coloured), and the active-warnings timeline folded from every device's last.alerts.

(onNavigate?: (path: string) => void) => UseCabinetDetailResult

useDeviceAlarms

Shapes the active alarms of the selected devices into timeline items for the Explorer detail panel, mirroring MOS's getContainerFormatedAlertsgetAlertTimelineItems chain: getAlarms reads each device's last.alerts, getLogFormattedAlertData formats each with the device's id/info/type and the timezone-aware date formatter, and getAlertTimelineItems wires the log/dot rows plus the onNavigate click-through to the alert detail route.

(devices?: Device[], onNavigate?: (path: string) => void) => UseDeviceAlarmsResult

useExplorerThingDetail

Explorer detail hook: fetches one thing by id (useThingDetail) and shapes it into display-ready rows for the Explorer detail panel. Reads the same snapshot fields the container table columns show (status, ambient temp, humidity, power → kW) so the panel and the row stay consistent. Returns a hasSelection: false result when no id is given.

(id: string | undefined, options?: UseThingDetailOptions) => UseExplorerThingDetailResult

On this page