Repository navigation
Conversation
94a3be1 to
38177aa
Compare
|
@abzokhattab Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
…dals-in-MoneyReportHeader
| onSelected: () => { | ||
| if (hasCustomUnitOutOfPolicyViolation) { | ||
| setRateErrorModalVisible(true); | ||
| showConfirmModal({ |
There was a problem hiding this comment.
❌ CONSISTENCY-3 (docs)
The three showConfirmModal calls (for rate error, distance expense error, and per diem error) are nearly identical -- they share the same title, confirmText, and shouldShowCancelButton and differ only in prompt. This duplicated structure can be consolidated into a small helper.
Suggested fix -- extract a helper above the onSelected callback:
const showDuplicateExpenseError = (prompt: string) => {
showConfirmModal({
title: translate('common.duplicateExpense'),
prompt,
confirmText: translate('common.buttonConfirm'),
shouldShowCancelButton: false,
});
};Then replace each call site:
if (hasCustomUnitOutOfPolicyViolation) {
showDuplicateExpenseError(translate('iou.correctRateError'));
return;
}
if (isDistanceExpenseUnsupportedForDuplicating) {
showDuplicateExpenseError(translate('iou.cannotDuplicateDistanceExpense'));
return;
}
if (isPerDiemRequestOnNonDefaultWorkspace) {
showDuplicateExpenseError(translate('iou.duplicateNonDefaultWorkspacePerDiemError'));
return;
}Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
I think it's not a bad suggestion but its not a blocker
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
🚧 @rlinoz has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/rlinoz in version: 9.3.52-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required. This PR is a pure internal refactor that converts three declarative |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.52-9 🚀
|
Explanation of Change
Converted 3 simple dismiss-only
<ConfirmModal>instances inMoneyReportHeaderto imperativeshowConfirmModal()calls.useStatedeclarations (rateErrorModalVisible,duplicateDistanceErrorModalVisible,duplicatePerDiemErrorModalVisible)<ConfirmModal>JSX blocks from the render sectionConfirmModalimportThese modals are triggered from the "Duplicate Expense" secondary action and only show an error message with a dismiss button — zero behavioral change.
Part of a larger effort to decompose
MoneyReportHeader.tsxfollowing CLEAN-REACT-PATTERNS rules.Fixed Issues
$ #84123
PROPOSAL:
Tests
Prerequisites: Have at least two workspaces
Offline tests
N/A — modals are simple dismiss-only error dialogs with no network dependency.
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari