Skip to content

Commit

Permalink
feat: 🎨 hide icons
Browse files Browse the repository at this point in the history
  • Loading branch information
flixlix committed Apr 21, 2024
1 parent 91d9494 commit fc96c39
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 19 deletions.
25 changes: 14 additions & 11 deletions src/components/battery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,20 @@ export const batteryElement = (
})}
</span>`
: null}
<ha-icon
.icon=${battery.icon}
@click=${(e: { stopPropagation: () => void }) => {
main.openDetails(e, entities.battery?.state_of_charge!);
}}
@keyDown=${(e: { key: string; stopPropagation: () => void }) => {
if (e.key === "Enter") {
main.openDetails(e, entities.battery?.state_of_charge!);
}
}}
></ha-icon>
${battery.icon !== " "
? html` <ha-icon
id="battery-icon"
.icon=${battery.icon}
@click=${(e: { stopPropagation: () => void }) => {
main.openDetails(e, entities.battery?.state_of_charge!);
}}
@keyDown=${(e: { key: string; stopPropagation: () => void }) => {
if (e.key === "Enter") {
main.openDetails(e, entities.battery?.state_of_charge!);
}
}}
/>`
: null}
${entities.battery?.display_state === "two_way" ||
entities.battery?.display_state === undefined ||
(entities.battery?.display_state === "one_way_no_zero" && battery.state.toBattery > 0) ||
Expand Down
2 changes: 1 addition & 1 deletion src/components/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const gridElement = (
}}
>
${generalSecondarySpan(main.hass, main, config, templatesObj, grid, "grid")}
<ha-icon .icon=${grid.icon}></ha-icon>
${grid.icon !== " " ? html` <ha-icon id="grid-icon" .icon=${grid.icon} />` : null}
${(entities.grid?.display_state === "two_way" ||
entities.grid?.display_state === undefined ||
(entities.grid?.display_state === "one_way_no_zero" && (grid.state.toGrid ?? 0) > 0) ||
Expand Down
2 changes: 1 addition & 1 deletion src/components/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const homeElement = (
}}
>
${generalSecondarySpan(main.hass, main, config, templatesObj, home, "home")}
<ha-icon .icon=${home.icon}></ha-icon>
${home.icon !== " " ? html`<ha-icon id="home-icon" .icon=${home.icon} />` : null}
${homeUsageToDisplay}
<svg class="home-circle-sections">
${
Expand Down
2 changes: 1 addition & 1 deletion src/components/individualLeftBottomElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const individualLeftBottomElement = (
}}
>
${individualSecondarySpan(hass, main, config, templatesObj, individualObj, 1, "left-bottom")}
<ha-icon id="individual-left-bottom-icon" .icon=${individualObj?.icon}></ha-icon>
${individualObj?.icon !== " " ? html` <ha-icon id="individual-left-bottom-icon" .icon=${individualObj?.icon} />` : null}
${individualObj?.field?.display_zero_state !== false || (individualObj?.state || 0) > (individualObj.displayZeroTolerance ?? 0)
? html` <span class="individual-bottom individual-left-bottom"
>${individualObj?.showDirection
Expand Down
2 changes: 1 addition & 1 deletion src/components/individualLeftTopElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const individualLeftTopElement = (
}}
>
${individualSecondarySpan(main.hass, main, config, templatesObj, individualObj, 0, "left-top")}
<ha-icon id="individual-left-top-icon" .icon=${individualObj.icon}></ha-icon>
${individualObj.icon !== " " ? html` <ha-icon id="individual-left-top-icon" .icon=${individualObj.icon} />` : null}
${individualObj?.field?.display_zero_state !== false || (individualObj.state || 0) > (individualObj.displayZeroTolerance ?? 0)
? html` <span class="individual-top individual-left-top">
${individualObj?.showDirection
Expand Down
2 changes: 1 addition & 1 deletion src/components/individualRightBottomElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const individualRightBottomElement = (
}}
>
${individualSecondarySpan(main.hass, main, config, templatesObj, individualObj, 3, "right-bottom")}
<ha-icon id="individual-right-bottom-icon" .icon=${individualObj.icon}></ha-icon>
${individualObj.icon !== " " ? html` <ha-icon id="individual-right-bottom-icon" .icon=${individualObj.icon} />` : null}
${individualObj?.field?.display_zero_state !== false || (individualObj.state || 0) > (individualObj.displayZeroTolerance ?? 0)
? html` <span class="individual-bottom individual-right-bottom">
${individualObj?.showDirection
Expand Down
2 changes: 1 addition & 1 deletion src/components/individualRightTopElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const individualRightTopElement = (
}}
>
${individualSecondarySpan(main.hass, main, config, templatesObj, individualObj, 2, "right-top")}
<ha-icon id="individual-right-top-icon" .icon=${individualObj.icon}></ha-icon>
${individualObj.icon !== " " ? html` <ha-icon id="individual-right-top-icon" .icon=${individualObj.icon} />` : null}
${individualObj?.field?.display_zero_state !== false || (individualObj.state || 0) > (individualObj.displayZeroTolerance ?? 0)
? html` <span class="individual-top individual-right-top">
${individualObj?.showDirection
Expand Down
2 changes: 1 addition & 1 deletion src/components/nonFossil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const nonFossilElement = (
}}
>
${generalSecondarySpan(main.hass, main, config, templatesObj, nonFossil, "low-carbon")}
<ha-icon .icon=${nonFossil.icon} class="low-carbon"></ha-icon>
${nonFossil.icon !== " " ? html` <ha-icon id="low-carbon-icon" .icon=${nonFossil.icon} />` : null}
${entities.fossil_fuel_percentage?.display_zero_state !== false ||
(nonFossil.state.power || 0) > (entities.fossil_fuel_percentage?.display_zero_tolerance || 0)
? html`
Expand Down
2 changes: 1 addition & 1 deletion src/components/solar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const solarElement = (
}}
>
${generalSecondarySpan(main.hass, main, config, templatesObj, solar, "solar")}
<ha-icon id="solar-icon" .icon=${solar.icon}></ha-icon>
${solar.icon !== " " ? html` <ha-icon id="solar-icon" .icon=${solar.icon} />` : null}
${entities.solar?.display_zero_state !== false || (solar.state.total || 0) > 0
? html` <span class="solar">
${displayValue(main.hass, config, solar.state.total, {
Expand Down

0 comments on commit fc96c39

Please sign in to comment.