-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't show trash-card if no events are available (#412)
- Loading branch information
Showing
9 changed files
with
107 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { html, nothing } from 'lit'; | ||
import { customElement } from 'lit/decorators.js'; | ||
import { TRASH_CARD_NAME } from '../const'; | ||
import { BaseItemElement } from './BaseItemElement'; | ||
import setupCustomlocalize from '../../../localize'; | ||
|
||
@customElement(`${TRASH_CARD_NAME}-item-empty`) | ||
class ItemCard extends BaseItemElement { | ||
public render () { | ||
if (!this.hass || !this.config) { | ||
return nothing; | ||
} | ||
|
||
const customLocalize = setupCustomlocalize(this.hass); | ||
|
||
if (this.config.entities.length === 0) { | ||
return html` | ||
<ha-alert alert-type="error" .title="TrashCard"> | ||
<b>${customLocalize('card.not_found.title')}</b> | ||
<div>${customLocalize('card.not_found.description')}</div> | ||
</ha-alert> | ||
`; | ||
} | ||
|
||
return html` | ||
<ha-alert alert-type="warning" .title="TrashCard"> | ||
<div><b>TrashCard</b></div> | ||
<div>${customLocalize('card.empty.description')}</div> | ||
</hui-warning> | ||
`; | ||
} | ||
} | ||
|
||
export { | ||
ItemCard | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters