Skip to content

Refactor home panel editor#51701

Merged
piitaya merged 6 commits intodevfrom
refactor_home_panel_editor
Apr 25, 2026
Merged

Refactor home panel editor#51701
piitaya merged 6 commits intodevfrom
refactor_home_panel_editor

Conversation

@piitaya
Copy link
Copy Markdown
Member

@piitaya piitaya commented Apr 24, 2026

Proposed change

Consistency pass over the Home panel editor dialog from #51407:

  • Unified section layout: each section uses the same header + description + dedicated editor component.
  • Drag-to-reorder on favorites and custom shortcuts.
  • Welcome message now displayed at the top of the Personalize group, matching the dashboard order.
  • "Suggested entities" toggle is disabled when favorites fill the section.
  • Cleaned up the common-controls section strategy: removed the show_predicted

Screenshots

CleanShot 2026-04-24 at 11 58 18

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • I have followed the [perfect PR recommendations][perfect-pr]
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated for [www.home-assistant.io][docs-repository]

To help with the load of incoming pull requests:

  • I have reviewed two other [open pull requests][prs] in this repository.

@piitaya
Copy link
Copy Markdown
Member Author

piitaya commented Apr 24, 2026

@pcan08 here's the PR.

@pcan08
Copy link
Copy Markdown
Contributor

pcan08 commented Apr 24, 2026

It looks nice. IMO the dialog could be wider on desktop with 2 columns.

  • The first for welcome message & favorites+suggestion settings
  • The second with summaries et shortcuts settings

Comment on lines +54 to +65
<label class="home-list-item summary-toggle">
<ha-icon
.icon=${item.icon}
style=${styleMap({ "--mdc-icon-size": "24px", color })}
></ha-icon>
<span class="label">${label}</span>
<ha-switch
.checked=${!hidden.has(item.key)}
.summary=${item.key}
@change=${this._toggleChanged}
></ha-switch>
</label>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest

            <ha-settings-row slim>
              <ha-icon
                slot="prefix"
                .icon=${item.icon}
                style=${styleMap({ "--mdc-icon-size": "24px", color })}
              ></ha-icon>
              <span slot="heading">${label}</span>
              <ha-switch
                .checked=${!hidden.has(item.key)}
                .summary=${item.key}
                @change=${this._toggleChanged}
              ></ha-switch>
            </ha-settings-row>

Comment on lines +100 to +110
.summary-toggle {
display: flex;
align-items: center;
gap: var(--ha-space-3);
padding: var(--ha-space-2) 0;
cursor: pointer;
}
.summary-toggle .label {
flex: 1;
font-size: 14px;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and replace with

    ha-settings-row {
      padding: var(--ha-space-2) 0;
      gap: var(--ha-space-3);
      --settings-row-prefix-display: contents;
    }

Copy link
Copy Markdown
Member

@timmo001 timmo001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few function signature types, removes the need for type assertion

Extra assignments possibly not needed now function signatures are accurate also


The extension did a bad job at these suggestions, might need tweaking

Comment thread src/panels/home/components/home-custom-shortcuts-editor.ts Outdated
Comment thread src/panels/home/components/home-custom-shortcuts-editor.ts Outdated
Comment thread src/panels/home/components/home-custom-shortcuts-editor.ts Outdated
Comment thread src/panels/home/components/home-custom-shortcuts-editor.ts Outdated
Comment thread src/panels/home/components/home-favorites-editor.ts Outdated
Comment thread src/panels/home/components/home-favorites-editor.ts Outdated
Comment thread src/panels/home/dialogs/dialog-edit-home.ts Outdated
Comment thread src/panels/home/dialogs/dialog-edit-home.ts Outdated
Comment thread src/panels/home/components/home-favorites-editor.ts Outdated
Comment thread src/panels/home/dialogs/dialog-edit-home.ts Outdated
@piitaya
Copy link
Copy Markdown
Member Author

piitaya commented Apr 24, 2026

@pcan08 I used the ha-settings-row. For the 2 columns, I'm not sure as we are using expandable.

@piitaya piitaya merged commit edc36b2 into dev Apr 25, 2026
12 checks passed
@piitaya piitaya deleted the refactor_home_panel_editor branch April 25, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants