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

Make app responsive and toggle sidebar #533

Merged
merged 19 commits into from
Sep 13, 2024
Merged

Make app responsive and toggle sidebar #533

merged 19 commits into from
Sep 13, 2024

Conversation

sejas
Copy link
Member

@sejas sejas commented Sep 13, 2024

Proposed Changes

  • Create a new top bar
  • Move Authentication buttons to that top bar
  • Move offline indicator to the TopBar
  • Add a new button to toggle the sidebar
  • Fix tests (I'll move the topbar tests to its own file)

Testing Instructions

  • Run npm start
  • Observe a new top bar
  • Click in the first icon
  • Observe the app reduces its size and the sidebar disappears
  • Change tabs and observe the UI doesn't break.
  • Click again on the leftDrawer icon in the topbar and observe the app displays the sidebar and the window restores it's previous size.
  • If possible test in Mac and Windows.

Mac

responsive-studio.mp4

Windows

q4uVLd.mp4

Offline indicator

Screenshot 2024-09-13 at 09 06 07 Screenshot 2024-09-13 at 09 06 05

Pre-merge Checklist

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

@sejas sejas self-assigned this Sep 13, 2024
@sejas sejas requested review from a team and matt-west September 13, 2024 06:48
@sejas
Copy link
Member Author

sejas commented Sep 13, 2024

@wojtekn , are you ok merging this? or would you prefer to add it behind a feature flag?

In my opinion the responsive is an independent feature from the Assistant, the same way the float on top is already released.

@matt-west
Copy link
Contributor

Nice work @sejas! I was only able to test it on Mac, but spotted a few minor things.


Is it possible to centre the icons in the top bar with the window controls?

Screenshot 2024-09-13 at 14 32 22

Can you increase the height of the user element in the top bar to 24px so it matches the height of the help icon when hovered.

Screenshot 2024-09-13 at 14 33 21

The user avatar and help icon should be closer together. The avatar is also missing the white outline.

Current Design
Screenshot 2024-09-13 at 14 40 46 Screenshot 2024-09-13 at 14 41 30

When the offline icon is displayed, the header bar gets taller.

Screen.Recording.2024-09-13.at.14.35.38.mov

Is it possible to automatically collapse the sidebar if the user tries to resize the window below the min-width? (Totally fine to tackle this in a separate PR if needed.)

Screen.Recording.2024-09-13.at.14.46.20.mov

@wojtekn
Copy link
Contributor

wojtekn commented Sep 13, 2024

I've tested it on macOS. Looks great! I noticed some issues:

  • layout shift between authenticated and logged-out state (mentioned by Matt above, too)
  • The Import / Export tab got a scrollbar as we reduced window height. Could we slightly reduce the import box height to avoid that? @matt-west
  • when I have wide Studio window, and I hide the scrollbar, it hides the scrollbar but uses the minimum width. I expect it will use the previous width with the subtracted sidebar width

I will test it on Windows soon.

In my opinion the responsive is an independent feature from the Assistant, the same way the float on top is already released.

It makes sense. Let's release it for all users.

@matt-west
Copy link
Contributor

The Import / Export tab got a scrollbar as we reduced window height. Could we slightly reduce the import box height to avoid that?

Yep. Reducing the height to h-36 should fix the scrolling issue.

@wojtekn
Copy link
Contributor

wojtekn commented Sep 13, 2024

It works well on Windows, with the following issues:

  • minimum window width is used when I hide the scrollbar, regardless of my window width, similarly to macOS behavior
  • when I hide the scrollbar, it is hidden smoothly with animation, but the window size changes rapidly. On macOS, it works smoothly, too. If it's not quick fix, we could fix this as a follow-up, though.

User logged in:

Zrzut ekranu 2024-09-13 161108

Use logged out:
Zrzut ekranu 2024-09-13 161125

Sidebar hidden:
Zrzut ekranu 2024-09-13 161054

@sejas
Copy link
Member Author

sejas commented Sep 13, 2024

@wojtekn , @matt-west , thanks for reviewing the PR. I've fixed everything you mentioned.

when I have wide Studio window, and I hide the scrollbar, it hides the scrollbar but uses the minimum width. I expect it will use the previous width with the subtracted sidebar width

I've implemented the memory size for both states, with and without sidebar, but this behaviour can conflict if/when we implement the window manual resizing:

Is it possible to automatically collapse the sidebar if the user tries to resize the window below the min-width? (Totally fine to tackle this in a separate PR if needed.)

We could need a bit of discussion about making the window responsive by resizing it. It's possible, and it makes sense to me. But it seems incompatible combined with saving the previous width.
My understanding of the manual resizing is that when a user makes the window smaller than the "minimum" size, the sidebar will disappear and when the user makes it bigger than the minimum size, then the sidebar will appear automatically. But what should happen when the user clicks on the button?. I think in that case we shouldn't save any previous width and just use the smallest width possible for each state.

I'll merge this PR and if we find new bugs or enhancements, we can open new PRs/issues. Thank you!

@sejas sejas merged commit 5542c97 into trunk Sep 13, 2024
10 checks passed
@sejas
Copy link
Member Author

sejas commented Sep 14, 2024

@wojtekn , @matt-west , in fact Wojtek's suggestion was simpler and it's totally compatible to automatically displaying/hiding the sidebar on window resize. Check the PR below.

when I have wide Studio window, and I hide the scrollbar, it hides the scrollbar but uses the minimum width. I expect it will use the previous width with the subtracted sidebar width

I misunderstood this explanation thinking to keep the size memory, but you actually were suggesting a simpler workflow. 👌

I've created a PR applying your approach and Matt's suggestion.

Is it possible to automatically collapse the sidebar if the user tries to resize the window below the min-width? (Totally fine to tackle this in a separate PR if needed.)

Done! 🥳 Let me know what you think:

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