Skip to content

Commit

Permalink
merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
chiragxarora committed Sep 22, 2023
2 parents 723402c + 1f628bd commit 6675aa2
Show file tree
Hide file tree
Showing 114 changed files with 389 additions and 241 deletions.
2 changes: 1 addition & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ export default {
SEARCH: 'search',
TEACHERS_UNITE: 'teachersunite',
I_KNOW_A_TEACHER: 'teachersunite/i-know-a-teacher',
INTRO_SCHOOL_PRINCIPAL: 'teachersunite/intro-school-principal',
I_AM_A_TEACHER: 'teachersunite/i-am-a-teacher',
INTRO_SCHOOL_PRINCIPAL: 'teachersunite/intro-school-principal',
DETAILS: 'details',
getDetailsRoute: (login: string) => `details?login=${encodeURIComponent(login)}`,
PROFILE: 'a/:accountID',
Expand Down
2 changes: 1 addition & 1 deletion src/components/AvatarCropModal/AvatarCropModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ function AvatarCropModal(props) {
style={[styles.pb0]}
includePaddingTop={false}
includeSafeAreaPaddingBottom={false}
testID="AvatarCropModal"
testID={AvatarCropModal.displayName}
>
{props.isSmallScreenWidth && <HeaderGap />}
<HeaderWithBackButton
Expand Down
2 changes: 1 addition & 1 deletion src/components/CountryPicker/CountrySelectorModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function CountrySelectorModal({currentCountry, isVisible, onClose, onCountrySele
style={[styles.pb0]}
includePaddingTop={false}
includeSafeAreaPaddingBottom={false}
testID="CountrySelectorModal"
testID={CountrySelectorModal.displayName}
>
<HeaderWithBackButton
title={translate('common.country')}
Expand Down
2 changes: 1 addition & 1 deletion src/components/DistanceRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken,
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableKeyboardAvoidingView={false}
testID="DistanceRequest"
testID={DistanceRequest.displayName}
>
{({safeAreaPaddingBottomStyle}) => (
<FullPageNotFoundView shouldShow={!IOUUtils.isValidMoneyRequestType(iouType)}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/HeaderPageLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function HeaderPageLayout({backgroundColor, children, footer, headerContainerSty
shouldEnablePickerAvoiding={false}
includeSafeAreaPaddingBottom={false}
offlineIndicatorStyle={[appBGColor]}
testID="HeaderPageLayout"
testID={HeaderPageLayout.displayName}
>
{({safeAreaPaddingBottomStyle}) => (
<>
Expand Down
20 changes: 5 additions & 15 deletions src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ import variables from '../styles/variables';
import * as Session from '../libs/actions/Session';
import Hoverable from './Hoverable';
import useWindowDimensions from '../hooks/useWindowDimensions';
import RenderHTML from './RenderHTML';
import getPlatform from '../libs/getPlatform';

const platform = getPlatform();
const isNative = platform === CONST.PLATFORM.IOS || platform === CONST.PLATFORM.ANDROID;
import MenuItemRenderHTMLTitle from './MenuItemRenderHTMLTitle';

const propTypes = menuItemPropTypes;

Expand Down Expand Up @@ -251,16 +247,10 @@ const MenuItem = React.forwardRef((props, ref) => {
</Text>
)}
<View style={[styles.flexRow, styles.alignItemsCenter]}>
{Boolean(props.title) &&
(Boolean(props.shouldRenderAsHTML) || (Boolean(props.shouldParseTitle) && Boolean(html.length))) &&
(isNative ? (
<RenderHTML html={getProcessedTitle} />
) : (
<View style={styles.chatItemMessage}>
<RenderHTML html={getProcessedTitle} />
</View>
))}
{!props.shouldRenderAsHTML && !html.length && Boolean(props.title) && (
{Boolean(props.title) && (Boolean(props.shouldRenderAsHTML) || (Boolean(props.shouldParseTitle) && Boolean(html.length))) && (
<MenuItemRenderHTMLTitle title={getProcessedTitle} />
)}
{!props.shouldRenderAsHTML && !props.shouldParseTitle && Boolean(props.title) && (
<Text
style={titleTextStyle}
numberOfLines={props.numberOfLinesTitle || undefined}
Expand Down
23 changes: 23 additions & 0 deletions src/components/MenuItemRenderHTMLTitle/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import {View} from 'react-native';
import styles from '../../styles/styles';
import RenderHTML from '../RenderHTML';
import menuItemRenderHTMLTitlePropTypes from './propTypes';

const propTypes = menuItemRenderHTMLTitlePropTypes;

const defaultProps = {};

function MenuItemRenderHTMLTitle(props) {
return (
<View style={styles.renderHTMLTitle}>
<RenderHTML html={props.title} />
</View>
);
}

MenuItemRenderHTMLTitle.propTypes = propTypes;
MenuItemRenderHTMLTitle.defaultProps = defaultProps;
MenuItemRenderHTMLTitle.displayName = 'MenuItemRenderHTMLTitle';

export default MenuItemRenderHTMLTitle;
17 changes: 17 additions & 0 deletions src/components/MenuItemRenderHTMLTitle/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import RenderHTML from '../RenderHTML';
import menuItemRenderHTMLTitlePropTypes from './propTypes';

const propTypes = menuItemRenderHTMLTitlePropTypes;

const defaultProps = {};

function MenuItemRenderHTMLTitle(props) {
return <RenderHTML html={props.title} />;
}

MenuItemRenderHTMLTitle.propTypes = propTypes;
MenuItemRenderHTMLTitle.defaultProps = defaultProps;
MenuItemRenderHTMLTitle.displayName = 'MenuItemRenderHTMLTitle';

export default MenuItemRenderHTMLTitle;
8 changes: 8 additions & 0 deletions src/components/MenuItemRenderHTMLTitle/propTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import PropTypes from 'prop-types';

const propTypes = {
/** Processed title to display for the MenuItem */
title: PropTypes.string.isRequired,
};

export default propTypes;
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function YearPickerModal(props) {
style={[styles.pb0]}
includePaddingTop={false}
includeSafeAreaPaddingBottom={false}
testID="YearPickerModal"
testID={YearPickerModal.displayName}
>
<HeaderWithBackButton
title={translate('yearPickerPage.year')}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReimbursementAccountLoadingIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function ReimbursementAccountLoadingIndicator(props) {
<ScreenWrapper
shouldShowOfflineIndicator={false}
style={[StyleSheet.absoluteFillObject, styles.reimbursementAccountFullScreenLoading]}
testID="ReimbursementAccountLoadingIndicator"
testID={ReimbursementAccountLoadingIndicator.displayName}
>
<HeaderWithBackButton
title={translate('reimbursementAccountLoadingAnimation.oneMoment')}
Expand Down
2 changes: 1 addition & 1 deletion src/components/StatePicker/StateSelectorModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function StateSelectorModal({currentState, isVisible, onClose, onStateSelected,
style={[styles.pb0]}
includePaddingTop={false}
includeSafeAreaPaddingBottom={false}
testID="StateSelectorModal"
testID={StateSelectorModal.displayName}
>
<HeaderWithBackButton
title={label || translate('common.state')}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/AppNavigator/ModalStackNavigators.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ const NewTeachersUniteNavigator = createModalStackNavigator([
},
{
getComponent: () => {
const IntroSchoolPrincipalPage = require('../../../pages/TeachersUnite/IntroSchoolPrincipalPage').default;
const IntroSchoolPrincipalPage = require('../../../pages/TeachersUnite/ImTeacherPage').default;
return IntroSchoolPrincipalPage;
},
name: 'Intro_School_Principal',
Expand Down
28 changes: 18 additions & 10 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -947,23 +947,31 @@ function getIconsForParticipants(participants, personalDetails) {
for (let i = 0; i < participantsList.length; i++) {
const accountID = participantsList[i];
const avatarSource = UserUtils.getAvatar(lodashGet(personalDetails, [accountID, 'avatar'], ''), accountID);
participantDetails.push([
accountID,
lodashGet(personalDetails, [accountID, 'displayName']) || lodashGet(personalDetails, [accountID, 'login'], ''),
lodashGet(personalDetails, [accountID, 'firstName'], ''),
avatarSource,
]);
const displayNameLogin = lodashGet(personalDetails, [accountID, 'displayName']) || lodashGet(personalDetails, [accountID, 'login'], '');
participantDetails.push([accountID, displayNameLogin, avatarSource]);
}

// Sort all logins by first name (which is the second element in the array)
const sortedParticipantDetails = participantDetails.sort((a, b) => a[2] - b[2]);
const sortedParticipantDetails = _.chain(participantDetails)
.sort((first, second) => {
// First sort by displayName/login
const displayNameLoginOrder = first[1].localeCompare(second[1]);
if (displayNameLoginOrder !== 0) {
return displayNameLoginOrder;
}

// Then fallback on accountID as the final sorting criteria.
// This will ensure that the order of avatars with same login/displayName
// stay consistent across all users and devices
return first[0] > second[0];
})
.value();

// Now that things are sorted, gather only the avatars (third element in the array) and return those
// Now that things are sorted, gather only the avatars (second element in the array) and return those
const avatars = [];
for (let i = 0; i < sortedParticipantDetails.length; i++) {
const userIcon = {
id: sortedParticipantDetails[i][0],
source: sortedParticipantDetails[i][3],
source: sortedParticipantDetails[i][2],
type: CONST.ICON_TYPE_AVATAR,
name: sortedParticipantDetails[i][1],
};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AddPersonalBankAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class AddPersonalBankAccountPage extends React.Component {
includeSafeAreaPaddingBottom={shouldShowSuccess}
shouldEnablePickerAvoiding={false}
shouldShowOfflineIndicator={false}
testID="AddPersonalBankAccountPage"
testID={AddPersonalBankAccountPage.displayName}
>
<HeaderWithBackButton
title={this.props.translate('bankAccount.addBankAccount')}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/DetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function DetailsPage(props) {
const isCurrentUser = _.keys(props.loginList).includes(details.login);

return (
<ScreenWrapper testID="DetailsPage">
<ScreenWrapper testID={DetailsPage.displayName}>
<FullPageNotFoundView shouldShow={_.isEmpty(login)}>
<HeaderWithBackButton title={props.translate('common.details')} />
<View
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EditRequestAmountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function EditRequestAmountPage({defaultAmount, defaultCurrency, onSubmit, report
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
testID="EditRequestAmountPage"
testID={EditRequestAmountPage.displayName}
>
<HeaderWithBackButton title={translate('iou.amount')} />
<MoneyRequestAmountForm
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EditRequestCategoryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function EditRequestCategoryPage({defaultCategory, policyID, onSubmit}) {
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
testID="EditRequestCategoryPage"
testID={EditRequestCategoryPage.displayName}
>
<HeaderWithBackButton
title={translate('common.category')}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EditRequestCreatedPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function EditRequestCreatedPage({defaultCreated, onSubmit}) {
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
testID="EditRequestCreatedPage"
testID={EditRequestCreatedPage.displayName}
>
<HeaderWithBackButton title={translate('common.date')} />
<Form
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EditRequestDescriptionPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function EditRequestDescriptionPage({defaultDescription, onSubmit}) {
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
testID="EditRequestDescriptionPage"
testID={EditRequestDescriptionPage.displayName}
>
<HeaderWithBackButton title={translate('common.description')} />
<Form
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EditRequestMerchantPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function EditRequestMerchantPage({defaultMerchant, onSubmit}) {
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
onEntryTransitionEnd={() => merchantInputRef.current && merchantInputRef.current.focus()}
testID="EditRequestMerchantPage"
testID={EditRequestMerchantPage.displayName}
>
<HeaderWithBackButton title={translate('common.merchant')} />
<Form
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EditRequestReceiptPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function EditRequestReceiptPage({route, transactionID}) {
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
testID="EditRequestReceiptPage"
testID={EditRequestReceiptPage.displayName}
>
<HeaderWithBackButton
title={translate('common.receipt')}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EnablePayments/AdditionalDetailsStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function AdditionalDetailsStep({walletAdditionalDetails, translate, currentUserP
<ScreenWrapper
style={[styles.flex1]}
keyboardAvoidingViewBehavior="height"
testID="AdditionalDetailsStep"
testID={AdditionalDetailsStep.displayName}
>
<HeaderWithBackButton
title={translate('additionalDetailsStep.headerTitle')}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EnablePayments/EnablePaymentsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class EnablePaymentsPage extends React.Component {
return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
testID="EnablePaymentsPage"
testID={EnablePaymentsPage.displayName}
>
{() => {
if (this.props.userWallet.errorCode === CONST.WALLET.ERROR.KYC) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ErrorPage/NotFoundPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoun
// eslint-disable-next-line rulesdir/no-negated-variables
function NotFoundPage() {
return (
<ScreenWrapper testID="NotFoundPage">
<ScreenWrapper testID={NotFoundPage.displayName}>
<FullPageNotFoundView shouldShow />
</ScreenWrapper>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/FlagCommentPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function FlagCommentPage(props) {
return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
testID="FlagCommentPage"
testID={FlagCommentPage.displayName}
>
{({safeAreaPaddingBottomStyle}) => (
<FullPageNotFoundView shouldShow={!ReportUtils.shouldShowFlagComment(getActionToFlag(), props.report)}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/GetAssistancePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function GetAssistancePage(props) {
}

return (
<ScreenWrapper testID="GetAssistancePage">
<ScreenWrapper testID={GetAssistancePage.displayName}>
<HeaderWithBackButton
title={props.translate('getAssistancePage.title')}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/NewChatPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function NewChatPage({betas, isGroupChat, personalDetails, reports, translate})
includeSafeAreaPaddingBottom={false}
includePaddingTop={false}
shouldEnableMaxHeight
testID="NewChatPage"
testID={NewChatPage.displayName}
>
{({safeAreaPaddingBottomStyle, insets}) => (
<KeyboardAvoidingView
Expand Down
2 changes: 1 addition & 1 deletion src/pages/NewChatSelectorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function NewChatSelectorPage(props) {
shouldEnableKeyboardAvoidingView={false}
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
testID="NewChatSelectorPage"
testID={NewChatSelectorPage.displayName}
>
<HeaderWithBackButton
title={props.translate('sidebarScreen.fabNewChat')}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/PrivateNotes/PrivateNotesEditPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function PrivateNotesEditPage({route, personalDetailsList, session, report}) {
return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
testID="EditRequestDescriptionPage"
testID={PrivateNotesEditPage.displayName}
>
<FullPageNotFoundView
shouldShow={_.isEmpty(report) || _.isEmpty(report.privateNotes) || !_.has(report, ['privateNotes', route.params.accountID, 'note']) || !isCurrentUserNote}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/PrivateNotes/PrivateNotesListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function PrivateNotesListPage({report, personalDetailsList, network, session}) {
return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
testID="PrivateNotesListPage"
testID={PrivateNotesListPage.displayName}
>
<FullPageNotFoundView shouldShow={_.isEmpty(report.reportID) || (!report.isLoadingPrivateNotes && network.isOffline && _.isEmpty(lodashGet(report, 'privateNotes', {})))}>
<HeaderWithBackButton
Expand Down
2 changes: 1 addition & 1 deletion src/pages/PrivateNotes/PrivateNotesViewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function PrivateNotesViewPage({route, personalDetailsList, session, report}) {
return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
testID="PrivateNotesViewPage"
testID={PrivateNotesViewPage.displayName}
>
<FullPageNotFoundView
shouldShow={_.isEmpty(report) || _.isEmpty(report.privateNotes) || !_.has(report, ['privateNotes', route.params.accountID, 'note'])}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function ProfilePage(props) {
}, [accountID, hasMinimumDetails]);

return (
<ScreenWrapper testID="ProfilePage">
<ScreenWrapper testID={ProfilePage.displayName}>
<HeaderWithBackButton
title={props.translate('common.profile')}
onBackButtonPress={() => Navigation.goBack(navigateBackTo)}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ReimbursementAccount/ACHContractStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function ACHContractStep(props) {
return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
testID="ACHContractStep"
testID={ACHContractStep.displayName}
>
<HeaderWithBackButton
title={props.translate('beneficialOwnersStep.additionalInformation')}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ReimbursementAccount/BankAccountManualStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function BankAccountManualStep(props) {
return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
testID="BankAccountManualStep"
testID={BankAccountManualStep.displayName}
>
<HeaderWithBackButton
title={translate('workspace.common.connectBankAccount')}
Expand Down
Loading

0 comments on commit 6675aa2

Please sign in to comment.