Skip to content
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
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001031503
versionName "1.3.15-3"
versionCode 1001031504
versionName "1.3.15-4"
}

splits {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.15.3</string>
<string>1.3.15.4</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.3.15.3</string>
<string>1.3.15.4</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.3.15-3",
"version": "1.3.15-4",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
57 changes: 50 additions & 7 deletions src/components/MoneyRequestHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import lodashGet from 'lodash/get';
import {withOnyx} from 'react-native-onyx';
import HeaderWithCloseButton from './HeaderWithCloseButton';
import iouReportPropTypes from '../pages/iouReportPropTypes';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
Expand All @@ -19,11 +20,17 @@ import Navigation from '../libs/Navigation/Navigation';
import ROUTES from '../ROUTES';
import Icon from './Icon';
import * as CurrencyUtils from '../libs/CurrencyUtils';
import MenuItemWithTopDescription from './MenuItemWithTopDescription';
import DateUtils from '../libs/DateUtils';
import ONYXKEYS from '../ONYXKEYS';

const propTypes = {
/** The report currently being looked at */
report: iouReportPropTypes.isRequired,

/** The expense report or iou report (only will have a value if this is a transaction thread) */
parentReport: iouReportPropTypes,

/** The policies which the user has access to and which the report could be tied to */
policies: PropTypes.shape({
/** Name of the policy */
Expand All @@ -41,16 +48,27 @@ const propTypes = {

const defaultProps = {
isSingleTransactionView: false,
parentReport: {},
};

const MoneyRequestHeader = (props) => {
// These are only used for the single transaction view and not "money requests"
const transactionAmount = lodashGet(props.parentReportAction, ['originalMessage', 'amount']);
const transactionCurrency = lodashGet(props.parentReportAction, ['originalMessage', 'currency']);
const transactionDescription = lodashGet(props.parentReportAction, ['originalMessage', 'comment']);
const formattedTransactionAmount = transactionAmount && transactionCurrency && CurrencyUtils.convertToDisplayString(transactionAmount, transactionCurrency);
const transactionDate = lodashGet(props.parentReportAction, ['created']);
const formattedTransactionDate = DateUtils.getDateStringFromISOTimestamp(transactionDate);

const formattedAmount = CurrencyUtils.convertToDisplayString(ReportUtils.getMoneyRequestTotal(props.report), props.report.currency);
const isSettled = ReportUtils.isSettled(props.report.reportID);
const isExpenseReport = ReportUtils.isExpenseReport(props.report);
const payeeName = isExpenseReport ? ReportUtils.getPolicyName(props.report, props.policies) : ReportUtils.getDisplayNameForParticipant(props.report.managerEmail);

const moneyRequestReport = props.isSingleTransactionView ? props.parentReport : props.report;
const isSettled = ReportUtils.isSettled(moneyRequestReport.reportID);
const isExpenseReport = ReportUtils.isExpenseReport(moneyRequestReport);
const payeeName = isExpenseReport ? ReportUtils.getPolicyName(moneyRequestReport, props.policies) : ReportUtils.getDisplayNameForParticipant(moneyRequestReport.managerEmail);
const payeeAvatar = isExpenseReport
? ReportUtils.getWorkspaceAvatar(props.report)
: ReportUtils.getAvatar(lodashGet(props.personalDetails, [props.report.managerEmail, 'avatar']), props.report.managerEmail);
? ReportUtils.getWorkspaceAvatar(moneyRequestReport)
: ReportUtils.getAvatar(lodashGet(props.personalDetails, [moneyRequestReport.managerEmail, 'avatar']), moneyRequestReport.managerEmail);
return (
<View style={[{backgroundColor: themeColors.highlightBG}, styles.pl0]}>
<HeaderWithCloseButton
Expand All @@ -64,7 +82,7 @@ const MoneyRequestHeader = (props) => {
},
]}
threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton}
report={props.report}
report={moneyRequestReport}
policies={props.policies}
personalDetails={props.personalDetails}
shouldShowCloseButton={false}
Expand Down Expand Up @@ -111,6 +129,23 @@ const MoneyRequestHeader = (props) => {
</View>
</View>
</View>
{props.isSingleTransactionView && (
<>
<MenuItemWithTopDescription
title={formattedTransactionAmount}
description={`${props.translate('iou.amount')} • ${props.translate('iou.cash')}`}
titleStyle={styles.newKansasLarge}
/>
<MenuItemWithTopDescription
description={props.translate('common.description')}
title={transactionDescription}
/>
<MenuItemWithTopDescription
description={props.translate('common.date')}
title={formattedTransactionDate}
/>
</>
)}
</View>
);
};
Expand All @@ -119,4 +154,12 @@ MoneyRequestHeader.displayName = 'MoneyRequestHeader';
MoneyRequestHeader.propTypes = propTypes;
MoneyRequestHeader.defaultProps = defaultProps;

export default compose(withWindowDimensions, withLocalize)(MoneyRequestHeader);
export default compose(
withWindowDimensions,
withLocalize,
withOnyx({
parentReport: {
key: (props) => `${ONYXKEYS.COLLECTION.REPORT}${props.report.parentReportID}`,
},
}),
)(MoneyRequestHeader);
14 changes: 14 additions & 0 deletions src/libs/DateUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,19 @@ function subtractMillisecondsFromDateTime(dateTime, milliseconds) {
return getDBTime(newTimestamp);
}

/**
* @param {string} isoTimestamp example: 2023-05-16 05:34:14.388
* @returns {string} example: 2023-05-16
*/
function getDateStringFromISOTimestamp(isoTimestamp) {
if (!isoTimestamp) {
return '';
}

const [dateString] = isoTimestamp.split(' ');
return dateString;
}

/**
* @namespace DateUtils
*/
Expand All @@ -206,6 +219,7 @@ const DateUtils = {
getMicroseconds,
getDBTime,
subtractMillisecondsFromDateTime,
getDateStringFromISOTimestamp,
};

export default DateUtils;
7 changes: 5 additions & 2 deletions src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ class ReportScreen extends React.Component {
// the moment the ReportScreen becomes unfrozen we want to start the animation of the placeholder skeleton content
// (which is shown, until all the actual views of the ReportScreen have been rendered)
const shouldAnimate = !shouldFreeze;

const parentReportAction = ReportActionsUtils.getParentReportAction(this.props.report);
const isSingleTransactionView = ReportActionsUtils.isTransactionThread(parentReportAction);
return (
<ScreenWrapper style={screenWrapperStyle}>
<Freeze
Expand Down Expand Up @@ -281,11 +282,13 @@ class ReportScreen extends React.Component {
errors={addWorkspaceRoomOrChatErrors}
shouldShowErrorMessages={false}
>
{ReportUtils.isMoneyRequestReport(this.props.report) ? (
{ReportUtils.isMoneyRequestReport(this.props.report) || isSingleTransactionView ? (
<MoneyRequestHeader
report={this.props.report}
policies={this.props.policies}
personalDetails={this.props.personalDetails}
isSingleTransactionView={isSingleTransactionView}
parentReportAction={parentReportAction}
/>
) : (
<HeaderView
Expand Down