diff --git a/src/panels/developer-tools/template/developer-tools-template.ts b/src/panels/developer-tools/template/developer-tools-template.ts index e4162d3077..b80fdd3d5d 100644 --- a/src/panels/developer-tools/template/developer-tools-template.ts +++ b/src/panels/developer-tools/template/developer-tools-template.ts @@ -88,13 +88,8 @@ class HaPanelDevTemplate extends LitElement { : "dict" : type; return html` -
-
+
+

${this.hass.localize( "ui.panel.developer-tools.tabs.templates.description" @@ -126,123 +121,143 @@ class HaPanelDevTemplate extends LitElement { > -

- ${this.hass.localize( - "ui.panel.developer-tools.tabs.templates.editor" - )} -

- - - ${this.hass.localize( - "ui.panel.developer-tools.tabs.templates.reset" - )} - - - ${this.hass.localize("ui.common.clear")} -
+
+
+ +
+ +
+
+ + ${this.hass.localize( + "ui.panel.developer-tools.tabs.templates.reset" + )} + + + ${this.hass.localize("ui.common.clear")} + +
+
-
- ${this._rendering - ? html`` - : ""} - ${this._error - ? html`${this._error}` - : nothing} - ${this._templateResult - ? html`${this.hass.localize( - "ui.panel.developer-tools.tabs.templates.result_type" - )}: - ${resultType} - -
${type === "object"
-                  ? JSON.stringify(this._templateResult.result, null, 2)
-                  : this._templateResult.result}
- ${this._templateResult.listeners.time - ? html` -

- ${this.hass.localize( - "ui.panel.developer-tools.tabs.templates.time" - )} -

- ` - : ""} - ${!this._templateResult.listeners - ? nothing - : this._templateResult.listeners.all + +
+ ${this._rendering + ? html`` + : ""} + ${this._error + ? html`${this._error}` + : nothing} + ${this._templateResult + ? html`${this.hass.localize( + "ui.panel.developer-tools.tabs.templates.result_type" + )}: + ${resultType} + +
${type === "object"
+                    ? JSON.stringify(this._templateResult.result, null, 2)
+                    : this._templateResult.result}
+ ${this._templateResult.listeners.time ? html` -

+

${this.hass.localize( - "ui.panel.developer-tools.tabs.templates.all_listeners" + "ui.panel.developer-tools.tabs.templates.time" )}

` - : this._templateResult.listeners.domains.length || - this._templateResult.listeners.entities.length + : ""} + ${!this._templateResult.listeners + ? nothing + : this._templateResult.listeners.all ? html` -

+

${this.hass.localize( - "ui.panel.developer-tools.tabs.templates.listeners" + "ui.panel.developer-tools.tabs.templates.all_listeners" )}

-
    - ${this._templateResult.listeners.domains - .sort() - .map( - (domain) => html` -
  • - ${this.hass.localize( - "ui.panel.developer-tools.tabs.templates.domain" - )}: ${domain} -
  • - ` - )} - ${this._templateResult.listeners.entities - .sort() - .map( - (entity_id) => html` -
  • - ${this.hass.localize( - "ui.panel.developer-tools.tabs.templates.entity" - )}: ${entity_id} -
  • - ` - )} -
` - : !this._templateResult.listeners.time - ? html` - ${this.hass.localize( - "ui.panel.developer-tools.tabs.templates.no_listeners" - )} - ` - : nothing}` - : nothing} -
+ : this._templateResult.listeners.domains.length || + this._templateResult.listeners.entities.length + ? html` +

+ ${this.hass.localize( + "ui.panel.developer-tools.tabs.templates.listeners" + )} +

+
    + ${this._templateResult.listeners.domains + .sort() + .map( + (domain) => html` +
  • + ${this.hass.localize( + "ui.panel.developer-tools.tabs.templates.domain" + )}: ${domain} +
  • + ` + )} + ${this._templateResult.listeners.entities + .sort() + .map( + (entity_id) => html` +
  • + ${this.hass.localize( + "ui.panel.developer-tools.tabs.templates.entity" + )}: ${entity_id} +
  • + ` + )} +
+ ` + : !this._templateResult.listeners.time + ? html` + ${this.hass.localize( + "ui.panel.developer-tools.tabs.templates.no_listeners" + )} + ` + : nothing}` + : nothing} +
+
`; } @@ -258,6 +273,7 @@ class HaPanelDevTemplate extends LitElement { } .content { + gap: 16px; padding: 16px; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) @@ -265,10 +281,11 @@ class HaPanelDevTemplate extends LitElement { max(16px, env(safe-area-inset-left)); } + ha-card { + margin-bottom: 16px; + } + .edit-pane { - margin-right: 16px; - margin-inline-start: initial; - margin-inline-end: 16px; direction: var(--direction); } @@ -280,12 +297,6 @@ class HaPanelDevTemplate extends LitElement { max-width: 50%; } - .render-pane { - position: relative; - max-width: 50%; - flex: 1; - } - .render-spinner { position: absolute; top: 8px; diff --git a/src/translations/en.json b/src/translations/en.json index 7d05b89322..d54669e38c 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -6850,6 +6850,7 @@ "title": "Template", "description": "Templates are rendered using the Jinja2 template engine with some Home Assistant specific extensions.", "editor": "Template editor", + "result": "Result", "reset": "Reset to demo template", "confirm_reset": "Do you want to reset your current template back to the demo template?", "confirm_clear": "Do you want to clear your current template?",