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: add independent scrollbars for left & right panels for large screens #17765

Merged

Conversation

ildar170975
Copy link
Contributor

@ildar170975 ildar170975 commented Aug 31, 2023

Initial idea was posted here: https://community.home-assistant.io/t/dev-tools-template-add-scrollbars/439175

This PR creates independent scrollbars for right & left panel in Dev tools -> Template.
These scrollbars are visible on large screens only (when these panels are "left - right", not "up - down").

image


P.S. I do not like the current design where panels are not aligned:

image

instead of

image

but this will be another my PR (I hope...).

Breaking change

Proposed change

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

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • [x ] The code change is tested and works locally.
  • [x ] 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:

Summary by CodeRabbit

  • New Features

    • Enhanced layout and functionality of the developer tools panel with improved CSS styles.
    • Introduced dynamic height adjustments for the code mirror component to improve usability.
    • Updated spinner component properties for better visual presentation.
  • Bug Fixes

    • Improved responsiveness and consistency of elements within the horizontal content area.

@bramkragten
Copy link
Member

If we are going to add scroll bars to both sides, we should make this panel full screen, and make both scrollable containers the same height. Take a look at the automation traces UI for inspiration.

@ildar170975
Copy link
Contributor Author

and make both scrollable containers the same height

Hi @bramkragten !
Agreed. Will try to propose a solution.

@bramkragten
Copy link
Member

Hi! Are you planning to continue working on this?

@ildar170975
Copy link
Contributor Author

Hi, Bram! Absolutely yes. Sorry for a delay, some personal & war-related issues.

@bramkragten
Copy link
Member

No worries, was just checking!

Thanks!

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 Feb 27, 2024
@ildar170975
Copy link
Contributor Author

please do not close

@github-actions github-actions bot removed the stale label Feb 27, 2024
@silamon silamon marked this pull request as draft April 27, 2024 09:10
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 Jul 26, 2024
@ildar170975
Copy link
Contributor Author

please do not close

@github-actions github-actions bot removed the stale label Jul 26, 2024
@typxxi
Copy link

typxxi commented Sep 2, 2024

I also wanna see this feature implemented cause it would help me big times.

I have spent over 1 day cause my studio code server has failed big times and did not save really. And when it saved the reboot stopped without telling and went to an older yaml without telling me. Big mess while testing a very complex picture page with a lot of elements in that for each single string of the solar power system.

@ildar170975 ildar170975 marked this pull request as ready for review September 5, 2024 17:37
Copy link
Contributor

coderabbitai bot commented Sep 5, 2024

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes made to the developer tools panel involve updates to CSS styles that enhance the layout and usability of the interface. New rules were added to control the dimensions and behavior of components like the code mirror and spinner, ensuring a more structured and responsive design without altering any exported or public entity declarations.

Changes

Files Change Summary
src/panels/developer-tools/template/developer-tools-template.ts Introduced new CSS styles for .content.horizontal, modified .horizontal .edit-pane, and updated .render-spinner for improved layout and usability.

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ildar170975
Copy link
Contributor Author

ildar170975 commented Sep 5, 2024

One more try:

image

@silamon
Copy link
Contributor

silamon commented Sep 24, 2024

This suggestion doesn't work with smaller screens. The content jumps out of the card.
Have you experimented with the resize css variable?

@ildar170975
Copy link
Contributor Author

This suggestion doesn't work with smaller screen

Can you tell me with which screen you faced issue?
I will check it within a few days.

@silamon
Copy link
Contributor

silamon commented Sep 27, 2024

Resolution 1400px * 600px should be enough to reproduce.

@ildar170975
Copy link
Contributor Author

ildar170975 commented Oct 2, 2024

A 2nd scrollbar will be shown if needed. Not the most elegant solution but it works.

@wendevlin
Copy link
Contributor

Hi @ildar170975,
Let's finish this PR 🙂

Lets sum it up what we want: on desktop the editor and preview should be scrollable for easier editing.

What is still to do:

  • why does the parent panes become scrollable?
    • You just have to make the editor and preview panels sync size, if the preview pane is higher then the editor it is fine and I would avoid the 2nd scrollbar because it leads to bad UX.

I made some suggestions on how you can implement it.

@ildar170975
Copy link
Contributor Author

ildar170975 commented Oct 15, 2024

@wendevlin
Hi! Thanks a lot for a feedback.
Not sure that I got your point properly.

