From f3be72d1918910c11b362ebf9f8381bfb5f634f7 Mon Sep 17 00:00:00 2001 From: Frank Waalkens Date: Tue, 19 Sep 2023 12:16:44 +0200 Subject: [PATCH] Added todo --- .../components/boxes/DevicesOverview/DevicesOverview.tsx | 6 +++--- .../Marine2/components/boxes/GeneratorFp/GeneratorFp.tsx | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/Marine2/components/boxes/DevicesOverview/DevicesOverview.tsx b/src/app/Marine2/components/boxes/DevicesOverview/DevicesOverview.tsx index 89b22ba67..7744c661e 100644 --- a/src/app/Marine2/components/boxes/DevicesOverview/DevicesOverview.tsx +++ b/src/app/Marine2/components/boxes/DevicesOverview/DevicesOverview.tsx @@ -1,3 +1,5 @@ +import React, { useState } from "react" +import classNames from "classnames" import Box from "../../ui/Box" import DevicesIcon from "../../../images/icons/devices.svg" import { AppViews } from "../../../modules/AppViews" @@ -24,10 +26,8 @@ import { useVisibilityNotifier } from "../../../modules" import { AC_SOURCE, BoxTypes, RELAY_FUNCTION } from "../../../utils/constants" import { PageSelectorProps } from "../../ui/PageSelector" import GridPaginator from "../../ui/GridPaginator" -import React from "react" import GeneratorRelay from "../GeneratorRelay/GeneratorRelay" import { applyStyles, defaultBoxStyles } from "../../../utils/media" -import classNames from "classnames" import { ComponentMode } from "@m2Types/generic/component-mode" const DevicesOverview = ({ componentMode = "full", pageSelectorPropsSetter }: Props) => { @@ -36,7 +36,7 @@ const DevicesOverview = ({ componentMode = "full", pageSelectorPropsSetter }: Pr const { chargers } = useChargers() const generatorFp = useGeneratorFp() const generatorRelay = useGeneratorRelay() - const [compactBoxSize, setCompactBoxSize] = React.useState<{ width: number; height: number }>({ width: 0, height: 0 }) + const [compactBoxSize, setCompactBoxSize] = useState<{ width: number; height: number }>({ width: 0, height: 0 }) const boxes = getAvailableDeviceBoxes( chargers, diff --git a/src/app/Marine2/components/boxes/GeneratorFp/GeneratorFp.tsx b/src/app/Marine2/components/boxes/GeneratorFp/GeneratorFp.tsx index 66e1fd402..599689fe4 100644 --- a/src/app/Marine2/components/boxes/GeneratorFp/GeneratorFp.tsx +++ b/src/app/Marine2/components/boxes/GeneratorFp/GeneratorFp.tsx @@ -37,6 +37,8 @@ const GeneratorFp = ({ componentMode = "compact", generatorFp, compactBoxSize }: const title = productName || "Genset" const subTitle = !!statusCode || statusCode === 0 ? gensetStateFormatter(Number(statusCode)) : undefined const isAutoStartDisabled = gensetAutoStart === 0 + + // TODO refactor to totalPowerOf function for generic usage (single-source-of-truth). const powerSum = power.reduce((sum: number, b) => { return b ? sum + b : sum }, 0)