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

Allow resizing Branch and Push/Pull toolbar buttons #18095

Open
wants to merge 16 commits into
base: development
Choose a base branch
from

Conversation

jpedroso
Copy link

@jpedroso jpedroso commented Jan 28, 2024

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 by IConstrainedValue values and determined in updateResizableConstraints().

  • 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

2024-01-28-002297@2x

Minimum window size and maximum zoom

2024-01-28-002295@2x

Max zoom, branches dropdown empty state

2024-01-28-002296@2x

Release notes

Allow the user to resize the Branches and Push/Pull toolbar buttons.

@jpedroso jpedroso changed the title Resizable Branches and Push/Pull toolbar buttons Allow resizing Branch and Push/Pull toolbar buttons Jan 28, 2024
@jpedroso jpedroso force-pushed the resizable-branch-dropdown-button branch from f379c37 to b554ec1 Compare January 28, 2024 20:22
Comment on lines -355 to +368
position: 'absolute',
position: 'fixed',
Copy link
Author

Choose a reason for hiding this comment

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

Required to correctly place the dropdown below its toolbar button.

Copy link
Author

@jpedroso jpedroso Jan 29, 2024

Choose a reason for hiding this comment

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

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.

width: 365px;
min-width: 365px;
width: 100%;
Copy link
Author

Choose a reason for hiding this comment

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

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.

width: 365px;
width: 100%;
Copy link
Author

Choose a reason for hiding this comment

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

Replace the fixed width and allow the branch list to fill the dropdown container (.branches-container).

@@ -198,6 +199,7 @@

.no-pull-requests {
width: 365px;
margin: var(--spacing) auto;
Copy link
Author

Choose a reason for hiding this comment

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

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.

Comment on lines +2 to -3
width: 365px;
margin: var(--spacing) auto;
display: flex;
flex: 1;
Copy link
Author

Choose a reason for hiding this comment

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

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

2024-01-28-002298@2x

Fixed width empty state

2024-01-28-002299@2x

}
&.revert-progress {
width: 230px;
}
&.toolbar-dropdown-arrow-button {
width: 39px;
flex-shrink: 0;
Copy link
Author

Choose a reason for hiding this comment

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

Prevent shrinking the dropdown arrow button. Keep them always pinned to the right.

Comment on lines -36 to +42
width: 230px;
width: 100%;
}
}

.toolbar-button {
&.branch-toolbar-button {
width: 230px;
width: 100%;
Copy link
Author

Choose a reason for hiding this comment

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

Apply flexible width on the Branch and Push/Pull toolbar buttons.

Copy link
Author

@jpedroso jpedroso Jan 28, 2024

Choose a reason for hiding this comment

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

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.

@chronvas
Copy link

@jacortinas @sergiou87 Hello, can we hope to get that feature in? Any plans?

@jpedroso jpedroso force-pushed the resizable-branch-dropdown-button branch 2 times, most recently from 81c707e to 3fca175 Compare February 23, 2024 08:59
@jpedroso
Copy link
Author

@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.

@tidy-dev
Copy link
Contributor

@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.
@jpedroso jpedroso force-pushed the resizable-branch-dropdown-button branch from 3fca175 to 9d7df28 Compare May 10, 2024 10:32
@jpedroso
Copy link
Author

@tidy-dev i fixed the remaining known issue, quoted below. also rebased with latest development. this is now ready for proper review.

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

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 ToolbarDropdown.getFoldoutStyle(). I decided to preserve the existing functionality of foldoutStyle since it can be used to replace the default style entirely, and instead create a new property that adds to the default style, called foldoutStyleOverrides. Tried to convey this idea in the documentation best i could.

Here’s the before and after when having a long branch name.

Before (6657053)

2024-05-10-002917@2x

After (9d7df28)

2024-05-10-002916@2x

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