-
Notifications
You must be signed in to change notification settings - Fork 14.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
refactor: replace AvatarIcon instances with FacePile #11279
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11279 +/- ##
==========================================
+ Coverage 65.43% 65.63% +0.20%
==========================================
Files 831 837 +6
Lines 39528 39685 +157
Branches 3598 3608 +10
==========================================
+ Hits 25866 26049 +183
+ Misses 13553 13528 -25
+ Partials 109 108 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
superset-frontend/src/components/UserStack/UserStack.stories.tsx
Outdated
Show resolved
Hide resolved
{users.map(({ first_name, last_name }) => { | ||
const name = `${first_name} ${last_name}`; | ||
return ( | ||
<Tooltip key={name} title={name} placement="top"> |
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.
this key
won't be unique if the same user is an owner of multiple dashboards i think. Perhaps we need to append more context here?
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.
this is rendered in the context of a single row for dashboards. The array here is for owers on a single dashboard and that list should be unique. While the key would not be unique for the whole page, it would be unique for the list in which each appears.
*/ | ||
|
||
// https://en.wikipedia.org/wiki/Linear_congruential_generator | ||
function stringAsciiPRNG(value: string, m: number) { |
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.
can we add a test or two for 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.
Also, what if they have a non english/ascii name?
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.
This should be covered in the tests for getRandomColor
NIT: tooltip-in-popover is a bit "yo dawg" :) |
Yea it's a little much visually. We could remove it (ie, check to see if the avatar is beyond the fold and not add the tooltip) but then we'd lose some information. |
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 couple more comments, but nothing blocking
import FacePile from '.'; | ||
|
||
export default { | ||
title: 'UerStack', |
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.
nit: this should probably be FacePile
for consistency
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.
ohh, nice catch
<StyledGroup maxCount={maxCount}> | ||
{users.map(({ first_name, last_name }) => { | ||
const name = `${first_name} ${last_name}`; | ||
const color = getRandomColor(name, colorList); |
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.
this doesn't need to be addressed in this PR, but basing the profile color off the full name seems somewhat flawed to me. If there are naming collisions between people with common full names, then it'll be impossible to tell them apart in the FacePile. This could also cause key collisions below.
I'd recommend refactoring in the future to basing the color off the user id, or a combo of name + user id.
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.
That's a good point, I can add user id to the mix and that should hold us over for a while. Eventually, I think, we'll have profile pictures and make these links so it's easier to differentiate users
SUMMARY
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
ADDITIONAL INFORMATION