Implement climate charts workspace and detached chart windows

This commit is contained in:
litoral05
2026-05-28 10:08:10 +01:00
parent 65b419c5ca
commit 289a54f455
12 changed files with 1947 additions and 276 deletions
@@ -0,0 +1,37 @@
import { useMemo } from "react";
import type { ChartVariable } from "../../telemetry/types/telemetryCatalog";
import { useClimateHistory } from "./useClimateHistory";
export function useClimateChartCatalog() {
const climate = useClimateHistory();
const chartableVariables = useMemo<ChartVariable[]>(
() =>
climate.sensors.map((sensor) => ({
sensorId: sensor.sensorId,
key: sensor.key,
label: sensor.name,
value:
typeof sensor.value === "number" ||
typeof sensor.value === "string" ||
typeof sensor.value === "boolean" ||
sensor.value === null
? sensor.value
: null,
unit: sensor.unit ?? "",
timestamp: sensor.timestamp,
category: "Clima",
group: "Climate",
chartable: true,
})),
[climate.sensors],
);
return {
chartableVariables,
connected: climate.connected,
loading: !climate.module,
sensorCount: climate.sensorCount,
lastTimestamp: climate.lastTimestamp,
};
}