Skip to content

Commit

Permalink
Improve charger icon
Browse files Browse the repository at this point in the history
  • Loading branch information
RicoSuter committed Nov 6, 2024
1 parent 3f1ff4c commit 268be01
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<div style="transform: scale(@(((Thing?.Scale * 100 - 20) / 80) ?? 1.0m)); transform-origin: top left; pointer-events: all">
<div>
<div style="margin-bottom: -20px; padding-left: 30px; text-align: center">
@(Thing?.Title.Length > 0 ? Thing?.Title + ": " : string.Empty)@((Thing?.VehicleCharger as IPowerConsumptionSensor)?.PowerConsumption is decimal powerConsumption ? $"{Math.Round(powerConsumption / 1000, 1)} kW" : "")
@Title
</div>
@if (Thing?.VehicleCharger?.IsPluggedIn == false)
@if (!IsPluggedIn)
{
<svg version="1.1"
width="160"
Expand Down Expand Up @@ -50,10 +50,11 @@
<g id="g1" />
<g id="g2"
style="fill:#000000;fill-opacity:1">
<path style="opacity:1;stroke-width:1.0627;fill:#000000;fill-opacity:1"
<path style="opacity:1;fill:#000000;fill-opacity:1;stroke-width:1.0627"
fill="#000000"
d="m 204.51203,53.930155 c 54.668,-0.188259 109.334,0 164,0.564666 53.329,-0.01265 90.329,27.655968 111,83.005849 -0.09,2.99498 0.576,5.62971 2,7.90532 1.296,5.15201 1.962,10.42259 2,15.81063 -0.155,10.77495 0.512,21.315 2,31.62128 -0.29,12.85631 0.043,25.65502 1,38.39726 0,140.79035 0,281.57956 0,422.3699 30.171,0.37381 60.171,-0.002 90,-1.12933 42.811,7.18142 78.644,-7.12269 107.5,-42.91459 12.124,-17.44817 18.291,-37.40006 18.5,-59.85456 0.829,-7.70316 1.329,-15.60848 1.5,-23.71595 0.5,-59.47736 0.667,-118.95472 0.5,-178.43434 -2.403,0.0587 -4.736,-0.31735 -7,-1.12934 -4.428,-0.33767 -8.761,-1.0898 -13,-2.25866 -3.005,-2.00682 -6.338,-3.13615 -10,-3.38799 -26.117,-10.47568 -45.617,-29.67431 -58.5,-57.5959 -4.453,-16.94335 -6.619,-34.25939 -6.5,-51.94924 0,-9.03465 0,-18.0693 0,-27.10395 0,-19.19863 0,-38.39726 0,-57.59589 13.333,0 26.667,0 40,0 0,-25.59822 0,-51.196314 0,-76.794527 10.313,-15.897709 23.98,-20.603294 41,-14.116641 5.316,2.42411 8.649,6.753288 10,12.98731 -0.09,2.995212 0.576,5.630281 2,7.905319 1.868,22.885334 2.535,45.848589 2,68.889209 17.826,1.12594 35.826,1.50201 54,1.12933 0,-18.0693 0,-36.1386 0,-54.207901 -0.747,-11.397324 1.42,-21.937712 6.5,-31.621276 1.925,-1.558929 3.759,-3.252926 5.5,-5.081991 17.246,-6.355876 31.413,-1.650292 42.5,14.116641 0.5,25.59539 0.667,51.193597 0.5,76.794527 13.333,0 26.667,0 40,0 -0.75,40.64689 -1.25,81.30282 -1.5,121.96778 -10.871,31.47333 -29.704,54.62462 -56.5,69.45387 -8.817,3.60934 -17.817,6.43267 -27,8.46998 -1.333,0 -2.667,0 -4,0 0,51.19598 0,102.39308 0,153.58906 0.712,30.76976 -1.455,61.2617 -6.5,91.47583 -6.143,19.52162 -14.143,37.96699 -24,55.33723 -13.651,18.43408 -29.151,34.43331 -46.5,47.99658 -13.508,8.09618 -27.508,14.87217 -42,20.32797 -10.902,2.33884 -21.902,3.65677 -33,3.95266 -41.979,1.85436 -83.979,2.60762 -126,2.25866 -0.998,36.32155 -1.332,72.83735 -1,109.54513 -130,0 -260,0 -389.999999,0 0,-181.82233 0,-363.64467 0,-545.467 -0.188,-42.16923 0.145,-84.33169 1,-126.48511 10.242999,-51.8537 37.909999,-85.733632 82.999999,-101.639811 8.457,-1.292971 16.79,-2.422303 25,-3.387994 z"
id="path2" />
d="m 204.51203,53.930155 c 54.668,-0.188259 109.334,0 164,0.564666 53.329,-0.01265 90.329,27.655968 111,83.005849 -0.09,2.99498 0.576,5.62971 2,7.90532 1.296,5.15201 1.962,10.42259 2,15.81063 -0.155,10.77495 0.512,21.315 2,31.62128 -0.29,12.85631 0.043,25.65502 1,38.39726 v 422.3699 c 30.171,0.37381 60.171,-0.002 90,-1.12933 42.811,7.18142 78.644,-7.12269 107.5,-42.91459 12.124,-17.44817 18.291,-37.40006 18.5,-59.85456 0.829,-7.70316 1.329,-15.60848 1.5,-23.71595 0.5,-59.47736 0.667,21.04528 0.5,-38.43434 -2.403,0.0587 -4.736,-0.31735 -7,-1.12934 -4.428,-0.33767 -8.761,-1.0898 -13,-2.25866 -3.005,-2.00682 -6.338,-3.13615 -10,-3.38799 -26.117,-10.47568 -45.617,-29.67431 -58.5,-57.5959 -4.453,-16.94335 -6.619,-34.25939 -6.5,-51.94924 v -27.10395 -57.59589 h 40 v -76.79453 c 10.313,-15.89771 23.98,-20.60329 41,-14.11664 5.316,2.42411 8.649,6.75329 10,12.98731 -0.09,2.99521 0.576,5.63028 2,7.90532 1.868,22.88533 2.535,45.84859 2,68.88921 17.826,1.12594 35.826,1.50201 54,1.12933 v -54.2079 c -0.747,-11.39733 1.42,-21.93771 6.5,-31.62128 1.925,-1.55893 3.759,-3.25292 5.5,-5.08199 17.246,-6.35587 31.413,-1.65029 42.5,14.11664 0.5,25.59539 0.667,51.1936 0.5,76.79453 h 40 c -0.75,40.64689 -1.25,81.30282 -1.5,121.96778 -10.871,31.47333 -29.704,54.62462 -56.5,69.45387 -8.817,3.60934 -17.817,6.43267 -27,8.46998 h -4 v 13.58906 c 0.712,30.76976 -1.455,61.2617 -6.5,91.47583 -6.143,19.52162 -14.143,37.96699 -24,55.33723 -13.651,18.43408 -29.151,34.43331 -46.5,47.99658 -13.508,8.09618 -27.508,14.87217 -42,20.32797 -10.902,2.33884 -21.902,3.65677 -33,3.95266 -41.979,1.85436 -83.979,2.60762 -126,2.25866 -0.998,36.32155 -1.332,72.83735 -1,109.54513 H 95.512031 v -545.467 c -0.188,-42.16923 0.145,-84.33169 1,-126.48511 10.242999,-51.8537 37.909999,-85.733632 82.999999,-101.639811 8.457,-1.292971 16.79,-2.422303 25,-3.387994 z"
id="path2"
sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccccccccccccccc" />
</g>
<g id="g5"
transform="matrix(1,0,0,1.1293313,-4.9879695,8.1922385)">
Expand Down Expand Up @@ -88,7 +89,7 @@
</g>
</svg>
}
else if (Thing?.VehicleCharger?.IsPluggedIn == true)
else
{
<svg version="1.1"
width="160"
Expand Down Expand Up @@ -123,7 +124,7 @@
<g id="g2"
style="fill-opacity:1">
<path style="opacity:1;fill-opacity:1;stroke-width:1.0627"
fill="@(Thing?.VehicleCharger?.IsCharging == true ? "#D8BB21" : "#000000")"
fill="@(IsCharging ? "#D8BB21" : "#000000")"
d="m 204.51203,53.930155 c 54.668,-0.188259 109.334,0 164,0.564666 53.329,-0.01265 90.329,27.655968 111,83.005849 -0.09,2.99498 0.576,5.62971 2,7.90532 1.296,5.15201 1.962,10.42259 2,15.81063 -0.155,10.77495 0.512,21.315 2,31.62128 -0.29,12.85631 0.043,25.65502 1,38.39726 v 402.3699 c -0.89227,14.13217 26.1573,87.38956 85.87974,79.59432 52.24669,-6.81948 57.59922,-30.68743 76.2943,-109.69621 9.72766,-41.11084 9.66738,-40.00667 14.95733,-69.6014 0.79993,-4.4752 4.47639,-6.86528 9.5979,-7.97615 16.75166,-3.63349 48.96296,6.41863 46.541,1.95551 l 13.66216,120.12379 c -19.72464,0.87131 -14.63787,-41.62328 -62.31208,35.47437 -71.38018,115.43441 -167.33169,47.21525 -184.62035,37.88565 -0.998,36.32155 -1.332,72.83735 -1,109.54513 H 95.512031 v -545.467 c -0.188,-42.16923 0.145,-84.33169 1,-126.48511 10.242999,-51.8537 37.909999,-85.733632 82.999999,-101.639811 8.457,-1.292971 16.79,-2.422303 25,-3.387994 z"
id="path2"
sodipodi:nodetypes="ccccccccssssccsccccccc" />
Expand All @@ -134,7 +135,7 @@
transform="matrix(1,0,0,1.1293313,-4.9879695,8.1922385)"
style="fill-opacity:1">
<path style="opacity:1;fill-opacity:1"
fill="@(Thing?.VehicleCharger?.IsCharging == true ? "#000000" : "#FFFFFF")"
fill="@(IsCharging ? "#000000" : "#FFFFFF")"
d="m 344.5,107.5 c 23.203,2.032 37.703,14.366 43.5,37 3.668,24.022 -3.832,43.522 -22.5,58.5 -5.947,3.485 -12.281,5.652 -19,6.5 -30.002,0.167 -60.002,0 -90,-0.5 -4.37,-0.737 -8.704,-1.57 -13,-2.5 -12.481,-5.813 -21.147,-15.147 -26,-28 -0.629,-2.897 -1.629,-5.564 -3,-8 -5.483,-26.852 3.517,-47.019 27,-60.5 1.936,-0.813 3.936,-1.313 6,-1.5 32.319,-0.94 64.652,-1.273 97,-1 z"
id="path6" />
</g>
Expand All @@ -156,7 +157,7 @@
transform="matrix(1,0,0,1.1293313,-4.9879695,8.1922385)"
style="fill-opacity:1">
<path style="opacity:1;fill-opacity:1"
fill="@(Thing?.VehicleCharger?.IsCharging == true ? "#000000" : "#FFFFFF")"
fill="@(IsCharging ? "#000000" : "#FFFFFF")"
d="m 298.5,437.5 c 32.998,1.088 65.998,2.088 99,3 -53.087,59.509 -107.087,118.175 -162,176 -0.454,-1.759 -0.454,-3.759 0,-6 18.691,-46.896 37.691,-93.729 57,-140.5 -0.336,-1.03 -1.003,-1.53 -2,-1.5 -4.769,-1.389 -9.769,-2.056 -15,-2 -16.691,-0.279 -33.358,-1.113 -50,-2.5 -1.68,-0.347 -2.68,-1.347 -3,-3 16.62,-48.99 33.62,-97.823 51,-146.5 36.341,-1.28 72.674,-1.28 109,0 -0.94,3.214 -2.44,6.214 -4.5,9 -26.756,37.854 -53.256,75.854 -79.5,114 z"
id="path19" />
</g>
Expand Down Expand Up @@ -282,15 +283,21 @@
</g>
</svg>
}
else
{
<span>n/a</span>
}
</div>
</div>
</div>

@code {
public bool IsPluggedIn => Thing?.VehicleCharger?.IsPluggedIn == true;

public bool IsCharging => Thing?.VehicleCharger?.IsCharging == true;

public string Title =>
!IsPluggedIn ? Thing?.Title ?? "" :
((Thing?.Title.Length > 0 ? Thing?.Title + ": " : string.Empty) +
((Thing?.VehicleCharger as IPowerConsumptionSensor)?.PowerConsumption is decimal powerConsumption ?
$"{Math.Round(powerConsumption / 1000, 1)} kW" : "0 kW"));

[Parameter]
public VehicleChargerWidget? Thing { get; set; }

Expand Down
9 changes: 5 additions & 4 deletions src/HomeBlaze.Widgets/VehicleCharger/notpluggedin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 268be01

Please sign in to comment.