Skip to content

Commit

Permalink
Merge branch 'main' of github.com-avastorm:multijump/Expensify-App in…
Browse files Browse the repository at this point in the history
…to 16287_refactor_BasePaymentsPage
  • Loading branch information
multijump committed Jul 24, 2023
2 parents 4cf9445 + 85d84b8 commit 91cde44
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 137 deletions.
8 changes: 4 additions & 4 deletions src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const defaultProps = {
brickRoadIndicator: '',
floatRightAvatars: [],
shouldStackHorizontally: false,
avatarSize: undefined,
avatarSize: CONST.AVATAR_SIZE.DEFAULT,
floatRightAvatarSize: undefined,
shouldBlockSelection: false,
hoverAndPressStyle: [],
Expand Down Expand Up @@ -150,7 +150,7 @@ function MenuItem(props) {
isHovered={isHovered}
isPressed={pressed}
icons={props.icon}
size={CONST.AVATAR_SIZE.DEFAULT}
size={props.avatarSize}
secondAvatarStyle={[
StyleUtils.getBackgroundAndBorderStyle(themeColors.sidebar),
pressed ? StyleUtils.getBackgroundAndBorderStyle(themeColors.buttonPressedBG) : undefined,
Expand All @@ -159,7 +159,7 @@ function MenuItem(props) {
/>
)}
{Boolean(props.icon) && !_.isArray(props.icon) && (
<View style={[styles.popoverMenuIcon, ...props.iconStyles, StyleUtils.getAvatarWidthStyle(props.avatarSize || CONST.AVATAR_SIZE.DEFAULT)]}>
<View style={[styles.popoverMenuIcon, ...props.iconStyles, StyleUtils.getAvatarWidthStyle(props.avatarSize)]}>
{props.iconType === CONST.ICON_TYPE_ICON && (
<Icon
src={props.icon}
Expand Down Expand Up @@ -189,7 +189,7 @@ function MenuItem(props) {
imageStyles={[styles.alignSelfCenter]}
source={props.icon}
fallbackIcon={props.fallbackIcon}
size={props.avatarSize || CONST.AVATAR_SIZE.DEFAULT}
size={props.avatarSize}
/>
)}
</View>
Expand Down
18 changes: 17 additions & 1 deletion src/components/MultipleAvatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,25 @@ const defaultProps = {
maxAvatarsInRow: CONST.AVATAR_ROW_SIZE.DEFAULT,
};

function getContainerStyles(size) {
let containerStyles;

switch (size) {
case CONST.AVATAR_SIZE.SMALL:
containerStyles = [styles.emptyAvatarSmall, styles.emptyAvatarMarginSmall];
break;
case CONST.AVATAR_SIZE.SMALLER:
containerStyles = [styles.emptyAvatarSmaller, styles.emptyAvatarMarginSmaller];
break;
default:
containerStyles = [styles.emptyAvatar, styles.emptyAvatarMargin];
}

return containerStyles;
}
function MultipleAvatars(props) {
const [avatarRows, setAvatarRows] = useState([props.icons]);
let avatarContainerStyles = props.size === CONST.AVATAR_SIZE.SMALL ? [styles.emptyAvatarSmall, styles.emptyAvatarMarginSmall] : [styles.emptyAvatar, styles.emptyAvatarMargin];
let avatarContainerStyles = getContainerStyles(props.size);
const singleAvatarStyle = props.size === CONST.AVATAR_SIZE.SMALL ? styles.singleAvatarSmall : styles.singleAvatar;
const secondAvatarStyles = [props.size === CONST.AVATAR_SIZE.SMALL ? styles.secondAvatarSmall : styles.secondAvatar, ...props.secondAvatarStyle];
const tooltipTexts = props.shouldShowTooltip ? _.pluck(props.icons, 'name') : [''];
Expand Down
7 changes: 2 additions & 5 deletions src/components/ReportActionItem/TaskView.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, {useEffect} from 'react';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import lodashGet from 'lodash/get';
import reportPropTypes from '../../pages/reportPropTypes';
import withLocalize, {withLocalizePropTypes} from '../withLocalize';
import withWindowDimensions from '../withWindowDimensions';
Expand All @@ -13,8 +12,7 @@ import MenuItemWithTopDescription from '../MenuItemWithTopDescription';
import MenuItem from '../MenuItem';
import styles from '../../styles/styles';
import * as ReportUtils from '../../libs/ReportUtils';
import * as PersonalDetailsUtils from '../../libs/PersonalDetailsUtils';
import * as UserUtils from '../../libs/UserUtils';
import * as OptionsListUtils from '../../libs/OptionsListUtils';
import * as StyleUtils from '../../styles/StyleUtils';
import * as Task from '../../libs/actions/Task';
import * as PolicyUtils from '../../libs/PolicyUtils';
Expand Down Expand Up @@ -49,7 +47,6 @@ function TaskView(props) {
const isCompleted = ReportUtils.isCompletedTaskReport(props.report);
const isOpen = ReportUtils.isOpenTaskReport(props.report);
const isCanceled = ReportUtils.isCanceledTaskReport(props.report);
const avatarURL = lodashGet(PersonalDetailsUtils.getPersonalDetailsByIDs([props.report.managerID], props.currentUserPersonalDetails.accountID), [0, 'avatar'], '');
const policy = ReportUtils.getPolicy(props.report.policyID);
const canEdit = PolicyUtils.isPolicyAdmin(policy) || Task.isTaskAssigneeOrTaskOwner(props.report, props.currentUserPersonalDetails.accountID);
const disableState = !canEdit || !isOpen;
Expand Down Expand Up @@ -117,7 +114,7 @@ function TaskView(props) {
<MenuItem
label={props.translate('task.assignee')}
title={ReportUtils.getDisplayNameForParticipant(props.report.managerID)}
icon={UserUtils.getAvatar(avatarURL, props.report.managerID)}
icon={OptionsListUtils.getAvatarsForAccountIDs([props.report.managerID], props.personalDetails)}
iconType={CONST.ICON_TYPE_AVATAR}
avatarSize={CONST.AVATAR_SIZE.SMALLER}
titleStyle={styles.assigneeTextStyle}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2617,7 +2617,7 @@ function shouldDisableSettings(report) {
* @returns {Boolean}
*/
function shouldDisableRename(report, policy) {
if (isDefaultRoom(report) || isArchivedRoom(report)) {
if (isDefaultRoom(report) || isArchivedRoom(report) || isChatThread(report)) {
return true;
}

Expand Down
Loading

0 comments on commit 91cde44

Please sign in to comment.