1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/component/common
Thomas Heartman f1e95108d1
Wip: split out avatar group; use same tooltip for all avatars (#7681)
Extracts the Avatar Group component into a `common` component and adds a
standard tooltip to all avatars.

Relates to linear issue 1-2606

This is a suggestion / proof of concept for how we can solve it. While I
think we can merge this as is, I'd also be happy to take any discussions
on other ways to approach it etc.

## Why are these changes made together?

Because extracting the avatar group without adding the new tooltip data
made the existing tooltip misbehave (it'd show up in the top left of the
screen, not synced to the avatar in any way).

I probably could have (and still can if you think it's prudent) split it
out such that the avatar gets a standardized tooltip first (and disable
it for the group card avatars), and split out the avatars in a
follow-up. Happy to do that if you think it's better.

## What does this mean? 

It used to be that we had no consistent way of dealing with avatars and
tooltips. Some places had them, some places didn't. This change makes it
so that all avatars that we can show tooltips for will get the same
tooltip.

Previously, we had at least 4 different ways of dealing with tooltips:
- The HTML tooltip (that would be standardized with this PR) in the
project flags table

![image](https://github.com/user-attachments/assets/91098d31-a5e3-4091-9125-332fe5d106fd)
- The "title" that you'd get on your user avatar

![image](https://github.com/user-attachments/assets/39062b61-db8c-4bd5-9fa3-3ecc9bc192ee)
- The group card list tooltip

![image](https://github.com/user-attachments/assets/0d4a696a-e944-446c-8bff-4dcec02d8afb)
- And sometimes you'd get nothing at all

![image](https://github.com/user-attachments/assets/8975afaf-9ca1-4eb6-b443-9ab94b52bbd8)

with this change, we'll always show the same kind of tooltip if we can:


![image](https://github.com/user-attachments/assets/974c592c-c844-4b65-8a55-05e84d3df130)

## What goes in the tooltip? 

We use the `UserAvatar` component for a fair few different things and I
didn't want to extract separate components for all the different use
cases. Instead, I wanted to get an overview over what we use it for and
what is relevant info to show.

I found all the places we used it and tried to form an opinion. 

This tooltip will work with a user's email, name, username, and id. If
there is no user (such as for empty avatars and avatars displaying only
"+n" for remaining members), we show no tooltip.

Following the example set by the group card avatars, we'll try to use
email or username (in that order) as the main bit of text. If the user
has an email or a username and also a name, the name will be used as
secondary text.

If the user does not have an email or username, but has a name, we'll
use the name as the main text.

If the user does not have an email, a username, or a name, we'll try to
show "User ID: N" if they have an id.

If they do not have a username, a name, an email, or an ID, we bail out
and show nothing.

## Why can you disable the tooltip?

In some cases, you might want to disable the tooltip because you have
more information to feed into it. An example of that is in the project
flags table, where we want to show more information in cases where the
user is 'unknown':


![image](https://github.com/user-attachments/assets/758b4e86-e934-47e3-91ce-ce900f76bc54)


## Additional fixes

This PR also adds a few lines of CSS to fix a minor avatar layout bug.

Before:

![image](https://github.com/user-attachments/assets/0150efbf-c51a-40bb-898f-7ddd3565ce21)


After:

![image](https://github.com/user-attachments/assets/f337cf68-c572-4610-b1de-a27749325da8)
2024-08-01 10:45:24 +02:00
..
AnimateOnMount feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
Announcer chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
ApiError chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
ApiTokenTable feat: show orphaned API tokens (#7569) 2024-07-11 14:06:22 +02:00
AutocompleteBox chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
AvatarGroup Wip: split out avatar group; use same tooltip for all avatars (#7681) 2024-08-01 10:45:24 +02:00
Badge fix: badge should render children 0 value (#6981) 2024-05-06 13:24:52 +03:00
BatchSelectionActionsBar feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
BreadcrumbNav feat: redirect to new feature flag creation (#7679) 2024-07-26 14:27:02 +03:00
CheckmarkBadge
Codebox
ConditionallyRender chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
ConstraintAccordion feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
CreateButton chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
DateTimePicker chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
DialogFormTemplate feat: Use a toggling button for impression data on/off (#7682) 2024-07-29 08:05:35 +00:00
Dialogue feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
DividerText
DropdownMenu chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
EnterpriseBadge chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
EnvironmentIcon
ExperimentalFeedback chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
FavoriteIconButton chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
FeatureArchiveDialog chore: rename toggle to flag #1 (#7092) 2024-05-21 15:18:00 +03:00
FeatureStaleDialog chore: rename toggle to flag #1 (#7092) 2024-05-21 15:18:00 +03:00
FeatureStatusChip chore: rename toggle to flag #2 (#7097) 2024-05-22 08:20:11 +03:00
Feedback chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
FilterDateItem feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
FormSwitch chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
FormTemplate fix: project icon sizing and color (#7672) 2024-07-26 10:26:16 +02:00
GeneralSelect fix: prevent long names from breaking form layouts (#7591) 2024-07-16 10:47:46 +02:00
Gradient feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
GridCol feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
GridRow feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
GuidanceIndicator feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
HelpIcon chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
Highlighter chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
HtmlTooltip fix: prevent project cell overflow on api keys table (#7472) 2024-07-02 12:10:02 +02:00
Input chore: update input field text sizes (#7107) 2024-05-22 13:26:22 +02:00
InputCaption
InputListField chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
InstanceStatus feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
ItemList chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
Limit chore: don't ask OSS users to reach out to CS (#7633) 2024-07-22 11:03:10 +02:00
Loader fix: make loader not exlpode to 100vh in unnecessary locations (#7589) 2024-07-15 14:41:45 +02:00
LoginRedirect
MainHeader chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
Markdown chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
MultiActionButton feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
MultipleRoleSelect feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
NewConstraintAccordion feat: constraints values limit in a strategy UI (#7557) 2024-07-08 15:08:16 +02:00
NoItems feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
NotFound feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
Notifications feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
OperatorUpgradeAlert
PageContent feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
PageHeader feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
PasswordField chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
PercentageCircle chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
PermissionButton feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
PermissionGuard
PermissionHOC chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
PermissionIconButton Feat: feature view created by field - frontend (#7382) 2024-06-13 13:00:57 +02:00
PermissionSwitch chore: use HTML (custom) tooltip for permission switches (#7355) 2024-06-11 14:03:35 +02:00
PremiumFeature
PrettifyLargeNumber chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
Proclamation chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
ProjectIcon fix: project icon sizing and color (#7672) 2024-07-26 10:26:16 +02:00
ProjectSelect fix: Project select should not expand when selecting multiple projects (#6811) 2024-04-10 12:34:11 +03:00
ProtectedRoute chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
ReactJSONEditor chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
ResponsiveButton feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
RoleBadge
RoleDescription chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
RoleSelect chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
ScreenReaderOnly feat: filter by user when interacting with the avatar (#7347) 2024-06-11 12:15:35 +02:00
ScrollTop
Search feat: separate command bar and search hotkeys (#7651) 2024-07-24 12:46:03 +03:00
SegmentItem fix: show segment details in targetting (#6640) 2024-03-22 10:14:19 +01:00
SidebarModal chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
SidePanelList chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
SkipNavLink
StaleDataNotification
Sticky feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
StrategyItemContainer feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
StrategySeparator
StrategyVariantsUpgradeAlert
StringTruncator
Table fix: avoid react key warnings in tables (#7694) 2024-07-30 13:09:12 +02:00
TabNav feat: upgrade from react v17 to v18 (#7265) 2024-06-11 13:59:52 +03:00
ThemeMode
ToastRenderer chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
TooltipLink chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
TooltipResolver feat: command menu items can have description as tooltip now (#7455) 2024-06-26 12:39:53 +03:00
UpdateButton chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
UserAvatar Wip: split out avatar group; use same tooltip for all avatars (#7681) 2024-08-01 10:45:24 +02:00
VariantInfoAlert chore: rename toggle to flag #2 (#7097) 2024-05-22 08:20:11 +03:00
VerticalTabs fix: project settings table overflow (#7288) 2024-06-05 14:05:41 +02:00
common.module.scss
flags.ts
index.jsx chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
select.tsx chore: Bump biome and configure husky (#6589) 2024-03-18 13:58:05 +01:00
util.test.ts fix: prevent strategy variant weight from going into negative numbers on Frontend (#7460) 2024-06-27 09:06:59 +00:00
util.ts fix: prevent strategy variant weight from going into negative numbers on Frontend (#7460) 2024-06-27 09:06:59 +00:00