-
Notifications
You must be signed in to change notification settings - Fork 42
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
Make it possible to configure items per row for area cards in home view #84
base: main
Are you sure you want to change the base?
Conversation
This is exactly one of my future ideas for the project. 👍🏻 I do hope you're gonna code a little slower since I'm migrating to Typescript at the moment. 😅 |
😁 |
Let me review it first, so we can merge it later. |
src/Helper.js
Outdated
@@ -119,6 +132,7 @@ class Helper { | |||
*/ | |||
static async initialize(info) { | |||
this.#hassStates = info.hass.states; | |||
this.#narrow = info.narrow; |
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.
Are you sure the info object has a narrow property?
Object { config: {…}, hass: {…} }
config: Object { strategy: {…}, views: [] }
hass: Object { auth: {…}, connection: {…}, connected: true, … }
```
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.
Sure, I have tested it. As you see in the screenshots.
There are also a lot of occurrences of it in the ha frontend code: https://github.com/search?q=repo%3Ahome-assistant%2Ffrontend%20narrow&type=code
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.
Yeah, I've seen it also at different places, but still... it's undefined
at my HASS.
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.
This might be a problem: home-assistant/frontend#18201
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.
Ouch. Very strange decision from them IMO. Since they are still using narrow internally.
Quick browse of their code shows that this could work:
this.#narrow = window.matchMedia("(max-width: 870px)").matches;
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.
I think that's the way to go.
You should research which of the media-queries will fit best for the "narrow" mode.
max 870px seems quite large to me.
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.
870px suits what I have tested, and is also the definition of narrow in home assistant. I'll go with that, unless you tell me to go with something else 😄
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.
Updated now
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.
Since narrow
is out, I'd say not to check for undefined
and just define it ourselves the way you suggested.
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.
fixed
Panel mode can't be set if there's more than 1 card.
|
True |
Yeah... that's a catch. 😅 Let me think about it if we can get the best out of two worlds. |
Never thought of it that way. |
I agree. We must see how to trick it or find another layout to apply. |
Warning The |
a6a10d5
to
3519967
Compare
Done. |
@DigiLive @AalianKhan Has development stopped on this repository? |
Not for me, but currently a bit busy with other code and personal matters. |
Bump. This would add a lot of value to my setup, any idea on a timeline, or anything I can do t help ? Thanks |
It's currently stuck on the requirement of |
Why not simply change to always use panel? Full width makes more sense to me. |
As already said before: Panel mode can't be set if there's more than 1 card. |
any progess on this, guys? |
Make it possible to configure items per row for area cards in home view, as well as make it possible to have different configurations based on the width of the display.
Example yaml
Example for narrow view
Example for desktop view