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

chore: use dropdownmenu component for always on buddy widget popup menu #8269

Conversation

gastoner
Copy link
Contributor

@gastoner gastoner commented Jul 30, 2024

What does this PR do?

Use DropDownMenu component for always on Buddy widget popup menu

Screenshot / video of UI

Before:

Screen.Recording.2024-07-30.093023.mp4

After:

Screen.Recording.2024-07-31.130244.mp4

What issues does this PR fix or reference?

Closes #6660

How to test this PR?

Try to open account in the NavBar

  • Tests are covering the bug fix or the new feature

@gastoner
Copy link
Contributor Author

gastoner commented Jul 30, 2024

There are a frew things that needs to be fixed:

  1. The NavBar and the DropdownMenu has their own button
  2. The onhover thing on nav bar is blocking the DropDownMenuItems => solved by changing z-10 to z-20 in DropDownMenuItems
  3. Once clicked the Account NavBar / DropdownMenu => screen will go to unknown page? => solved by onClick={() => {}}
    Any ideas how to fix this 1?

@gastoner gastoner force-pushed the use_dropdownmenu_component_for_always_on_buddy_widget_popup_menu branch from b035270 to 4c81596 Compare July 30, 2024 11:11
@deboer-tim
Copy link
Contributor

There are a frew things that needs to be fixed:

  1. The NavBar and the DropdownMenu has their own button
  2. The onhover thing on nav bar is blocking the DropDownMenuItems => solved by changing z-10 to z-20 in DropDownMenuItems
  3. Once clicked the Account NavBar / DropdownMenu => screen will go to unknown page? => solved by onClick={() => {}}
    Any ideas how to fix this 1?

I haven't looked in any detail, but I'd guess you're going to have to make the NavItem natively support dropdown/selection instead of putting a dropdown inside of it. That would solve 1 & 3 (nav item wouldn't trigger a url in this case, it would trigger the drop down).

For 2, changing the z order isn't enough/not the right fix because you'd have a tooltip partially hidden under a menu. But again, the same solution above would fix this too.

@dgolovin
Copy link
Contributor

There are issues that prevents to use DropDownMenu component for the Buddy NavItem. I Would suggest to fix them with different PRs to make it easier to review.

This pr should be straight forward:

  • expose 'getAccountsMenuInfo'
  • in AuthActions iterate over array of menuInfo items to build DropDownMenu

@dgolovin
Copy link
Contributor

There should be the issues opened for DropDownMenu:

  1. It should let to attach DropDownMenu to existing element so there would be no second button
  2. The placement of DropDownMenu should be fixed, right now it is always shown on the left of element it attached to.
  3. (optional) Extreme use cases, like what if there are so many items the DropDownMenu does not fit into the window.

@gastoner gastoner force-pushed the use_dropdownmenu_component_for_always_on_buddy_widget_popup_menu branch from 4c81596 to 4810491 Compare July 31, 2024 08:49
@gastoner
Copy link
Contributor Author

This pr should be straight forward:
expose 'getAccountsMenuInfo'

There is no need to expose the getAccountsMenuInfo since there is already a variable containing the array of providers (the same thing is done somewhere else in the code)

in AuthActions iterate over array of menuInfo items to build DropDownMenu

This is fixed in current commit

@gastoner
Copy link
Contributor Author

gastoner commented Jul 31, 2024

There should be the issues opened for DropDownMenu:

  1. It should let to attach DropDownMenu to existing element so there would be no second button
  2. The placement of DropDownMenu should be fixed, right now it is always shown on the left of element it attached to.
  3. (optional) Extreme use cases, like what if there are so many items the DropDownMenu does not fit into the window.
  1. I've removed the DropdownMenu element (but left the DropDownMenuItems) which removed the redundant button
  2. So create a new issue/PR for changes in DropDownMenuItems.svelte (left/right alignment)
  3. For this would be required to change some top/bottom paddings in DropDownMenuItems.svelte

@gastoner gastoner force-pushed the use_dropdownmenu_component_for_always_on_buddy_widget_popup_menu branch 3 times, most recently from e35808f to c556038 Compare July 31, 2024 11:01
Copy link
Contributor

@axel7083 axel7083 left a comment

Choose a reason for hiding this comment

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

I would recommend to ease the review to move the changes of DropDownMenuItems.svelte and DropdownMenu in a separate PR with a dedicated test

@axel7083
Copy link
Contributor

axel7083 commented Jul 31, 2024

cc @benoitf you are assign to #7758, is there a risk of conflict/overlap here?

From #7758
Users should be able to right-click on the navigation bar to see a list of all navigation items in a checkbox list, and easily add or remove the visible items.

