From eebcb45600d0d887364b2f1434c001755f7003db Mon Sep 17 00:00:00 2001 From: Ali Toshmatov Date: Tue, 11 Jul 2023 22:25:11 +0500 Subject: [PATCH 1/5] Using icon data as a fallback data in tooltip --- src/components/MultipleAvatars.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/MultipleAvatars.js b/src/components/MultipleAvatars.js index f0dddfafc583..49dd619668dd 100644 --- a/src/components/MultipleAvatars.js +++ b/src/components/MultipleAvatars.js @@ -112,6 +112,10 @@ function MultipleAvatars(props) { {props.shouldStackHorizontally ? ( @@ -158,6 +162,10 @@ function MultipleAvatars(props) { key={`stackedAvatars-${index}`} accountID={icon.id} icon={icon} + fallbackUserDetails={{ + displayName: icon.name, + avatar: icon.avatar, + }} > {/* View is necessary for tooltip to show for multiple avatars in LHN */} @@ -244,6 +256,10 @@ function MultipleAvatars(props) { Date: Wed, 12 Jul 2023 00:58:46 +0500 Subject: [PATCH 2/5] Added default value for getAvatarsForAccountIDs --- src/libs/OptionsListUtils.js | 6 ++++-- src/pages/workspace/WorkspaceInviteMessagePage.js | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index f5b1de63182b..2b0076ee25d2 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -150,11 +150,13 @@ function addSMSDomainIfPhoneNumber(login) { * * @param {Array} accountIDs * @param {Object} personalDetails + * @param {Object} defaultValues {login: accountID} In workspace invite page, when new user is added we pass available data to opt in * @returns {Object} */ -function getAvatarsForAccountIDs(accountIDs, personalDetails) { +function getAvatarsForAccountIDs(accountIDs, personalDetails, defaultValues = {}) { return _.map(accountIDs, (accountID) => { - const userPersonalDetail = lodashGet(personalDetails, accountID, {login: '', accountID, avatar: ''}); + const defaultData = _.find(defaultValues, (item) => item === accountID); + const userPersonalDetail = lodashGet(personalDetails, accountID, {login: lodashGet(defaultData, 'login'), accountID, avatar: ''}); return { id: accountID, source: UserUtils.getAvatar(userPersonalDetail.avatar, userPersonalDetail.accountID), diff --git a/src/pages/workspace/WorkspaceInviteMessagePage.js b/src/pages/workspace/WorkspaceInviteMessagePage.js index 12caf96f283a..60247037bf3a 100644 --- a/src/pages/workspace/WorkspaceInviteMessagePage.js +++ b/src/pages/workspace/WorkspaceInviteMessagePage.js @@ -194,7 +194,11 @@ class WorkspaceInviteMessagePage extends React.Component { Date: Wed, 12 Jul 2023 01:04:08 +0500 Subject: [PATCH 3/5] Added fallback value to lodashGet --- src/libs/OptionsListUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 2b0076ee25d2..c9ce07e779c6 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -156,7 +156,7 @@ function addSMSDomainIfPhoneNumber(login) { function getAvatarsForAccountIDs(accountIDs, personalDetails, defaultValues = {}) { return _.map(accountIDs, (accountID) => { const defaultData = _.find(defaultValues, (item) => item === accountID); - const userPersonalDetail = lodashGet(personalDetails, accountID, {login: lodashGet(defaultData, 'login'), accountID, avatar: ''}); + const userPersonalDetail = lodashGet(personalDetails, accountID, {login: lodashGet(defaultData, 'login', ''), accountID, avatar: ''}); return { id: accountID, source: UserUtils.getAvatar(userPersonalDetail.avatar, userPersonalDetail.accountID), From 5699cf8497f5717408e537216999d52dfde159d0 Mon Sep 17 00:00:00 2001 From: Ali Toshmatov Date: Wed, 12 Jul 2023 01:21:54 +0500 Subject: [PATCH 4/5] Updated logic --- src/libs/OptionsListUtils.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index c9ce07e779c6..47733dcc3870 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -154,9 +154,14 @@ function addSMSDomainIfPhoneNumber(login) { * @returns {Object} */ function getAvatarsForAccountIDs(accountIDs, personalDetails, defaultValues = {}) { + const reversedDefaultValues = {}; + _.map(Object.entries(defaultValues), (item) => { + reversedDefaultValues[item[1]] = item[0]; + }); + return _.map(accountIDs, (accountID) => { - const defaultData = _.find(defaultValues, (item) => item === accountID); - const userPersonalDetail = lodashGet(personalDetails, accountID, {login: lodashGet(defaultData, 'login', ''), accountID, avatar: ''}); + const login = lodashGet(reversedDefaultValues, accountID, ''); + const userPersonalDetail = lodashGet(personalDetails, accountID, {login, accountID, avatar: ''}); return { id: accountID, source: UserUtils.getAvatar(userPersonalDetail.avatar, userPersonalDetail.accountID), From 6751cda40259d4090da1d4f2625df086d5fe454d Mon Sep 17 00:00:00 2001 From: Ali Toshmatov Date: Wed, 12 Jul 2023 01:24:58 +0500 Subject: [PATCH 5/5] Removed comment --- src/components/MultipleAvatars.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/MultipleAvatars.js b/src/components/MultipleAvatars.js index 49dd619668dd..b50fa439a21c 100644 --- a/src/components/MultipleAvatars.js +++ b/src/components/MultipleAvatars.js @@ -148,7 +148,7 @@ function MultipleAvatars(props) { } avatarContainerStyles = StyleUtils.combineStyles([styles.alignItemsCenter, styles.flexRow, StyleUtils.getHeight(height), StyleUtils.getWidthStyle(width)]); } - // console.log(props.icons); + return ( <> {props.shouldStackHorizontally ? (