@@ -3,13 +3,6 @@ import { useMqttStore } from 'src/stores/mqtt-store';
33import { ref , computed , watch } from ' vue' ;
44import type { SvgSize , FlowComponent } from ' ./energy-flow-chart-models' ;
55import type { ValueObject } from ' src/stores/mqtt-store-model' ;
6- // SVG Icons
7- import GridIcon from ' src/components/svgIcons/GridIcon.vue' ;
8- import HouseIcon from ' src/components/svgIcons/HouseIcon.vue' ;
9- import PvIcon from ' src/components/svgIcons/PvIcon.vue' ;
10- import BatteryIcon from ' src/components/svgIcons/BatteryIcon.vue' ;
11- import ChargePointIcon from ' src/components/svgIcons/ChargePointIcon.vue' ;
12- import VehicleIcon from ' src/components/svgIcons/VehicleIcon.vue' ;
136
147const mqttStore = useMqttStore ();
158
@@ -341,7 +334,7 @@ const svgComponents = computed((): FlowComponent[] => {
341334 position: { row: 0 , column: 0 },
342335 label: [' EVU' , absoluteValueObject (gridPower .value ).textValue ],
343336 powerValue: Number (gridPower .value .value ),
344- iconComponent: GridIcon ,
337+ iconName: ' grid ' ,
345338 iconColor:
346339 mqttStore .getGridComponentColor (gridID .value ) ||
347340 ' var(--q-diagram-icon)' ,
@@ -360,7 +353,7 @@ const svgComponents = computed((): FlowComponent[] => {
360353 position: { row: 0 , column: 2 },
361354 label: [' Haus' , absoluteValueObject (homePower .value ).textValue ],
362355 powerValue: Number (homePower .value .value ),
363- iconComponent: HouseIcon ,
356+ iconName: ' house ' ,
364357 iconColor: ' var(--q-diagram-icon)' ,
365358 });
366359 }
@@ -377,7 +370,7 @@ const svgComponents = computed((): FlowComponent[] => {
377370 position: { row: 1 , column: 0 },
378371 label: [' PV' , absoluteValueObject (pvPower .value ).textValue ],
379372 powerValue: Number (pvPower .value .value ),
380- iconComponent: PvIcon ,
373+ iconName: ' pv ' ,
381374 iconColor:
382375 mqttStore .getPvComponentColor (pvId .value ) || ' var(--q-diagram-icon)' ,
383376 });
@@ -396,7 +389,7 @@ const svgComponents = computed((): FlowComponent[] => {
396389 label: [' Speicher' , absoluteValueObject (batteryPower .value ).textValue ],
397390 powerValue: Number (batteryPower .value .value ),
398391 soc: batterySoc .value ,
399- iconComponent: BatteryIcon ,
392+ iconName: ' battery ' ,
400393 iconColor: ' var(--q-diagram-icon)' ,
401394 });
402395 }
@@ -422,7 +415,7 @@ const svgComponents = computed((): FlowComponent[] => {
422415 absoluteValueObject (chargePoint1Power .value ).textValue ,
423416 ],
424417 powerValue: Number (chargePoint1Power .value .value ),
425- iconComponent: ChargePointIcon ,
418+ iconName: ' chargepoint ' ,
426419 iconColor:
427420 mqttStore .chargePointUserDefinedColor (
428421 connectedChargePoints .value [0 ],
@@ -450,7 +443,7 @@ const svgComponents = computed((): FlowComponent[] => {
450443 chargePoint1ConnectedVehicleChargeMode .value .label || ' ---' ,
451444 ],
452445 soc: (chargePoint1ConnectedVehicleSoc .value .value ?.soc || 0 ) / 100 ,
453- iconComponent: VehicleIcon ,
446+ iconName: ' vehicle ' ,
454447 iconColor:
455448 mqttStore .vehicleUserDefinedColor (
456449 chargePoint1ConnectedVehicle .value ?.id ,
@@ -479,7 +472,7 @@ const svgComponents = computed((): FlowComponent[] => {
479472 absoluteValueObject (chargePoint2Power .value ).textValue ,
480473 ],
481474 powerValue: Number (chargePoint2Power .value .value ),
482- iconComponent: ChargePointIcon ,
475+ iconName: ' chargepoint ' ,
483476 iconColor:
484477 mqttStore .chargePointUserDefinedColor (
485478 connectedChargePoints .value [1 ],
@@ -508,7 +501,7 @@ const svgComponents = computed((): FlowComponent[] => {
508501 chargePoint2ConnectedVehicleChargeMode .value .label || ' ---' ,
509502 ],
510503 soc: (chargePoint2ConnectedVehicleSoc .value .value ?.soc || 0 ) / 100 ,
511- iconComponent: VehicleIcon ,
504+ iconName: ' vehicle ' ,
512505 iconColor:
513506 mqttStore .vehicleUserDefinedColor (
514507 chargePoint2ConnectedVehicle .value ?.id ,
@@ -534,7 +527,7 @@ const svgComponents = computed((): FlowComponent[] => {
534527 absoluteValueObject (chargePoint3Power .value ).textValue ,
535528 ],
536529 powerValue: Number (chargePoint3Power .value .value ),
537- iconComponent: ChargePointIcon ,
530+ iconName: ' chargepoint ' ,
538531 iconColor:
539532 mqttStore .chargePointUserDefinedColor (
540533 connectedChargePoints .value [2 ],
@@ -563,7 +556,7 @@ const svgComponents = computed((): FlowComponent[] => {
563556 chargePoint3ConnectedVehicleChargeMode .value .label || ' ---' ,
564557 ],
565558 soc: (chargePoint3ConnectedVehicleSoc .value .value ?.soc || 0 ) / 100 ,
566- iconComponent: VehicleIcon ,
559+ iconName: ' vehicle ' ,
567560 iconColor:
568561 mqttStore .vehicleUserDefinedColor (
569562 chargePoint3ConnectedVehicle .value ?.id ,
@@ -588,7 +581,7 @@ const svgComponents = computed((): FlowComponent[] => {
588581 absoluteValueObject (chargePointSumPower .value ).textValue ,
589582 ],
590583 powerValue: Number (chargePointSumPower .value .value ),
591- iconComponent: ChargePointIcon ,
584+ iconName: ' chargepoint ' ,
592585 iconColor: ' var(--q-diagram-icon)' ,
593586 });
594587 }
@@ -819,19 +812,15 @@ const svgRectWidth = computed(
819812 :clip-path =" `url(#clip-soc-${component.id})`"
820813 />
821814
822- <foreignObject
815+ <use
816+ v-if =" component.iconName"
817+ :href =" `#icon-${component.iconName}`"
823818 :x =" -svgIconWidth / 2"
824819 :y =" -svgIconHeight / 2"
825820 :width =" svgIconWidth"
826821 :height =" svgIconHeight"
827- >
828- <div class =" icon-wrapper" :style =" { color: component.iconColor }" >
829- <component
830- :is =" component.iconComponent"
831- style =" width : 100% ; height : 100% "
832- />
833- </div >
834- </foreignObject >
822+ :style =" { color: component.iconColor }"
823+ />
835824 </g >
836825 </g >
837826 </g >
@@ -987,18 +976,6 @@ rect {
987976 fill : var (--q-secondary );
988977}
989978
990- :root {
991- image {
992- filter : brightness (0.4 ); /* Creates a dark grey icons in light theme */
993- }
994- }
995-
996- .body--dark {
997- image {
998- filter : brightness (1 ); /* white icons in dark theme */
999- }
1000- }
1001-
1002979text {
1003980 font-size : v-bind(svgFontSize);
1004981 line-height : 1.25 ;
@@ -1108,11 +1085,8 @@ text .fill-dark {
11081085.vehicle circle :not (.soc ) {
11091086 fill : color-mix(in srgb , var (--q-accent ) 50% , transparent );
11101087}
1111- .icon-wrapper {
1112- width : 100% ;
1113- height : 100% ;
1114- display : flex ;
1115- align-items : center ;
1116- justify-content : center ;
1088+
1089+ use {
1090+ fill : currentColor ;
11171091}
11181092 </style >
0 commit comments