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

Sidebar intelligent responsive show/hide it when crosses the breakpoint #536

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

sejas
Copy link
Member

@sejas sejas commented Sep 14, 2024

Related to:

Proposed Changes

  • Show/Hide sidebar when the window size crosses the breakpoint (900px).
  • Set the minimum window size to: 652 (DEFAULT_WIDTH - SIDEBAR_WIDTH + 20px of padding).
  • Add/Substract only sidebar width, avoiding resizing the window dramatically.

Testing Instructions

Regular Case:

  • Run npm start
  • Click on the leftDrawer icon in the topbar
  • Observe the app width reduces to the minimum (652px)
  • Instead of clicking on the "expand" button, let's resize the window by clicking in the bottom right corner and dragging it to make it bigger
  • Observe the sidebar appears
  • Now resize the window to make it smaller than 900px
  • Observe the sidebar disappears
  • Repeat and observe everything works correctlty, the resizing and the button.

Second case:

  • Now make the window bigger, the sidebar should be there.
  • Click on the button to make the hide sidebar
  • Resize the window, but keep the width bigger than 900px
  • Observe the sidebar is hidden all the time
  • Now make it smaller than 900px and increase the width.
  • Observe the sidebar correctly appears.

Check this video, and let me know what you think.

4qWIWj.mp4

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@sejas sejas requested review from matt-west and a team September 14, 2024 14:39
@sejas sejas self-assigned this Sep 14, 2024
@sejas sejas changed the title Siebar intelligent responsive show/hide it when crosses the breakpoint Sidebar intelligent responsive show/hide it when crosses the breakpoint Sep 14, 2024
@sejas
Copy link
Member Author

sejas commented Sep 14, 2024

@wojtekn , @matt-west , I think you will love this PR 😉 .

@wojtekn
Copy link
Contributor

wojtekn commented Sep 16, 2024

This is awesome @sejas ! 🔥

Copy link
Contributor

@wojtekn wojtekn left a comment

Choose a reason for hiding this comment

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

It works well on Mac and Windows.

I noticed one small thing I'm not sure about. When I make the Studio window wide, then close the sidebar, and make it narrow and wide again, the sidebar reappears.

Should we save a session flag when the user closes the sidebar deliberately so we won't show it again when they resize the window back and forth?

@sejas
Copy link
Member Author

sejas commented Sep 16, 2024

I noticed one small thing I'm not sure about. When I make the Studio window wide, then close the sidebar, and make it narrow and wide again, the sidebar reappears.

Should we save a session flag when the user closes the sidebar deliberately so we won't show it again when they resize the window back and forth?

I think it's more clear if the resize toggles the sidebar every time it crosses the breakpoint. If we disable it, it would be like having "button/feature" that sometimes doesn't work, for some reason.
If it works all the time, user can press the left drawer button again.

I'll merge this PR, but if you decide that the button should "disable/override" the resizing action, then I'll be happy to create another PR.

@sejas sejas merged commit f0b64c7 into trunk Sep 16, 2024
10 checks passed
@sejas sejas deleted the update/siebar-intelligent-responsive branch September 16, 2024 12:46
@wojtekn
Copy link
Contributor

wojtekn commented Sep 16, 2024

Makes sense @sejas , thanks for sharing your perspective.

@matt-west
Copy link
Contributor

Nice work @sejas, this is super cool!

When I make the Studio window wide, then close the sidebar, and make it narrow and wide again, the sidebar reappears.
Should we save a session flag when the user closes the sidebar deliberately so we won't show it again when they resize the window back and forth?

I agree with @wojtekn here. We should remember if the user previously closed the sidebar and not re-open it automatically when they resize the window. This is consistent with the behaviour of Apple apps like Notes.

Screen.Recording.2024-09-16.at.14.33.08.mov

Copy link

sentry-io bot commented Sep 18, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ Error: Failed to delete local files <anonymous>(renderer/main_window/studio/./src/h... View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants