Skip to content
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

Update developer-tools-template.ts: Vertical layout instead of horizo… #16921

Closed

Conversation

backcountrymountains
Copy link

Proposed change

My templates, and I think, many other templates tend to be wider rather than longer.

Changing to a stacked vertical layout between the editor box and the result box allow me to see my absurdly long one-line templates without scrolling.

Type of change

I don't know what type of change this is.

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

Example configuration

Additional information

  • This PR is related to issue or discussion: 16002

Change to this:
image
instead of:
image

Checklist

I don't know how to do any checks.

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

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

…ntal

My templates, and I think, many other templates tend to be wider rather than longer.

Changing to a stacked vertical layout between the editor box and the result box allow me to see my absurdly long one-line templates without scrolling.
@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented Jun 15, 2023

tbh, you should really wrap those templates in the first place.
you top image his a terrible example of what you are trying to test.

usually a max 80 char width is used, in most text editors for programming. highlighting the optimal canvas:

Scherm­afbeelding 2023-06-15 om 17 40 30

do the same inside dev tools and that issue is solved

having said that, narrowing the screen will bring the layout as you propose already?

@backcountrymountains
Copy link
Author

Yes, my code is ugly, but even with the HA demo template, I have to scroll to see the whole template.
image
as opposed to vertical layout:
image

I was unaware that making my window more narrow would cause the layout to be vertical, that's neat.

I still think that its more usable to default to the vertical layout so that we don't have to scroll or adjust the window size to see longer lines in the template editor.

I don't know programming, but I frequently find templates with long lines in sample code from the HA docs or forums as well as my own code and I think the vertical layout better accommodates such long-lined code, which is common, even if it isn't the 80 character optimal canvas.

I think part of the issue is that the HA naming scheme for things is quite verbose, which I appreciate for readability, but makes for long lines of code.

@bramkragten
Copy link
Member

I think we can fine tune this a bit, but not make it vertical always.
It makes no sense to do that on very wide monitors.

@backcountrymountains
Copy link
Author

Despite having widescreen monitors, I almost always have more vertical space than horizontal space in my browsing windows because I have multiple documents/browsers open at the same time while I'm trying to figure out what I'm doing and test what I'm doing at the same time.

Just fiddling around a 70%:30% split seems to work out okay. For me, the templates have much longer lines than the results. I can have a whole page of template that just returns 'day' and such.

I think this would be a great thing to have in a theme so I could just set it once in the theme yaml. Is this kind of thing themable?

@bramkragten
Copy link
Member

That you don't use it doesn't mean we should not consider it. We can just change the layout based on the width of the browser window and make the ideal layout for every window size.

This is not themable, it should just work for most/all users.

@noxhirsch
Copy link
Contributor

Maybe something like this would be an alternative? https://stackoverflow.com/a/53220241
Then each user could set it as they wish - of course on reload it would reset to 50:50 if saving is not implemented (which I don't think would be neccessary)

@github-actions
Copy link

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 19, 2023
@noxhirsch
Copy link
Contributor

I think this is still a relevant PR

@github-actions github-actions bot removed the stale label Sep 21, 2023
@bramkragten
Copy link
Member

I think this is still a relevant PR

Seems the author abandoned it.

If you want to continue, feel free to re-open this PR.

@ildar170975
Copy link
Contributor

I do not think that using vertical layout is a good idea.
Instead I propose another approach:
#17765

@github-actions github-actions bot locked and limited conversation to collaborators Sep 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants