Skip to content

Commit

Permalink
Put button menu above toolbar in automation editor (#16716)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Jun 1, 2023
1 parent 9b2e77e commit efa02c3
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 39 deletions.
Expand Up @@ -191,6 +191,7 @@ export default class HaAutomationActionRow extends LitElement {
slot="icons"
@action=${this._handleAction}
@click=${preventDefault}
fixed
>
<ha-icon-button
slot="trigger"
Expand Down
6 changes: 5 additions & 1 deletion src/panels/config/automation/action/ha-automation-action.ts
Expand Up @@ -147,7 +147,11 @@ export default class HaAutomationAction extends LitElement {
`
)}
</div>
<ha-button-menu @action=${this._addAction} .disabled=${this.disabled}>
<ha-button-menu
@action=${this._addAction}
.disabled=${this.disabled}
fixed
>
<ha-button
slot="trigger"
outlined
Expand Down
Expand Up @@ -130,6 +130,7 @@ export default class HaAutomationConditionRow extends LitElement {
slot="icons"
@action=${this._handleAction}
@click=${preventDefault}
fixed
>
<ha-icon-button
slot="trigger"
Expand Down
Expand Up @@ -191,7 +191,11 @@ export default class HaAutomationCondition extends LitElement {
`
)}
</div>
<ha-button-menu @action=${this._addCondition} .disabled=${this.disabled}>
<ha-button-menu
@action=${this._addCondition}
.disabled=${this.disabled}
fixed
>
<ha-button
slot="trigger"
outlined
Expand Down
Expand Up @@ -153,6 +153,7 @@ export default class HaAutomationTriggerRow extends LitElement {
slot="icons"
@action=${this._handleAction}
@click=${preventDefault}
fixed
>
<ha-icon-button
slot="trigger"
Expand Down
73 changes: 36 additions & 37 deletions src/panels/config/automation/trigger/ha-automation-trigger.ts
Expand Up @@ -75,27 +75,25 @@ export default class HaAutomationTrigger extends LitElement {

protected render() {
return html`
${
this.reOrderMode && !this.nested
? html`
<ha-alert
alert-type="info"
.title=${this.hass.localize(
"ui.panel.config.automation.editor.re_order_mode.title"
)}
>
${this.reOrderMode && !this.nested
? html`
<ha-alert
alert-type="info"
.title=${this.hass.localize(
"ui.panel.config.automation.editor.re_order_mode.title"
)}
>
${this.hass.localize(
"ui.panel.config.automation.editor.re_order_mode.description_triggers"
)}
<mwc-button slot="action" @click=${this._exitReOrderMode}>
${this.hass.localize(
"ui.panel.config.automation.editor.re_order_mode.description_triggers"
"ui.panel.config.automation.editor.re_order_mode.exit"
)}
<mwc-button slot="action" @click=${this._exitReOrderMode}>
${this.hass.localize(
"ui.panel.config.automation.editor.re_order_mode.exit"
)}
</mwc-button>
</ha-alert>
`
: null
}
</mwc-button>
</ha-alert>
`
: null}
<div class="triggers">
${repeat(
this.triggers,
Expand Down Expand Up @@ -141,8 +139,11 @@ export default class HaAutomationTrigger extends LitElement {
</ha-automation-trigger-row>
`
)}
</div>
<ha-button-menu @action=${this._addTrigger} .disabled=${this.disabled}>
<ha-button-menu
@action=${this._addTrigger}
.disabled=${this.disabled}
fixed
>
<ha-button
slot="trigger"
outlined
Expand All @@ -153,22 +154,20 @@ export default class HaAutomationTrigger extends LitElement {
>
<ha-svg-icon .path=${mdiPlus} slot="icon"></ha-svg-icon>
</ha-button>
${
this.clipboard?.trigger
? html` <mwc-list-item .value=${PASTE_VALUE} graphic="icon">
${this.hass.localize(
"ui.panel.config.automation.editor.triggers.paste"
)}
(${this.hass.localize(
`ui.panel.config.automation.editor.triggers.type.${this.clipboard.trigger.platform}.label`
)})
<ha-svg-icon
slot="graphic"
.path=${mdiContentPaste}
></ha-svg-icon
></mwc-list-item>`
: nothing
}
${this.clipboard?.trigger
? html` <mwc-list-item .value=${PASTE_VALUE} graphic="icon">
${this.hass.localize(
"ui.panel.config.automation.editor.triggers.paste"
)}
(${this.hass.localize(
`ui.panel.config.automation.editor.triggers.type.${this.clipboard.trigger.platform}.label`
)})
<ha-svg-icon
slot="graphic"
.path=${mdiContentPaste}
></ha-svg-icon
></mwc-list-item>`
: nothing}
${this._processedTypes(this.hass.localize).map(
([opt, label, icon]) => html`
<mwc-list-item .value=${opt} graphic="icon">
Expand Down

0 comments on commit efa02c3

Please sign in to comment.