Earlier (w/o the last commit) what I achieved was:

  1. The editor's height in horizontal layout has some maximum height (--code-mirror-max-height).

  2. The left pane (containing the editor) has some max-height (to occupy a remaining vertical space):
    image

But there is a case when "listening entities" area causing an overflow:
image
This I tried to solve by

        .content.horizontal .render-pane {
          overflow-y: auto;
        }

and agree that this 2nd scrollbar is ugly.

Ideas what I considered:

  1. Make the "listening entities" area scrollable: i.e. a height of a "listening entities" area is fixed, and a height of the "results" pane (render-spinner) is as big as possible - to make analysing the "results" easier.
  2. Alternatively: a height of the "listening entities" area is dynamic, and thus a height of the "results" pane (render-spinner) may decrease if needed. This variant I do not like - in some cases the "results" pane may become low.

@wendevlin
Copy link
Contributor

@ildar170975 Have you tried out my suggestions?

I think you also have to edit:

.edit-pane {
    direction: var(--direction);
    height: 100%;
}

@ildar170975
Copy link
Contributor Author

@wendevlin

Have you tried out my suggestions?

If by "suggestions" you mean
image
then I need some clarifications which I tried to express in my post.
There are no comments in the code...

I tried to add

.edit-pane {
    direction: var(--direction);
    height: 100%;
}

But it probably requires other alterations.

Can you explain me what a purpose of adding direction: var(--direction); to .edit-pane?
Is it about LTR? Imho it is already processed in a parent element.

Comment on lines 338 to 354
.render-pane {
max-width: 100%;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.render-pane {
max-width: 100%;
.content ha-card {
max-width: 100%;

@ildar170975 ildar170975 force-pushed the dev_tools_templates_scrollbar branch from 5e22cb2 to e45c674 Compare November 19, 2024 16:00
@wendevlin
Copy link
Contributor

Hi @ildar170975,
do you want to continue on this?
What do you say to my last comment, would this be ok for you. It is not all on one page, but all important information.

@ildar170975
Copy link
Contributor Author

@wendevlin
Hi! Thanks for not forgetting!
These months I have a very rare access to PC thanks to the war. Trying my best on Community via mobile.
Definitely will come back to this PR.
Thanks for supporting!

@wendevlin
Copy link
Contributor

@wendevlin

Hi! Thanks for not forgetting!

These months I have a very rare access to PC thanks to the war. Trying my best on Community via mobile.

Definitely will come back to this PR.

Thanks for supporting!

Ok thanks for the update. Take care and all the best!

@wendevlin wendevlin marked this pull request as ready for review December 10, 2024 09:10
@home-assistant home-assistant bot requested a review from wendevlin December 10, 2024 09:10
Copy link
Contributor

@wendevlin wendevlin left a comment

Choose a reason for hiding this comment

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

This is a good state now, let's merge 🙂

@wendevlin wendevlin merged commit d1c981b into home-assistant:dev Dec 10, 2024
15 checks passed
@ildar170975
Copy link
Contributor Author

ildar170975 commented Dec 10, 2024

@wendevlin
I honestly have not completed yet, playing with it right now, give me some time please.
Your last suggestion still in progress.

@ildar170975 ildar170975 deleted the dev_tools_templates_scrollbar branch December 10, 2024 10:59
boern99 pushed a commit to boern99/ha_frontend that referenced this pull request Dec 11, 2024
…ft & right panels for large screens (home-assistant#17765)

* Update developer-tools-template.ts

* Update developer-tools-template.ts

* fix overflow

* Update src/panels/developer-tools/template/developer-tools-template.ts

Co-authored-by: Wendelin <[email protected]>

* Update src/panels/developer-tools/template/developer-tools-template.ts

Co-authored-by: Wendelin <[email protected]>

* Update developer-tools-template.ts

* Update src/panels/developer-tools/template/developer-tools-template.ts

Co-authored-by: Wendelin <[email protected]>

* Update developer-tools-template.ts

* prettier

* Update developer-tools-template.ts

* Update developer-tools-template.ts

* prettier

* Update developer-tools-template.ts

* prettier

* prettier

* Update developer-tools-template.ts

* prettier

* prettier

* prettier

* Update developer-tools-template.ts

---------

Co-authored-by: Wendelin <[email protected]>
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.

7 participants