-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix visibility for shown entities on device card #22579
Fix visibility for shown entities on device card #22579
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix 🎉
There is still too much space when you have just the button +x entities
.
What about refectoring it a bit?
3 wrapper:
- shownEntities
- seperator (only visible if shown + hidden length > 0
- hiddenEntities
then you just have to add lit condition instead of css magic.
src/panels/config/devices/device-detail/ha-device-entities-card.ts
Outdated
Show resolved
Hide resolved
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
This comment was marked as resolved.
This comment was marked as resolved.
…d.ts Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>
Hi @wendevlin , thanks for reviewing. Is adding a separator line between 2
|
No as ${shownEntities.length && hiddenEntities.length ? html`<div class="entities-separator"></div>` : nothing} So you don't have to set a margin for the button and the list, just show it or hide it. |
@wendevlin
instead of
So, now a space between
So, introducing a conditional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ildar170975,
Ok let's do it like this:
wrap the hiddenEntities into a div and give it a class only if shownEntities are not there:
${hiddenEntities.length
? html`<div class=${classMap({ "move-up": !shownEntities.length })}>
${!this.showHidden
? html`
<button class="show-more" @click=${this._toggleShowHidden}>
${this.hass.localize(
"ui.panel.config.devices.entities.hidden_entities",
{ count: hiddenEntities.length }
)}
</button>
`
: html`
<mwc-list>
${hiddenEntities.map((entry) => this._renderEntry(entry))}
</mwc-list>
<button class="show-more" @click=${this._toggleShowHidden}>
${this.hass.localize(
"ui.panel.config.devices.entities.show_less"
)}
</button>
`}
</div>`
: nothing}
and replace #entities
margin-top with:
.move-up {
margin-top: -24px;
}
src/panels/config/devices/device-detail/ha-device-entities-card.ts
Outdated
Show resolved
Hide resolved
src/panels/config/devices/device-detail/ha-device-entities-card.ts
Outdated
Show resolved
Hide resolved
…d.ts Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>
…d.ts Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>
@wendevlin |
src/panels/config/devices/device-detail/ha-device-entities-card.ts
Outdated
Show resolved
Hide resolved
@ildar170975 Sorry I was a bit busy, thank you for your improvement 🎉 |
@ildar170975 unfortunately the CI failed, you will need to run |
@wendevlin |
Head branch was pushed to by a user without write access
@wendevlin |
#22577 must be merged first since it fixes a disabled entity row's height.
Breaking change
Proposed change
Currently if a device card contains only disabled entities, it causes a big vertical gap between a header & 1st disabled entity:
This PR:
#entities
element only if some enabled entities present.After the fix (note that changes in #22577 here accounted - a fixed row's height = 40px):
If some entities are enabled:
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: