Allow resizing Branch and Push/Pull toolbar buttons#18095
Allow resizing Branch and Push/Pull toolbar buttons#18095tidy-dev merged 18 commits intodesktop:developmentfrom jpedroso:resizable-branch-dropdown-button
Conversation
app/src/ui/toolbar/dropdown.tsx
Outdated
There was a problem hiding this comment.
Required to correctly place the dropdown below its toolbar button.
There was a problem hiding this comment.
Changing the default properties of the foldout style here might not be the best approach. I’m thinking the branch dropdown should instead provide its own foldoutStyle similar to what the sidebar dropdown has.
app/styles/ui/_branches.scss
Outdated
There was a problem hiding this comment.
Replace the fixed width with minimum width so the branch toolbar dropdown always has at least 365px. If the toolbar button is wider than that, allow it to fill the same width.
app/styles/ui/_branches.scss
Outdated
There was a problem hiding this comment.
Replace the fixed width and allow the branch list to fill the dropdown container (.branches-container).
app/styles/ui/_branches.scss
Outdated
There was a problem hiding this comment.
Center the empty state content of the Pull Requests tab in the dropdown container, and give its imagery some spacing vertically.
Read more about the why center empty states below in the Branches tab empty state comments.
app/styles/ui/_no-branches.scss
Outdated
There was a problem hiding this comment.
Both for the Branches and Pull Requests empty states, I decided to keep the fixed width of 365px instead of letting the imagery, text and button expand to fill the container. Specifically, in the case of Branches tab, the Create New Branch could get uncomfortably wide. See comparison below.
Full width empty state
Fixed width empty state
app/styles/ui/toolbar/_toolbar.scss
Outdated
There was a problem hiding this comment.
Prevent shrinking the dropdown arrow button. Keep them always pinned to the right.
app/styles/ui/toolbar/_toolbar.scss
Outdated
There was a problem hiding this comment.
Apply flexible width on the Branch and Push/Pull toolbar buttons.
There was a problem hiding this comment.
There’s another button just below named .revert-progress also with fixed width.
&.revert-progress {
width: 230px;
}
I believe this button should also change to width: 100%; but haven’t yet found a way to get to a state where the button shows to confirm. Any ideas welcome.
There was a problem hiding this comment.
This is seen when reverting a commit in a git LFS repo in which reverting a commit is very slow. Thus, this does need addressed. We can follow up with another PR since Git LFS is not a common usage and the likely hood that this would result in a negative experience is slim (worse case during loading the last toolbar button switches to 230px which could only be a clipping problem on a very small zoomed in screen). The RevertProgress toolbar button is rendered instead of the PullPushFetch so we can send the dimensions for the PullPushFetch button down to it.
|
@jacortinas @sergiou87 Hello, can we hope to get that feature in? Any plans? |
|
@steveward @tidy-dev will this pr get any attention? i ask because i found one layout problem with it -- the branch list grows beyond desired size when the current branch name is long enough, for which i can’t seem to find a quick fix --, but i will not put any more time into this if this just ends up stalled here. |
|
@jpedroso Sorry for the delay and thank you for your patience. I cannot say a timeline, but I am interested in reviewing this. If you can find time to address the problem found that would be fantastic, (and if so, also updating this with the latest development would be awesome). Thank you for your time and patience on this. |
Prevents the dropdown arrow button from shrinking when the window or toolbar items are resized.
Set a new constrained value for the branch dropdown so it can only be as wide as the available space after taking the sidebar and pull fetch button widths. The minimum size remains constant at its default width.
Instead of using a hardcoded max width of 600 and the default min width of 200, the branch dropdown resizable now uses the min and max that are provided with the constrained value.
This local var needs to reflect that some of the toolbar buttons are now resizable, and what is represents the total min width of those buttons.
Replace the inline hardcoded value with a constant defined closer the other toolbar constants.
More consistent with the `PushPullButton` type they relate to.
When there are no branches or pull requests to show, the corresponding empty states are centered on the container with a fixed width of 365px. For the branches empty state container, the fixed width replaces `flex: 1` to prevent it from filling the container and make the Create Branch button too wide.
Prevents the branches dropdown container from becoming too narrow when branch names are not long enough.
With the empty states centered on the container, their imagery would get uncomfortably close to the top. This introduces some spacing on top and bottom to make layout more balanced.
Branch names can expand to the available width in `.branches-list-item`.
Introduce the new property to avoid changing behavior of the existing `foldoutStyle` property. Whereas `foldoutStyle` replaces default style entirely, `foldoutStyleOverrides` is used to add to or override the default style properties.
|
@tidy-dev i fixed the remaining known issue, quoted below. also rebased with latest
Tried many things but couldn’t fix the issue entirely in stylesheets, so the way i fixed this was to pass additional style properties for the default styles that get returned in Here’s the before and after when having a long branch name. Before (6657053)After (9d7df28) |
There was a problem hiding this comment.
@jpedroso Thank you for this PR and apologies for taking so long to review.
It works beautifully. 💖
I kicked it around quite a bit and found an accessibility issue where on the min width screen and max zoom the fetch dropdown button was being clipped. Thus, I updated this to latest dev and added changes to make the branch dropdown and pull/push split the difference of the available screen width when it gets this limited size. Due to that I am going to get another engineer to review this before merging.
I also found that on max zoom and smallest windows, the branch list and pr list is clipped, but it is in production too.. just not as much so I don't think this PR should be held back because of it.
|
Going to go ahead and merge. Tho we did discuss and decided we would like it behind a feature flag as it is such a prominent part of the app so we can have it on beta for a bit. I have got a working branch for that and will open a PR up shortly. It also addresses applying this logic to the revert commit toolbar button (which only applies to git LFS repos and only when reverting) |
|
@tidy-dev glad this is finally picked up. |




Closes #4569
Closes #17388
Description
Allow the user to resize the Branch and Push/Pull toolbar buttons, and their dropdown panels.
Both buttons have a minimum width of
230px, same as the sidebar. The max width of each button is determined by the available space in the toolbar after taking out the sidebar, minus the other button’s width. This is controlled byIConstrainedValuevalues and determined inupdateResizableConstraints().If the user-defined width of both buttons is wider than the toolbar's available width the Branch toolbar button takes precedence over the Push/Pull button. For example, when the window resizes, the Push/Pull button’s width is reduced before the Branch button’s.
Like the sidebar, their width can be reset to the original value (
230px) with a double-click on the resizable edge.The dropdown panels of each button follow the width of the button. The Branches/Pull Requests dropdown has a minimum width of 365px—the previous fixed width—to avoid the panel getting too narrow if the branches names are not long enough.
The empty states for the Branches and Pull Requests tabs are adjusted to the flexible width. They are now centered in the container. Decided to give them a fixed width of
365px, same as previous size, to maintain the aspect of their contents. Letting them flex to full width would make the imagery scale too much and the call to action button quite wide.Screenshots
Walkthrough of resizing the Branch and Push/Pull toolbar buttons, Branches/PR dropdown and empty states
2024-01-28-002293.mp4
Branches dropdown empty state
Minimum window size and maximum zoom
Max zoom, branches dropdown empty state
Release notes
Allow the user to resize the Branches and Push/Pull toolbar buttons.