This may have some similarity with this PR goals, at least for the changes in the NavItem

@benoitf
Copy link
Collaborator

benoitf commented Jul 31, 2024

@axel7083 I see no overlap as right click is/will not be handled by the svelte dropdown menu (it's based on electron right clicks menu)

only left click should/are using svelte components.

@gastoner gastoner self-assigned this Aug 5, 2024
@gastoner gastoner marked this pull request as ready for review August 5, 2024 16:44
@gastoner gastoner requested a review from a team as a code owner August 5, 2024 16:44
@gastoner gastoner requested review from cdrage and removed request for a team August 5, 2024 16:44
@gastoner gastoner requested review from a team and slemeur as code owners August 5, 2024 17:25
@gastoner gastoner force-pushed the use_dropdownmenu_component_for_always_on_buddy_widget_popup_menu branch from f300206 to f8a46ab Compare August 5, 2024 17:27
@gastoner gastoner requested a review from axel7083 August 6, 2024 05:51
Copy link
Contributor

@dgolovin dgolovin left a comment

Choose a reason for hiding this comment

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

image

The text for sign out item should include Authentication Provider label, because the same email can be used with different providers and it would not be possible to distinguish github account from Red Hat SSO.

Sign out of Red Hat SSO ([email protected])

Would look better.

@gastoner gastoner force-pushed the use_dropdownmenu_component_for_always_on_buddy_widget_popup_menu branch 2 times, most recently from d736396 to 6711fff Compare August 8, 2024 04:47
Copy link
Contributor

@dgolovin dgolovin left a comment

Choose a reason for hiding this comment

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

Sign in request is now show as

image

but should be

image

@gastoner gastoner force-pushed the use_dropdownmenu_component_for_always_on_buddy_widget_popup_menu branch from 6711fff to 7ec6166 Compare August 8, 2024 05:22
@gastoner
Copy link
Contributor Author

gastoner commented Aug 8, 2024

Sign in request is now show as

image

but should be

image

I've forgot to add it also to sign-in :D

@gastoner gastoner requested a review from dgolovin August 8, 2024 07:48
@gastoner
Copy link
Contributor Author

gastoner commented Aug 8, 2024

I have discussed this with @axel7083 and we have come to a point where we need to decide which options would be best, either this ^^ or this one which uses the DropdownMenu and is neater, but have a few drawbacks:

  1. The Account NavItem is slightly taller than it should be
  2. The DropDownMenuItems will be only opened when is clicked on the AccountImage

What do you think? More complex (This PR ^^) or more neater solution (this one) Thanks 🙏 @benoitf @deboer-tim @jeffmaury

@dgolovin
Copy link
Contributor

dgolovin commented Aug 9, 2024

I have discussed this with @axel7083 and we have come to a point where we need to decide which options would be best, either this ^^ or this one which uses the DropdownMenu and is neater, but have a few drawbacks:

1. The `Account NavItem` is slightly taller than it should be

2. The `DropDownMenuItems` will be only opened when is clicked on the `AccountImage`

What do you think? More complex (This PR ^^) or more neater solution (this one) Thanks 🙏

Buddy icon spacing is the same in both branches. It is slightly bigger because of two 'Tooltip' component nested one in another. One comes from NavItem another one wrapping AuthActions. The second PR has different behavior on DropdownMenu cancellation using keybord. That is the only difference I see.

On the other hand it seems that Dropdown Menu on buddy icon just duplicates Authentication settings page features in a form of dropdown menu. We might consider just move Authentication out of preferences and show it when user clicks on buddy icon.

@dgolovin dgolovin dismissed their stale review August 9, 2024 05:13

There are other options to consider.

@gastoner gastoner requested a review from feloy August 22, 2024 10:07
Copy link
Contributor

@feloy feloy left a comment

Choose a reason for hiding this comment

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

Works as expected
LGTM

@gastoner gastoner force-pushed the use_dropdownmenu_component_for_always_on_buddy_widget_popup_menu branch from 7ec6166 to a1aff7a Compare August 26, 2024 11:35
Copy link
Contributor

@dgolovin dgolovin left a comment

Choose a reason for hiding this comment

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

Tested with multiple extensions adding requests for authentication.
LGTM

@gastoner gastoner merged commit c9d2c3f into containers:main Aug 27, 2024
7 checks passed
@podman-desktop-bot podman-desktop-bot added this to the 1.13.0 milestone Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🚥 In Review
Development

Successfully merging this pull request may close these issues.

Use DropDownMenu component for always on Buddy widget popup menu
7 participants