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

Display submitted message in report action #41040

Merged
merged 17 commits into from
Jul 4, 2024
Merged
Changes from 2 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: 4 additions & 0 deletions src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import ControlSelection from '@libs/ControlSelection';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
import * as ErrorUtils from '@libs/ErrorUtils';
import focusTextInputAfterAnimation from '@libs/focusTextInputAfterAnimation';
Expand Down Expand Up @@ -580,6 +581,9 @@ function ReportActionItem({
} else if (ReportActionsUtils.isOldDotReportAction(action)) {
// This handles all historical actions from OldDot that we just want to display the message text
children = <ReportActionItemBasicMessage message={ReportActionsUtils.getMessageOfOldDotReportAction(action)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.SUBMITTED) {
const formattedAmount = CurrencyUtils.convertToDisplayString(Math.abs(report?.total ?? 0), report.currency);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added report?.total ?? 0 to pass the ts check, but total will be always present if the report action is submitted, since that action only exists in expense reports.

children = <ReportActionItemBasicMessage message={translate('iou.submittedAmount', {formattedAmount})} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) {
children = <ReportActionItemBasicMessage message={translate('iou.heldExpense')} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD_COMMENT) {
Expand Down
Loading