mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Don't show edit favorite colors button if the light doesn't support it (#16750)
This commit is contained in:
parent
21f983572c
commit
9f3e8abe69
@ -58,6 +58,10 @@ export const lightSupportsBrightness = (entity: LightEntity) =>
|
|||||||
modesSupportingBrightness.includes(mode)
|
modesSupportingBrightness.includes(mode)
|
||||||
) || false;
|
) || false;
|
||||||
|
|
||||||
|
export const lightSupportsFavoriteColors = (entity: LightEntity) =>
|
||||||
|
lightSupportsColor(entity) ||
|
||||||
|
lightSupportsColorMode(entity, LightColorMode.COLOR_TEMP);
|
||||||
|
|
||||||
export const getLightCurrentModeRgbColor = (
|
export const getLightCurrentModeRgbColor = (
|
||||||
entity: LightEntity
|
entity: LightEntity
|
||||||
): number[] | undefined =>
|
): number[] | undefined =>
|
||||||
|
@ -37,6 +37,7 @@ import {
|
|||||||
lightSupportsBrightness,
|
lightSupportsBrightness,
|
||||||
lightSupportsColor,
|
lightSupportsColor,
|
||||||
lightSupportsColorMode,
|
lightSupportsColorMode,
|
||||||
|
lightSupportsFavoriteColors,
|
||||||
} from "../../../data/light";
|
} from "../../../data/light";
|
||||||
import type { HomeAssistant } from "../../../types";
|
import type { HomeAssistant } from "../../../types";
|
||||||
import { moreInfoControlStyle } from "../components/ha-more-info-control-style";
|
import { moreInfoControlStyle } from "../components/ha-more-info-control-style";
|
||||||
@ -206,7 +207,9 @@ class MoreInfoLight extends LitElement {
|
|||||||
`
|
`
|
||||||
: nothing}
|
: nothing}
|
||||||
</div>
|
</div>
|
||||||
${this.entry && (this.editMode || hasFavoriteColors)
|
${this.entry &&
|
||||||
|
lightSupportsFavoriteColors(this.stateObj) &&
|
||||||
|
(this.editMode || hasFavoriteColors)
|
||||||
? html`
|
? html`
|
||||||
<ha-more-info-light-favorite-colors
|
<ha-more-info-light-favorite-colors
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
@ -32,6 +32,7 @@ import {
|
|||||||
ExtEntityRegistryEntry,
|
ExtEntityRegistryEntry,
|
||||||
getExtendedEntityRegistryEntry,
|
getExtendedEntityRegistryEntry,
|
||||||
} from "../../data/entity_registry";
|
} from "../../data/entity_registry";
|
||||||
|
import { lightSupportsFavoriteColors } from "../../data/light";
|
||||||
import { SearchableDomains } from "../../data/search";
|
import { SearchableDomains } from "../../data/search";
|
||||||
import { haStyleDialog } from "../../resources/styles";
|
import { haStyleDialog } from "../../resources/styles";
|
||||||
import "../../state-summary/state-card-content";
|
import "../../state-summary/state-card-content";
|
||||||
@ -359,7 +360,10 @@ export class MoreInfoDialog extends LitElement {
|
|||||||
</ha-list-item>
|
</ha-list-item>
|
||||||
`
|
`
|
||||||
: nothing}
|
: nothing}
|
||||||
${this._entry && domain === "light"
|
${this._entry &&
|
||||||
|
stateObj &&
|
||||||
|
domain === "light" &&
|
||||||
|
lightSupportsFavoriteColors(stateObj)
|
||||||
? html`
|
? html`
|
||||||
<ha-list-item
|
<ha-list-item
|
||||||
graphic="icon"
|
graphic="icon"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user