Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
iantrich committed Nov 17, 2020
1 parent 90e5855 commit a102dd0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "boilerplate-card",
"version": "1.3.0",
"version": "1.3.1",
"description": "Lovelace boilerplate-card",
"keywords": [
"home-assistant",
Expand Down
12 changes: 8 additions & 4 deletions src/boilerplate-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class BoilerplateCard extends LitElement {

public setConfig(config: BoilerplateCardConfig): void {
// TODO Check for required fields and that they are of the proper format
if (!config || config.show_error) {
if (!config) {
throw new Error(localize('common.invalid_configuration'));
}

Expand All @@ -84,7 +84,11 @@ export class BoilerplateCard extends LitElement {
protected render(): TemplateResult | void {
// TODO Check for stateObj or other necessary things and render a warning if missing
if (this.config.show_warning) {
return this.showWarning(localize('common.show_warning'));
return this._showWarning(localize('common.show_warning'));
}

if (this.config.show_error) {
return this._showError(localize('common.show_error'));
}

return html`
Expand All @@ -107,13 +111,13 @@ export class BoilerplateCard extends LitElement {
}
}

private showWarning(warning: string): TemplateResult {
private _showWarning(warning: string): TemplateResult {
return html`
<hui-warning>${warning}</hui-warning>
`;
}

private showError(error: string): TemplateResult {
private _showError(error: string): TemplateResult {
const errorCard = document.createElement('hui-error-card');
errorCard.setConfig({
type: 'error',
Expand Down
2 changes: 1 addition & 1 deletion src/const.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const CARD_VERSION = '1.3.0';
export const CARD_VERSION = '1.3.1';
3 changes: 2 additions & 1 deletion src/localize/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"common": {
"version": "Version",
"invalid_configuration": "Invalid configuration",
"show_warning": "Show Warning"
"show_warning": "Show Warning",
"show_error": "Show Error"
}
}

0 comments on commit a102dd0

Please sign in to comment.