From 09072f0ec03901b989894f72d4f84f1b8ee52362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20F=C3=A9lix?= Date: Mon, 15 Jan 2024 10:06:02 +0100 Subject: [PATCH] fix: :bug: lines not connecting when no battery connected --- src/components/flows/batteryGrid.ts | 4 ++-- src/components/flows/batteryToHome.ts | 4 ++-- src/components/flows/gridToHome.ts | 4 ++-- src/components/flows/solarToBattery.ts | 4 ++-- src/components/flows/solarToGrid.ts | 4 ++-- src/utils/computeIndividualPosition.ts | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/flows/batteryGrid.ts b/src/components/flows/batteryGrid.ts index 918d5b7..cd21990 100644 --- a/src/components/flows/batteryGrid.ts +++ b/src/components/flows/batteryGrid.ts @@ -4,7 +4,7 @@ import { showLine } from "../../utils/showLine"; import { html, svg } from "lit"; import { styleLine } from "../../utils/styleLine"; import { type Flows } from "./index"; -import { checkHasRightIndividual } from "../../utils/computeIndividualPosition"; +import { checkHasBottomIndividual, checkHasRightIndividual } from "../../utils/computeIndividualPosition"; type FlowBatteryGridFlows = Pick>; @@ -12,7 +12,7 @@ export const flowBatteryGrid = (config: PowerFlowCardPlusConfig, { battery, grid return grid.has && battery.has && showLine(config, Math.max(grid.state.toBattery || 0, battery.state.toGrid || 0)) ? html`
i?.has), "multi-individual": checkHasRightIndividual(config, individual), })}" diff --git a/src/components/flows/batteryToHome.ts b/src/components/flows/batteryToHome.ts index fd666aa..6faef48 100644 --- a/src/components/flows/batteryToHome.ts +++ b/src/components/flows/batteryToHome.ts @@ -4,7 +4,7 @@ import { showLine } from "../../utils/showLine"; import { html, svg } from "lit"; import { styleLine } from "../../utils/styleLine"; import { type Flows } from "./index"; -import { checkHasRightIndividual } from "../../utils/computeIndividualPosition"; +import { checkHasBottomIndividual, checkHasRightIndividual } from "../../utils/computeIndividualPosition"; type FlowBatteryToHomeFlows = Pick>; @@ -12,7 +12,7 @@ export const flowBatteryToHome = (config: PowerFlowCardPlusConfig, { battery, gr return battery.has && showLine(config, battery.state.toHome) ? html`
i?.has), "multi-individual": checkHasRightIndividual(config, individual), })}" diff --git a/src/components/flows/gridToHome.ts b/src/components/flows/gridToHome.ts index 122555b..99a9649 100644 --- a/src/components/flows/gridToHome.ts +++ b/src/components/flows/gridToHome.ts @@ -4,13 +4,13 @@ import { showLine } from "../../utils/showLine"; import { html, svg } from "lit"; import { styleLine } from "../../utils/styleLine"; import { type Flows } from "./index"; -import { checkHasRightIndividual } from "../../utils/computeIndividualPosition"; +import { checkHasBottomIndividual, checkHasRightIndividual } from "../../utils/computeIndividualPosition"; export const flowGridToHome = (config: PowerFlowCardPlusConfig, { battery, grid, individual, solar, newDur }: Flows) => { return grid.has && showLine(config, grid.state.fromGrid) ? html`
i?.has), "multi-individual": checkHasRightIndividual(config, individual), })}" diff --git a/src/components/flows/solarToBattery.ts b/src/components/flows/solarToBattery.ts index 4a421dd..f236d70 100644 --- a/src/components/flows/solarToBattery.ts +++ b/src/components/flows/solarToBattery.ts @@ -4,7 +4,7 @@ import { showLine } from "../../utils/showLine"; import { html, svg } from "lit"; import { styleLine } from "../../utils/styleLine"; import { type Flows } from "./index"; -import { checkHasRightIndividual } from "../../utils/computeIndividualPosition"; +import { checkHasBottomIndividual, checkHasRightIndividual } from "../../utils/computeIndividualPosition"; type FlowSolarToBatteryFlows = Pick>; @@ -12,7 +12,7 @@ export const flowSolarToBattery = (config: PowerFlowCardPlusConfig, { battery, i return battery.has && solar.has && showLine(config, solar.state.toBattery || 0) ? html`
i?.has), "multi-individual": checkHasRightIndividual(config, individual), })}" diff --git a/src/components/flows/solarToGrid.ts b/src/components/flows/solarToGrid.ts index 60b1784..68cdb44 100644 --- a/src/components/flows/solarToGrid.ts +++ b/src/components/flows/solarToGrid.ts @@ -4,13 +4,13 @@ import { showLine } from "../../utils/showLine"; import { html, svg } from "lit"; import { styleLine } from "../../utils/styleLine"; import { type Flows } from "./index"; -import { checkHasRightIndividual } from "../../utils/computeIndividualPosition"; +import { checkHasBottomIndividual, checkHasRightIndividual } from "../../utils/computeIndividualPosition"; export const flowSolarToGrid = (config: PowerFlowCardPlusConfig, { battery, grid, individual, solar, newDur }: Flows) => { return grid.hasReturnToGrid && solar.has && showLine(config, solar.state.toGrid || 0) ? html`
i?.has), "multi-individual": checkHasRightIndividual(config, individual), })}" diff --git a/src/utils/computeIndividualPosition.ts b/src/utils/computeIndividualPosition.ts index 1106752..650cc72 100644 --- a/src/utils/computeIndividualPosition.ts +++ b/src/utils/computeIndividualPosition.ts @@ -60,4 +60,4 @@ export const checkHasRightIndividual = (config: PowerFlowCardPlusConfig, individ !!getTopRightIndividual(config, individualObjs) || !!getBottomRightIndividual(config, individualObjs); export const checkHasBottomIndividual = (config: PowerFlowCardPlusConfig, individualObjs: IndividualObject[]): boolean => - !!getBottomLeftIndividual(config, individualObjs) || !!getBottomRightIndividual(config, individualObjs); + !!getBottomLeftIndividual(config, individualObjs) || !!getBottomRightIndividual(config, individualObjs); \ No newline at end of file