From 57aa1a4180f26c6566c70c7b3e8d568fc1ed4e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20F=C3=A9lix?= Date: Mon, 15 Jan 2024 00:33:00 +0100 Subject: [PATCH] feat: :sparkles: disable dots --- src/components/flows/batteryGrid.ts | 3 ++- src/components/flows/batteryToHome.ts | 3 ++- src/components/flows/gridToHome.ts | 3 ++- src/components/flows/solarToBattery.ts | 3 ++- src/components/flows/solarToGrid.ts | 3 ++- src/components/flows/solarToHome.ts | 3 ++- src/components/individualLeftBottomElement.ts | 3 ++- src/components/individualLeftTopElement.ts | 3 ++- src/components/individualRightBottomElement.ts | 3 ++- src/components/individualRightTopElement.ts | 3 ++- src/components/nonFossil.ts | 3 ++- src/localize/languages/cs.json | 3 ++- src/localize/languages/de.json | 1 + src/localize/languages/dk.json | 1 + src/localize/languages/en.json | 1 + src/localize/languages/es.json | 1 + src/localize/languages/fi.json | 1 + src/localize/languages/fr.json | 1 + src/localize/languages/it.json | 1 + src/localize/languages/nl.json | 1 + src/localize/languages/pl.json | 1 + src/localize/languages/pt-BR.json | 1 + src/localize/languages/pt-PT.json | 1 + src/localize/languages/ru.json | 1 + src/localize/languages/sk.json | 1 + src/power-flow-card-plus-config.ts | 1 + src/ui-editor/schema/_schema-all.ts | 8 ++++++-- src/utils/checkShouldShowDots.ts | 5 +++++ 28 files changed, 49 insertions(+), 14 deletions(-) create mode 100644 src/utils/checkShouldShowDots.ts diff --git a/src/components/flows/batteryGrid.ts b/src/components/flows/batteryGrid.ts index 918d5b7..d669bae 100644 --- a/src/components/flows/batteryGrid.ts +++ b/src/components/flows/batteryGrid.ts @@ -5,6 +5,7 @@ import { html, svg } from "lit"; import { styleLine } from "../../utils/styleLine"; import { type Flows } from "./index"; import { checkHasRightIndividual } from "../../utils/computeIndividualPosition"; +import { checkShouldShowDots } from "../../utils/checkShouldShowDots"; type FlowBatteryGridFlows = Pick>; @@ -24,7 +25,7 @@ export const flowBatteryGrid = (config: PowerFlowCardPlusConfig, { battery, grid d="M45,100 v-15 c0,-30 -10,-30 -30,-30 h-20" vector-effect="non-scaling-stroke" > - ${grid.state.toBattery + ${checkShouldShowDots(config) && grid.state.toBattery ? svg`>; @@ -24,7 +25,7 @@ export const flowBatteryToHome = (config: PowerFlowCardPlusConfig, { battery, gr d="M55,100 v-${grid.has ? 15 : 17} c0,-30 10,-30 30,-30 h20" vector-effect="non-scaling-stroke" > - ${battery.state.toHome + ${checkShouldShowDots(config) && battery.state.toHome ? svg` { return grid.has && showLine(config, grid.state.fromGrid) @@ -22,7 +23,7 @@ export const flowGridToHome = (config: PowerFlowCardPlusConfig, { battery, grid, d="M0,${battery.has ? 50 : solar.has ? 56 : 53} H100" vector-effect="non-scaling-stroke" > - ${grid.state.toHome + ${checkShouldShowDots(config) && grid.state.toHome ? svg`>; @@ -24,7 +25,7 @@ export const flowSolarToBattery = (config: PowerFlowCardPlusConfig, { battery, i d="M50,0 V100" vector-effect="non-scaling-stroke" > - ${solar.state.toBattery + ${checkShouldShowDots(config) && solar.state.toBattery ? svg` { return grid.hasReturnToGrid && solar.has && showLine(config, solar.state.toGrid || 0) @@ -22,7 +23,7 @@ export const flowSolarToGrid = (config: PowerFlowCardPlusConfig, { battery, grid d="M${battery.has ? 45 : 47},0 v15 c0,${battery.has ? "30 -10,30 -30,30" : "35 -10,35 -30,35"} h-20" vector-effect="non-scaling-stroke" > - ${solar.state.toGrid && solar.has + ${checkShouldShowDots(config) && solar.state.toGrid && solar.has ? svg` { return solar.has && showLine(config, solar.state.toHome || 0) @@ -22,7 +23,7 @@ export const flowSolarToHome = (config: PowerFlowCardPlusConfig, { battery, grid d="M${battery.has ? 55 : 53},0 v${grid.has ? 15 : 17} c0,${battery.has ? "30 10,30 30,30" : "35 10,35 30,35"} h25" vector-effect="non-scaling-stroke" > - ${solar.state.toHome + ${checkShouldShowDots(config) && solar.state.toHome ? svg` - ${individualObj?.state + ${checkShouldShowDots(config) && individualObj?.state ? svg` - ${individualObj.state + ${checkShouldShowDots(config) && individualObj.state ? svg` - ${individualObj.state + ${checkShouldShowDots(config) && individualObj.state ? svg` - ${individualObj.state + ${checkShouldShowDots(config) && individualObj.state ? svg` - ${nonFossil.has + ${checkShouldShowDots(config) && nonFossil.has ? svg` { + return config.disable_dots !== true; +};