diff --git a/src/panels/lovelace/cards/hui-area-card.ts b/src/panels/lovelace/cards/hui-area-card.ts
index fd8f89072263..a203f8228bc8 100644
--- a/src/panels/lovelace/cards/hui-area-card.ts
+++ b/src/panels/lovelace/cards/hui-area-card.ts
@@ -23,9 +23,8 @@ import { customElement, property, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
import { styleMap } from "lit/directives/style-map";
import memoizeOne from "memoize-one";
-import { FIXED_DEVICE_CLASS_ICONS, STATES_OFF } from "../../../common/const";
+import { STATES_OFF } from "../../../common/const";
import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element";
-import { binarySensorIcon } from "../../../common/entity/binary_sensor_icon";
import { computeDomain } from "../../../common/entity/compute_domain";
import { navigate } from "../../../common/navigate";
import {
@@ -36,8 +35,9 @@ import { blankBeforeUnit } from "../../../common/translations/blank_before_unit"
import parseAspectRatio from "../../../common/util/parse-aspect-ratio";
import { subscribeOne } from "../../../common/util/subscribe-one";
import "../../../components/ha-card";
+import "../../../components/ha-domain-icon";
import "../../../components/ha-icon-button";
-import "../../../components/ha-svg-icon";
+import "../../../components/ha-state-icon";
import {
AreaRegistryEntry,
subscribeAreaRegistry,
@@ -388,13 +388,16 @@ export class HuiAreaCard
(entity) => entity.attributes.device_class === deviceClass
)
) {
- const icon = FIXED_DEVICE_CLASS_ICONS[deviceClass];
- sensors.push(
- html`
- ${icon ? html`
` : ""}
+ sensors.push(html`
+
+
${this._average(domain, deviceClass)}
-
`
- );
+
+ `);
}
});
});
@@ -434,16 +437,18 @@ export class HuiAreaCard
${ALERT_DOMAINS.map((domain) => {
if (!(domain in entitiesByDomain)) {
- return "";
+ return nothing;
}
return this._deviceClasses[domain].map((deviceClass) => {
const entity = this._isOn(domain, deviceClass);
return entity
- ? html``
+ ? html`
+
+ `
: nothing;
});
})}
@@ -572,7 +577,14 @@ export class HuiAreaCard
padding: 16px;
}
- .alerts ha-svg-icon {
+ ha-state-icon {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ position: relative;
+ }
+
+ .alerts ha-state-icon {
background: var(--accent-color);
color: var(--text-accent-color, var(--text-primary-color));
padding: 8px;
diff --git a/src/panels/lovelace/cards/hui-plant-status-card.ts b/src/panels/lovelace/cards/hui-plant-status-card.ts
index 74c080031ae5..80435b1f0b74 100644
--- a/src/panels/lovelace/cards/hui-plant-status-card.ts
+++ b/src/panels/lovelace/cards/hui-plant-status-card.ts
@@ -16,7 +16,7 @@ import {
import { customElement, property, state } from "lit/decorators";
import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element";
import { fireEvent } from "../../../common/dom/fire_event";
-import { batteryIcon } from "../../../common/entity/battery_icon";
+import { batteryLevelIcon } from "../../../common/entity/battery_icon";
import { computeStateName } from "../../../common/entity/compute_state_name";
import "../../../components/ha-card";
import "../../../components/ha-svg-icon";
@@ -252,7 +252,7 @@ class HuiPlantStatusCard extends LitElement implements LovelaceCard {
private computeIcon(attr: string, batLvl: number): string {
if (attr === "battery") {
- return batteryIcon(batLvl);
+ return batteryLevelIcon(batLvl);
}
return SENSOR_ICONS[attr];
}
diff --git a/src/panels/media-browser/ha-bar-media-player.ts b/src/panels/media-browser/ha-bar-media-player.ts
index f9cbb286893a..eb459f5ba8d3 100644
--- a/src/panels/media-browser/ha-bar-media-player.ts
+++ b/src/panels/media-browser/ha-bar-media-player.ts
@@ -1,7 +1,5 @@
-import "@material/mwc-button/mwc-button";
import "@material/mwc-linear-progress/mwc-linear-progress";
import type { LinearProgress } from "@material/mwc-linear-progress/mwc-linear-progress";
-import "@material/mwc-list/mwc-list-item";
import {
mdiChevronDown,
mdiMonitor,
@@ -12,11 +10,11 @@ import {
mdiVolumeHigh,
} from "@mdi/js";
import {
- css,
CSSResultGroup,
- html,
LitElement,
PropertyValues,
+ css,
+ html,
nothing,
} from "lit";
import { customElement, property, query, state } from "lit/decorators";
@@ -26,25 +24,29 @@ import { fireEvent } from "../../common/dom/fire_event";
import { computeDomain } from "../../common/entity/compute_domain";
import { computeStateDomain } from "../../common/entity/compute_state_domain";
import { computeStateName } from "../../common/entity/compute_state_name";
-import { domainIcon } from "../../common/entity/domain_icon";
import { supportsFeature } from "../../common/entity/supports-feature";
+import { debounce } from "../../common/util/debounce";
import "../../components/ha-button";
import "../../components/ha-button-menu";
import "../../components/ha-circular-progress";
+import "../../components/ha-domain-icon";
import "../../components/ha-icon-button";
+import "../../components/ha-list-item";
+import "../../components/ha-state-icon";
+import "../../components/ha-svg-icon";
import { UNAVAILABLE } from "../../data/entity";
import {
BROWSER_PLAYER,
+ ControlButton,
+ MediaPlayerEntity,
+ MediaPlayerEntityFeature,
+ MediaPlayerItem,
cleanupMediaTitle,
computeMediaControls,
computeMediaDescription,
- ControlButton,
formatMediaTime,
getCurrentProgress,
handleMediaControlClick,
- MediaPlayerEntity,
- MediaPlayerEntityFeature,
- MediaPlayerItem,
setMediaPlayerVolume,
} from "../../data/media-player";
import { ResolvedMediaSource } from "../../data/media_source";
@@ -56,7 +58,6 @@ import {
BrowserMediaPlayer,
ERR_UNSUPPORTED_MEDIA,
} from "./browser-media-player";
-import { debounce } from "../../common/util/debounce";
declare global {
interface HASSDomEvents {
@@ -320,22 +321,19 @@ export class BarMediaPlayer extends SubscribeMixin(LitElement) {
: ""
}
-
+
${
this.narrow
? html`
-
+
+ ${this._renderIcon(isBrowser, stateObj)}
+
`
: html`
-
+
+ ${this._renderIcon(isBrowser, stateObj)}
+
`
}
-
${this.hass.localize("ui.components.media-browser.web-browser")}
-
+
${this._mediaPlayerEntities.map(
(source) => html`
-
${computeStateName(source)}
-
+
`
)}
@@ -382,6 +377,23 @@ export class BarMediaPlayer extends SubscribeMixin(LitElement) {
`;
}
+ private _renderIcon(isBrowser: boolean, stateObj?: MediaPlayerEntity) {
+ if (isBrowser) {
+ return html``;
+ }
+ if (stateObj) {
+ return html`
+
+ `;
+ }
+ return html`
+
+ `;
+ }
+
public willUpdate(changedProps: PropertyValues) {
super.willUpdate(changedProps);
if (changedProps.has("entityId")) {
@@ -571,9 +583,10 @@ export class BarMediaPlayer extends SubscribeMixin(LitElement) {
--mdc-theme-primary: var(--secondary-text-color);
}
- mwc-button[slot="trigger"] {
+ ha-button-menu ha-button[slot="trigger"] {
+ line-height: 1;
--mdc-theme-primary: var(--primary-text-color);
- --mdc-icon-size: 36px;
+ --mdc-icon-size: 16px;
}
.info {
@@ -650,10 +663,6 @@ export class BarMediaPlayer extends SubscribeMixin(LitElement) {
margin: 16px 0 16px 16px;
}
- ha-button-menu mwc-button {
- line-height: 1;
- }
-
:host([narrow]) {
height: 57px;
}
@@ -696,10 +705,15 @@ export class BarMediaPlayer extends SubscribeMixin(LitElement) {
left: 0;
}
- mwc-list-item[selected] {
+ ha-list-item[selected] {
font-weight: bold;
}
+ span[slot="icon"] {
+ display: flex;
+ align-items: center;
+ }
+
ha-svg-icon[slot="trailingIcon"] {
margin-inline-start: 8px !important;
margin-inline-end: 0px !important;