Skip to content

Commit

Permalink
Merge pull request #33042 from shubham1206agra/fix-avatars
Browse files Browse the repository at this point in the history
Fixed LHN avatars
  • Loading branch information
rlinoz authored Dec 19, 2023
2 parents 11bcd83 + d1cbe08 commit a66acba
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 22 deletions.
3 changes: 1 addition & 2 deletions src/components/AvatarWithDisplayName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ function AvatarWithDisplayName({
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(Object.values(ownerPersonalDetails), false);
const shouldShowSubscriptAvatar = ReportUtils.shouldReportShowSubscript(report);
const isExpenseRequest = ReportUtils.isExpenseRequest(report);
const defaultSubscriptSize = isExpenseRequest ? CONST.AVATAR_SIZE.SMALL_NORMAL : size;
const avatarBorderColor = isAnonymous ? theme.highlightBG : theme.componentBG;

const actorAccountID = useRef<number | null>(null);
Expand Down Expand Up @@ -118,7 +117,7 @@ function AvatarWithDisplayName({
backgroundColor={avatarBorderColor}
mainAvatar={icons[0]}
secondaryAvatar={icons[1]}
size={defaultSubscriptSize}
size={size}
/>
) : (
<MultipleAvatars
Expand Down
3 changes: 1 addition & 2 deletions src/components/LHNOptionsList/OptionRowLHN.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ function OptionRowLHN(props) {
const focusedBackgroundColor = styles.sidebarLinkActive.backgroundColor;

const hasBrickError = optionItem.brickRoadIndicator === CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR;
const defaultSubscriptSize = optionItem.isExpenseRequest ? CONST.AVATAR_SIZE.SMALL_NORMAL : CONST.AVATAR_SIZE.DEFAULT;
const shouldShowGreenDotIndicator = !hasBrickError && ReportUtils.requiresAttentionFromCurrentUser(optionItem, optionItem.parentReportAction);

/**
Expand Down Expand Up @@ -220,7 +219,7 @@ function OptionRowLHN(props) {
backgroundColor={hovered && !props.isFocused ? hoveredBackgroundColor : subscriptAvatarBorderColor}
mainAvatar={optionItem.icons[0]}
secondaryAvatar={optionItem.icons[1]}
size={props.viewMode === CONST.OPTION_MODE.COMPACT ? CONST.AVATAR_SIZE.SMALL : defaultSubscriptSize}
size={props.viewMode === CONST.OPTION_MODE.COMPACT ? CONST.AVATAR_SIZE.SMALL : CONST.AVATAR_SIZE.DEFAULT}
/>
) : (
<MultipleAvatars
Expand Down
3 changes: 1 addition & 2 deletions src/components/OptionRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ function OptionRow(props) {
: props.backgroundColor;
const focusedBackgroundColor = styles.sidebarLinkActive.backgroundColor;
const isMultipleParticipant = lodashGet(props.option, 'participantsList.length', 0) > 1;
const defaultSubscriptSize = props.option.isExpenseRequest ? CONST.AVATAR_SIZE.SMALL_NORMAL : CONST.AVATAR_SIZE.DEFAULT;

// We only create tooltips for the first 10 users or so since some reports have hundreds of users, causing performance to degrade.
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(
Expand Down Expand Up @@ -208,7 +207,7 @@ function OptionRow(props) {
mainAvatar={props.option.icons[0]}
secondaryAvatar={props.option.icons[1]}
backgroundColor={hovered ? hoveredBackgroundColor : subscriptColor}
size={defaultSubscriptSize}
size={CONST.AVATAR_SIZE.DEFAULT}
/>
) : (
<MultipleAvatars
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ function hasOnlyDistanceRequestTransactions(iouReportID: string | undefined): bo
* If the report is a thread and has a chat type set, it is a workspace chat.
*/
function isWorkspaceThread(report: OnyxEntry<Report>): boolean {
return isThread(report) && !isDM(report);
return isThread(report) && isChatReport(report) && !isDM(report);
}

/**
Expand Down
24 changes: 12 additions & 12 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1999,14 +1999,14 @@ const styles = (theme: ThemeColors) =>
height: 24,
width: 24,
backgroundColor: theme.icon,
borderRadius: 24,
borderRadius: 12,
},

singleAvatarSmall: {
height: 18,
width: 18,
height: 16,
width: 16,
backgroundColor: theme.icon,
borderRadius: 18,
borderRadius: 8,
},

singleAvatarMedium: {
Expand All @@ -2020,17 +2020,17 @@ const styles = (theme: ThemeColors) =>
position: 'absolute',
right: -18,
bottom: -18,
borderWidth: 3,
borderRadius: 30,
borderWidth: 2,
borderRadius: 14,
borderColor: 'transparent',
},

secondAvatarSmall: {
position: 'absolute',
right: -13,
bottom: -13,
borderWidth: 3,
borderRadius: 18,
right: -14,
bottom: -14,
borderWidth: 2,
borderRadius: 10,
borderColor: 'transparent',
},

Expand All @@ -2051,8 +2051,8 @@ const styles = (theme: ThemeColors) =>

secondAvatarSubscriptCompact: {
position: 'absolute',
bottom: -1,
right: -1,
bottom: -4,
right: -4,
},

secondAvatarSubscriptSmallNormal: {
Expand Down
2 changes: 1 addition & 1 deletion src/styles/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const avatarFontSizes: Partial<Record<AvatarSizeName, number>> = {

const avatarBorderWidths: Partial<Record<AvatarSizeName, number>> = {
[CONST.AVATAR_SIZE.DEFAULT]: 3,
[CONST.AVATAR_SIZE.SMALL_SUBSCRIPT]: 1,
[CONST.AVATAR_SIZE.SMALL_SUBSCRIPT]: 2,
[CONST.AVATAR_SIZE.MID_SUBSCRIPT]: 2,
[CONST.AVATAR_SIZE.SUBSCRIPT]: 2,
[CONST.AVATAR_SIZE.SMALL]: 2,
Expand Down
4 changes: 2 additions & 2 deletions src/styles/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export default {
avatarSizeSmall: 28,
avatarSizeSmaller: 24,
avatarSizeSubscript: 20,
avatarSizeMidSubscript: 18,
avatarSizeMidSubscript: 16,
avatarSizeMentionIcon: 16,
avatarSizeSmallSubscript: 14,
avatarSizeSmallSubscript: 12,
defaultAvatarPreviewSize: 360,
fabBottom: 25,
fontSizeOnlyEmojis: 30,
Expand Down

0 comments on commit a66acba

Please sign in to comment.