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

Make avatars in chat welcome messages always big #14255

Merged
merged 8 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ const CONST = {
SMALLER: 'smaller',
SUBSCRIPT: 'subscript',
SMALL_SUBSCRIPT: 'small-subscript',
LARGE_BORDERED: 'large-bordered',
},
OPTION_MODE: {
COMPACT: 'compact',
Expand Down
31 changes: 4 additions & 27 deletions src/components/RoomHeaderAvatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@ import * as StyleUtils from '../styles/StyleUtils';
const propTypes = {
/** Array of avatar URLs or icons */
icons: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.func])),

/** Whether show large Avatars */
shouldShowLargeAvatars: PropTypes.bool,
};

const defaultProps = {
icons: [],
shouldShowLargeAvatars: false,
};

const RoomHeaderAvatars = (props) => {
Expand All @@ -38,32 +34,13 @@ const RoomHeaderAvatars = (props) => {
);
}

if (props.shouldShowLargeAvatars) {
return (
<View style={[styles.flexRow, styles.wAuto, styles.justifyContentCenter, styles.alignItemsCenter]}>
<View style={styles.leftSideLargeAvatar}>
<Avatar
source={props.icons[1]}
imageStyles={[styles.avatarLarge]}
size={CONST.AVATAR_SIZE.LARGE}
fill={themeColors.iconSuccessFill}
/>
</View>
<View style={[styles.rightSideLargeAvatar, StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)]}>
<Avatar
source={props.icons[0]}
imageStyles={[styles.avatarLarge]}
size={CONST.AVATAR_SIZE.LARGE}
/>
</View>
</View>
);
}

const iconsToDisplay = props.icons.slice(0, CONST.REPORT.MAX_PREVIEW_AVATARS);

const iconStyle = [
styles.roomHeaderAvatar,
StyleUtils.getAvatarStyle(CONST.AVATAR_SIZE.MEDIUM),

// Due to border-box box-sizing, the Avatars have to be larger when bordered to visually match size with non-bordered Avatars
StyleUtils.getAvatarStyle(CONST.AVATAR_SIZE.LARGE_BORDERED),
];
return (
<View pointerEvents="none">
Expand Down
1 change: 0 additions & 1 deletion src/pages/ReportDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ class ReportDetailsPage extends Component {
<View style={styles.mb4}>
<RoomHeaderAvatars
icons={ReportUtils.getIcons(this.props.report, this.props.personalDetails, this.props.policies)}
shouldShowLargeAvatars={isPolicyExpenseChat}
/>
</View>
<View style={[styles.reportDetailsRoomInfo, styles.mw100]}>
Expand Down
2 changes: 0 additions & 2 deletions src/pages/home/report/ReportActionItemCreated.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const defaultProps = {
};

const ReportActionItemCreated = (props) => {
const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(props.report);
const icons = ReportUtils.getIcons(props.report, props.personalDetails, props.policies);
return (
<OfflineWithFeedback
Expand All @@ -57,7 +56,6 @@ const ReportActionItemCreated = (props) => {
<Pressable onPress={() => ReportUtils.navigateToDetailsPage(props.report)}>
<RoomHeaderAvatars
icons={icons}
shouldShowLargeAvatars={isPolicyExpenseChat}
/>
</Pressable>
<ReportWelcomeText report={props.report} />
Expand Down
2 changes: 2 additions & 0 deletions src/styles/StyleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ function getAvatarSize(size) {
[CONST.AVATAR_SIZE.SMALLER]: variables.avatarSizeSmaller,
[CONST.AVATAR_SIZE.LARGE]: variables.avatarSizeLarge,
[CONST.AVATAR_SIZE.MEDIUM]: variables.avatarSizeMedium,
[CONST.AVATAR_SIZE.LARGE_BORDERED]: variables.avatarSizeLargeBordered,
};

return AVATAR_SIZES[size];
}

Expand Down
7 changes: 5 additions & 2 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2023,15 +2023,18 @@ const styles = {
left: 0,
backgroundColor: themeColors.overlay,
opacity: variables.overlayOpacity,
borderRadius: 88,
},

avatarInnerTextChat: {
color: themeColors.textLight,
fontSize: variables.fontSizeNormal,
left: 1,
fontSize: variables.fontSizeXLarge,
fontFamily: fontFamily.EXP_NEW_KANSAS_MEDIUM,
textAlign: 'center',
fontWeight: 'normal',
position: 'absolute',
width: 88,
left: -16,
},

pageWrapper: {
Expand Down
1 change: 1 addition & 0 deletions src/styles/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default {
componentBorderRadiusRounded: 20,
buttonBorderRadius: 100,
avatarSizeLarge: 80,
avatarSizeLargeBordered: 88,
avatarSizeMedium: 52,
avatarSizeNormal: 40,
avatarSizeSmall: 28,
Expand Down