Skip to content
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

fix missing style in thread subheader, tooltip issues #22500

Merged
merged 7 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'main' of https://github.com/Expensify/App into fix/foll…
…ow-up-21092
  • Loading branch information
0xmiroslav committed Jul 12, 2023
commit 13e1e76bef2254a6adef6cf16bef5cbe70fc87a8
52 changes: 5 additions & 47 deletions src/components/UserDetailsTooltip/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,11 @@ const propTypes = {
children: PropTypes.node.isRequired,
};

// We replace the actor's email, name, and avatar with the Copilot manually for now. This will be improved upon when
// the Copilot feature is implemented.
if (props.delegateAccountID) {
const delegateUserDetails = lodashGet(props.personalDetailsList, props.delegateAccountID, {});
const delegateUserDisplayName = delegateUserDetails.displayName ? delegateUserDetails.displayName.trim() : '';
userDisplayName = `${delegateUserDisplayName} (${props.translate('reportAction.asCopilot')} ${userDisplayName})`;
userLogin = delegateUserDetails.login;
userAvatar = delegateUserDetails.avatar;
userAccountID = props.delegateAccountID;
}

let title = String(userDisplayName).trim() ? userDisplayName : '';
const subtitle = (userLogin || '').trim() && !_.isEqual(LocalePhoneNumber.formatPhoneNumber(userLogin || ''), userDisplayName) ? Str.removeSMSDomain(userLogin) : '';
if (props.icon && (props.icon.type === CONST.ICON_TYPE_WORKSPACE || !title)) {
title = props.icon.name;
}
const renderTooltipContent = useCallback(
() => (
<View style={[styles.alignItemsCenter, styles.ph2, styles.pv2]}>
<View style={styles.emptyAvatar}>
<Avatar
containerStyles={[styles.actionAvatar]}
source={props.icon ? props.icon.source : UserUtils.getAvatar(userAvatar, userAccountID)}
type={props.icon ? props.icon.type : CONST.ICON_TYPE_AVATAR}
name={props.icon ? props.icon.name : userLogin}
/>
</View>
<Text style={[styles.mt2, styles.textMicroBold, styles.textReactionSenders, styles.textAlignCenter]}>{title}</Text>
<Text style={[styles.textMicro, styles.fontColorReactionLabel, styles.breakWord, styles.textAlignCenter]}>{subtitle}</Text>
</View>
),
[props.icon, userAvatar, userAccountID, userLogin, title, subtitle],
);

if (!props.icon && !userDisplayName && !userLogin) {
return props.children;
}

return (
<Tooltip
renderTooltipContent={renderTooltipContent}
renderTooltipContentKey={[userDisplayName, userLogin]}
>
{props.children}
</Tooltip>
);
}
/**
* @param {propTypes} props
* @returns {ReactNodeLike}
*/
const UserDetailsTooltip = (props) => props.children;

UserDetailsTooltip.propTypes = propTypes;
UserDetailsTooltip.displayName = 'UserDetailsTooltip';
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserDetailsTooltip/index.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function UserDetailsTooltip(props) {

let title = String(userDisplayName).trim() ? userDisplayName : '';
const subtitle = (userLogin || '').trim() && !_.isEqual(LocalePhoneNumber.formatPhoneNumber(userLogin || ''), userDisplayName) ? Str.removeSMSDomain(userLogin) : '';
if (props.icon && props.icon.type === CONST.ICON_TYPE_WORKSPACE) {
if (props.icon && (props.icon.type === CONST.ICON_TYPE_WORKSPACE || !title)) {
title = props.icon.name;
}
const renderTooltipContent = useCallback(
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.