Add New Default Workspace Avatars - #15280
Conversation
|
Otherwise this is looking dope! |
|
@mananjadhav @aldo-expensify One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
| fill: themeColors.icon, | ||
| small: false, | ||
| inline: false, | ||
| isSVGAvatar: false, |
There was a problem hiding this comment.
qq, I remember we added this in the last PR, just to share some knowledge, why we removed it now?
There was a problem hiding this comment.
Rather than have the Icon component handle avatar styles, I decided that the Avatar component should own all things avatars. Therefore, I replaced the styling with additionalStyles and pass in the correct avatar styles from within the component instead.
There was a problem hiding this comment.
That said, I will remove isWorkspaceAvatar too!
|
|
||
| /** Flag to choose between avatar image or an icon */ | ||
| iconType: PropTypes.oneOf([CONST.ICON_TYPE_AVATAR, CONST.ICON_TYPE_ICON]), | ||
| iconType: PropTypes.oneOf([CONST.ICON_TYPE_AVATAR, CONST.ICON_TYPE_ICON, CONST.ICON_TYPE_WORKSPACE]), |
There was a problem hiding this comment.
nab, or probably an overkill. Do we want to create this as a prop in avatarPropTypes? and use that instead of importing this everywhere?
There was a problem hiding this comment.
I think no, but only because we can have different iconTypes:
MenuItem can take in:
[CONST.ICON_TYPE_AVATAR, CONST.ICON_TYPE_ICON, CONST.ICON_TYPE_WORKSPACE]Whereas Avatars take in:
[CONST.ICON_TYPE_AVATAR, CONST.ICON_TYPE_WORKSPACE]Although one option would be that we could make separate propTypes for these. Like MenuItemIconTypes and AvatarIconTypes. What are your thoughts given that?
mananjadhav
left a comment
There was a problem hiding this comment.
Did one round of review, and raised some comments. I think I'll need one more review as there are 20+ files to review.
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-03-02.at.4.57.58.PM.movMobile Web - ChromeScreen.Recording.2023-03-02.at.5.01.45.PM.movMobile Web - SafariScreen.Recording.2023-03-02.at.6.03.38.PM.movDesktopScreen.Recording.2023-03-02.at.6.05.59.PM.moviOSScreen.Recording.2023-03-02.at.5.53.32.PM.mov |
|
@grgia , when there are more than 4 WPs, you can still see the 4th workspace avatar plus the I other cases, you don't show the avatar anymore, just the Should we apply the same technique? cc @shawnborton Edit: I see now that avatar is darker when the |
aldo-expensify
left a comment
There was a problem hiding this comment.
Looks good and tested well for me.
If if if we decide to do something about this two comments:
#15280 (comment)
#15280 (comment)
We can do it in a follow up PR, no need to hold the PR on that.
Going to leave unmerged, in case you want to wait for @rushatgabhane to have a look. Feel free to merge when you think is appropriate!
|
I tested on web and desktop. I’ll finish the checklist in an hour and raise if any issues. Can be picked as a follow up PR. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
@grgia @shawnborton Here are different cases for the workspace title If you notice |
Reviewer Checklist
Screenshots/VideosWebweb-workspace-avatar.movDesktopdesktop-workspace-avatar.moviOSScreen.Recording.2023-03-03.at.11.10.54.AM.mov |
|
@mananjadhav for your comment here, I think this is okay for now. Let's just be diligent about this when the inevitable bug reports come in. But yeah, I don't think we're going to have actual real workspaces come in with these kinds of characters just yet, so let's make people aware that we are purposely choosing not to address this for the time being. |
|
🚀 Deployed to staging by https://github.com/grgia in version: 1.2.79-0 🚀
|
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.2.79-0 🚀
|
|
This PR introduced a regression here #15697 due to missing offline tests. |
|
Hey 👋🏾, it seems like we first implemented square workspace icons with this PR. However, the shape of the mask we use for cropping uploaded workspace avatars wasn't updated from a circle to a square as well which resulted in this bug. |
| {_.map(iconsToDisplay, (val, index) => ( | ||
| <View key={`${val}${index}`} style={[styles.justifyContentCenter, styles.alignItemsCenter]}> | ||
| {_.map(iconsToDisplay, (icon, index) => ( | ||
| <View key={`${icon.source}${index}`} style={[styles.justifyContentCenter, styles.alignItemsCenter]}> |
| icons: [ReportUtils.getAvatar(item.avatar, item.login)], | ||
| icons: [{ | ||
| source: ReportUtils.getAvatar(item.avatar, item.login), | ||
| name: item.login, |
There was a problem hiding this comment.
Coming from #29645
Not sure if this issue was present at the time this PR was created, but we should have used formatPhoneNumber from withLocalize
name: props.formatPhoneNumber(details.login),













Details
We are adding the new default workspace avatars (SVGs) as part of the new branding changes.
The default workspace avatar is dynamically created by determining the first appearing letter/number of the workspace title. If none, then the workspace defaults to the building icon. For example,
Expensifywould result in anE,!Expensifywould result in anE, and!would result in a building.Similarly, the title is used to randomly select a color pairing. Because default avatars are not currently stored in memory, this ensures that the default avatar colors remain consistent. The title is stripped from any trailing whitespace. Therefore,
Expensifywill have a different color thanExpensify 1and so on.Whenever an avatar is used, we need to know three things in order to properly style it:
I refactored
<Avatar>to take in this information (type, name, source)This will mean
<Avatar>will be able to own the default avatar calculations. This also means that we can later support more types of avatars if needed (rooms, etc).I will be following up this PR with another PR to clean up the default avatars for users.
Current Branch:
Screen.Recording.2023-02-18.at.4.42.05.PM.mov
Fixed Issues
$ #12259
Tests
Verify that no errors appear in the JS console
Verified that A-Z/0-9 and building SVG all work by changing the title of the workspace
Verified that changing the title (but not the first letter) of the workspace results in a color change
Verified that using a user-uploaded workspace avatar works
Completed QA steps below.
Offline tests
QA Steps
Repeat this with both the user-uploaded workspace and the normal workspace:
http://localhost:8080/searchhttp://localhost:8080/settingshttp://localhost:8080/settings/workspaceshttp://localhost:8080/workspace/{workspace ID}http://localhost:8080/workspace/{workspace ID}/settingsBecause this modified the Avatar Component, we will also check that user avatars look correct. Make sure you have at least 1 avatar that uses a user-uploaded avatar to reference before checking these pages:
http://localhost:8080/searchhttp://localhost:8080/settingshttp://localhost:8080/settings/profilehttp://localhost:8080/details?{login}http://localhost:8080/details?{login}-> Click on Avatarhttp://localhost:8080/workspace/{workspace ID}http://localhost:8080/workspace/{workspace ID}/settingshttp://localhost:8080/iou/sendhttp://localhost:8080/iou/requesthttp://localhost:8080/iou/splithttp://localhost:8080/iou/details/{report ID}/{iou ID}http://localhost:8080/new/grouphttp://localhost:8080/new/chathttp://localhost:8080/workspace/{workspace ID}/membersPR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.Screenshots/Videos
Web
Screen.Recording.2023-02-21.at.11.06.04.AM.mov
Mobile Web - Chrome
Screen.Recording.2023-02-21.at.11.09.33.AM.mov
Mobile Web - Safari
Screen.Recording.2023-02-21.at.11.06.56.AM.mov
Desktop
Screen.Recording.2023-02-21.at.11.12.58.AM.mov
iOS
Screen.Recording.2023-02-21.at.11.08.40.AM.mov
Android
Screen.Recording.2023-02-21.at.11.10.41.AM.mov