Add label for add badge button in masonry and sidebar view (#23827)

Add label for add badge button in mansonry and sidebar view
This commit is contained in:
Paul Bottein 2025-01-21 18:45:06 +01:00 committed by GitHub
parent ca2a9f9171
commit c4b2896fac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 0 deletions

View File

@ -32,6 +32,9 @@ export class HuiViewBadges extends LitElement {
@property({ attribute: false }) public viewIndex!: number; @property({ attribute: false }) public viewIndex!: number;
@property({ type: Boolean, attribute: "show-add-label" })
public showAddLabel!: boolean;
@state() _dragging = false; @state() _dragging = false;
private _badgeConfigKeys = new WeakMap<HuiBadge, string>(); private _badgeConfigKeys = new WeakMap<HuiBadge, string>();
@ -153,6 +156,11 @@ export class HuiViewBadges extends LitElement {
> >
<ha-ripple></ha-ripple> <ha-ripple></ha-ripple>
<ha-svg-icon .path=${mdiPlus}></ha-svg-icon> <ha-svg-icon .path=${mdiPlus}></ha-svg-icon>
${this.showAddLabel
? this.hass.localize(
"ui.panel.lovelace.editor.section.add_badge"
)
: nothing}
</button> </button>
` `
: nothing} : nothing}
@ -201,6 +209,7 @@ export class HuiViewBadges extends LitElement {
border-color: var(--primary-color); border-color: var(--primary-color);
--mdc-icon-size: 18px; --mdc-icon-size: 18px;
cursor: pointer; cursor: pointer;
font-size: 14px;
color: var(--primary-text-color); color: var(--primary-text-color);
--ha-ripple-color: var(--primary-color); --ha-ripple-color: var(--primary-color);
--ha-ripple-hover-opacity: 0.04; --ha-ripple-hover-opacity: 0.04;

View File

@ -80,6 +80,7 @@ export class MasonryView extends LitElement implements LovelaceViewElement {
.badges=${this.badges} .badges=${this.badges}
.lovelace=${this.lovelace} .lovelace=${this.lovelace}
.viewIndex=${this.index} .viewIndex=${this.index}
show-add-label
></hui-view-badges> ></hui-view-badges>
<div <div
id="columns" id="columns"

View File

@ -88,6 +88,7 @@ export class SideBarView extends LitElement implements LovelaceViewElement {
.badges=${this.badges} .badges=${this.badges}
.lovelace=${this.lovelace} .lovelace=${this.lovelace}
.viewIndex=${this.index} .viewIndex=${this.index}
show-add-label
></hui-view-badges> ></hui-view-badges>
<div <div
class="container ${this.lovelace?.editMode ? "edit-mode" : ""}" class="container ${this.lovelace?.editMode ? "edit-mode" : ""}"