mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Use the calendar color for state icon in event details (#14670)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
66a22ae102
commit
ef7d839c0f
@ -32,6 +32,8 @@ export class StateBadge extends LitElement {
|
||||
|
||||
@property({ type: Boolean }) public stateColor?: boolean;
|
||||
|
||||
@property() public color?: string;
|
||||
|
||||
@property({ type: Boolean, reflect: true, attribute: "icon" })
|
||||
private _showIcon = true;
|
||||
|
||||
@ -75,7 +77,8 @@ export class StateBadge extends LitElement {
|
||||
!changedProps.has("stateObj") &&
|
||||
!changedProps.has("overrideImage") &&
|
||||
!changedProps.has("overrideIcon") &&
|
||||
!changedProps.has("stateColor")
|
||||
!changedProps.has("stateColor") &&
|
||||
!changedProps.has("color")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@ -106,6 +109,9 @@ export class StateBadge extends LitElement {
|
||||
}
|
||||
hostStyle.backgroundImage = `url(${imageUrl})`;
|
||||
this._showIcon = false;
|
||||
} else if (this.color) {
|
||||
// Externally provided overriding color wins over state color
|
||||
iconStyle.color = this.color;
|
||||
} else if (this._stateColor && stateActive(stateObj)) {
|
||||
const color = stateColorCss(stateObj);
|
||||
if (color) {
|
||||
|
@ -19,6 +19,8 @@ class StateInfo extends LitElement {
|
||||
// property used only in CSS
|
||||
@property({ type: Boolean, reflect: true }) public rtl = false;
|
||||
|
||||
@property() public color?: string;
|
||||
|
||||
protected render(): TemplateResult {
|
||||
if (!this.hass || !this.stateObj) {
|
||||
return html``;
|
||||
@ -26,9 +28,10 @@ class StateInfo extends LitElement {
|
||||
|
||||
const name = computeStateName(this.stateObj);
|
||||
|
||||
return html`<state-badge
|
||||
return html` <state-badge
|
||||
.stateObj=${this.stateObj}
|
||||
.stateColor=${true}
|
||||
.color=${this.color}
|
||||
></state-badge>
|
||||
<div class="info">
|
||||
<div class="name" .title=${name} .inDialog=${this.inDialog}>
|
||||
|
@ -101,6 +101,7 @@ class DialogCalendarEventDetail extends LitElement {
|
||||
<state-info
|
||||
.hass=${this.hass}
|
||||
.stateObj=${stateObj}
|
||||
.color=${this._params.color}
|
||||
inDialog
|
||||
></state-info>
|
||||
</div>
|
||||
|
@ -312,6 +312,7 @@ export class HAFullCalendar extends LitElement {
|
||||
calendars: this.calendars,
|
||||
calendarId: info.event.extendedProps.calendar,
|
||||
entry: info.event.extendedProps.eventData,
|
||||
color: info.event.backgroundColor,
|
||||
updated: () => {
|
||||
this._fireViewChanged();
|
||||
},
|
||||
|
@ -8,6 +8,7 @@ export interface CalendarEventDetailDialogParams {
|
||||
canDelete?: boolean;
|
||||
canEdit?: boolean;
|
||||
updated: () => void;
|
||||
color?: string;
|
||||
}
|
||||
|
||||
export const loadCalendarEventDetailDialog = () =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user