-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[#55581] popover for user information on hover #17255
[#55581] popover for user information on hover #17255
Conversation
1f5454c
to
4653b53
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @EinLama
as discussed, the amount of cards feels rather annoying. I'd like the challenge the requirement that the card should really be shown all the time. Alternatively, the delay must be larger. But that has to be discussed with the product team.
Until then, here are the first findings from clicking through:
- Hovering a placeholder user leads to an error
- As a non-admin user, there is an error as well due to a missing permission
- Opening the share modal on a WP creates a black overlay
- When the LogTime modal on a WP is opened, and the user dropdown is opened: Hovering the avatar, will close the logTime modal
- The emailAdress is supposed to smaller (12px)
- When having a very long name, it overflows the card without truncation or wrapping:
- When the hovercard is opened at the very bottom of the page, it closes immideatly
Bildschirmaufnahme.2024-11-22.um.14.55.49.mov
For the record, there are some places where the card is not shown yet. But as said above, I'd wait until the decision of the product team
- Team planner module
- Admin/user table
- Project overview / project attribute of type user
- Project activity page
- Users page (
/users/:id
) - My Page / News widget
- Multi-User custom field
f3869f7
to
95183a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like you could save a lot of code by turning the default for the hoverCards to true
. Is there a reason it is set to false
?
# or | ||
# "Member of group1, group2 and 3 more" | ||
# The latter string is cut off since the complete list of group names would exceed the allowed `max_length`. | ||
def group_membership_summary(max_length = 40) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the value 40 coming from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A true magic number 🔮🧙🏻♂️ found by, uh... guessing and trying it out! 🪄
Seemed sensible when used with the English translation and should look okay with most other languages. The caveat is that only the group names are considered when deciding where to shorten the list. To make it perfect, we'd have to load the translation first, factor it's length into the calculation and THEN decide where to cut off the group list. I figured the value 40
is good enough in most cases and strikes a balance between pleasant looks and code complexity :)
@@ -48,7 +48,7 @@ export class UserDisplayField extends DisplayField { | |||
element, | |||
this.attribute, | |||
{ hide: false, link: false }, | |||
{ hide: false, size: 'medium' }, | |||
{ hide: false, size: 'medium', hoverCard: { url: this.attribute.url } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ESLint is somehow complaining correctly here.this.attribute
can be anything, so we do not know for sure whether a url
is defined. Ideally this case would at least be catched before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were other issues with this class, unrelated to this PR. I have made an attempt at fixing them. The compiler is happy, so far is the runtime. Will observe if this causes problems somewhere in the application.
frontend/src/app/core/setup/globals/global-listeners/hover-card-trigger.service.ts
Outdated
Show resolved
Hide resolved
frontend/src/app/shared/components/principal/principal-renderer.service.ts
Outdated
Show resolved
Hide resolved
frontend/src/app/shared/components/principal/principal-renderer.service.ts
Outdated
Show resolved
Hide resolved
709ca64
to
eba7ab8
Compare
Thank you, @HDinger. I have fixed most of the issues and findings. I found another place that triggers erratic behavior:
|
00addee
to
6ce763e
Compare
It is closer to what we want to achieve.
This is only a draft since the links are still missing. But it gives a good first impression of what's to come.
We might have to patch a bigger possible size here later, the default size is currently the biggest and it looks a bit lost in the hover card.
Previously, it was attached to the wrapper, which led to weird behavior. With the new approach, it looks more natural while fitting the design better. Sneaked in some improvements such as using the hover card path helper.
compressed via ImageOptim
This was a hard one to debug. When you hover over an avatar as soon as the page loads, you will hover over the fallback first. Within the timeout, the actual avatar image loads and replaces the fallback. After that, the timeout of the hover trigger runs out and displays the hover cards, but does no longer have an element to position relative to. So, we check for the existence of the hovered element before showing a hover card to fix this.
e6aca92
to
8a1f7b9
Compare
If you quickly move from one hover target to the next, we know reset the hover card component into the correct state so that you can open the next hover card. Just keep hovering.
gap: 1rem | ||
overflow: hidden | ||
|
||
.op-user-hover-card--info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.op-user-hover-card--info | |
&--info |
this could be just &--info. This ensures that you're using the BEM style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, thanks! The previous class definitions were very cumbersome. Much better like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Behavior-wise, LGTM. I have some minor remarks
frontend/src/app/shared/components/principal/principal-renderer.service.ts
Outdated
Show resolved
Hide resolved
frontend/src/app/core/setup/globals/global-listeners/hover-card-trigger.service.ts
Outdated
Show resolved
Hide resolved
This was a leftover that can now be removed.
Ticket
https://community.openproject.org/wp/55581
What are you trying to accomplish?
User hover cards when hovering over the avatar. I tried also showing the hover card when hovering over the name, but it felt wonky and overly verbose. EDIT: as discussed in the frontend daily, the wonkyness is no longer present with an increased delay before showing a hover card. So showing it for names is an option now. We decided that I will create an open point for this topic so that we can decide how to proceed with this. In case we want to add this, I would supply another PR for that, as it will be much smaller in scope.
Please take extra care when reviewing this. I have tried to check every place where a user principal is rendered, but might have missed some due to the sheer number of them.
Screenshots
user.popover.information.mov
Note: the video is not completely accurate. The arrow pointing downwards towards the avatar has been removed because it's not possible to position it reliably.
What approach did you choose and why?
Reused the HoverCard component from work packages and made some adjustments.
Some changes made to the trigger service (Typescript) also affect the work packages. This includes a longer delay before a hover card appears, as well as a slightly longer delay before it closes. Bugs happening when you quickly over multiple different hover cards have been fixed.
The
AvatarComponent
as well as theop-principal-component
now support an option for enabling hover cards. By default, the popover is enabled. I had to disable the popover in some places where it caused hard-to-fix bugs, such as: it is not possible to render another spot modal within an existing spot modal.These places include:
Merge checklist