Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import {
LitElement,
property,
customElement,
PropertyValues,
TemplateResult,
html,
} from "lit-element";

import "./hui-configurator-notification-item";
import "./hui-persistent-notification-item";

import { HassEntity } from "home-assistant-js-websocket";
import { HomeAssistant } from "../../../../types";

@customElement("hui-notification-item")
export class HuiNotificationItem extends LitElement {
@property() public hass?: HomeAssistant;

@property() public notification?: HassEntity;

protected shouldUpdate(changedProps: PropertyValues): boolean {
if (!this.hass || !this.notification || changedProps.has("notification")) {
return true;
}

return false;
}

protected render(): TemplateResult | void {
if (!this.hass || !this.notification) {
return html``;
}

return this.notification.entity_id
? html`
<hui-configurator-notification-item
.hass="${this.hass}"
.notification="${this.notification}"
></hui-configurator-notification-item>
`
: html`
<hui-persistent-notification-item
.hass="${this.hass}"
.notification="${this.notification}"
></hui-persistent-notification-item>
`;
}
}

declare global {
interface HTMLElementTagNameMap {
"hui-notification-item": HuiNotificationItem;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ export class HuiPersistentNotificationItem extends LocalizeMixin(
}
}
customElements.define(
"hui-persistent_notification-notification-item",
"hui-persistent-notification-item",
HuiPersistentNotificationItem
);