diff --git a/src/panels/lovelace/views/const.ts b/src/panels/lovelace/views/const.ts index 5633f05bbc..fb68615fd8 100644 --- a/src/panels/lovelace/views/const.ts +++ b/src/panels/lovelace/views/const.ts @@ -2,8 +2,4 @@ export const DEFAULT_VIEW_LAYOUT = "masonry"; export const PANEL_VIEW_LAYOUT = "panel"; export const SIDEBAR_VIEW_LAYOUT = "sidebar"; export const SECTION_VIEW_LAYOUT = "sections"; -export const VIEWS_NO_BADGE_SUPPORT = [ - PANEL_VIEW_LAYOUT, - SIDEBAR_VIEW_LAYOUT, - SECTION_VIEW_LAYOUT, -]; +export const VIEWS_NO_BADGE_SUPPORT = [PANEL_VIEW_LAYOUT, SIDEBAR_VIEW_LAYOUT]; diff --git a/src/panels/lovelace/views/hui-masonry-view.ts b/src/panels/lovelace/views/hui-masonry-view.ts index bcc87214e3..c8e3047c2d 100644 --- a/src/panels/lovelace/views/hui-masonry-view.ts +++ b/src/panels/lovelace/views/hui-masonry-view.ts @@ -291,12 +291,6 @@ export class MasonryView extends LitElement implements LovelaceViewElement { padding-top: 4px; } - .badges { - margin: 8px 16px; - font-size: 85%; - text-align: center; - } - #columns { display: flex; flex-direction: row; diff --git a/src/panels/lovelace/views/hui-sections-view.ts b/src/panels/lovelace/views/hui-sections-view.ts index cbf5af8570..71c612808e 100644 --- a/src/panels/lovelace/views/hui-sections-view.ts +++ b/src/panels/lovelace/views/hui-sections-view.ts @@ -20,7 +20,7 @@ import { updateLovelaceContainer, } from "../editor/lovelace-path"; import { HuiSection } from "../sections/hui-section"; -import type { Lovelace } from "../types"; +import type { Lovelace, LovelaceBadge } from "../types"; @customElement("hui-sections-view") export class SectionsView extends LitElement implements LovelaceViewElement { @@ -34,6 +34,8 @@ export class SectionsView extends LitElement implements LovelaceViewElement { @property({ attribute: false }) public sections: HuiSection[] = []; + @property({ attribute: false }) public badges: LovelaceBadge[] = []; + @state() private _config?: LovelaceViewConfig; public setConfig(config: LovelaceViewConfig): void { @@ -57,6 +59,9 @@ export class SectionsView extends LitElement implements LovelaceViewElement { const editMode = this.lovelace.editMode; return html` + ${this.badges.length > 0 + ? html`