Reapply PR #56092: Add PlusMinus icon and allow negative values in MoneyRequestAmountInput#65545
Closed
Reapply PR #56092: Add PlusMinus icon and allow negative values in MoneyRequestAmountInput#65545
Conversation
Copilot
AI
changed the title
[WIP] Reapply changes from reverted PR #56092: Allow negative values in MoneyRequestAmountInput
Reapply PR #56092: Add PlusMinus icon and allow negative values in MoneyRequestAmountInput
Jul 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR reapplies all changes from PR #56092 "Add PlusMinus icon and allow negative values in MoneyRequestAmountInput" that were reverted by PR #64919. The implementation restores the complete negative value functionality for expense reporting, matching the state after merge commit 146dd00.
Changes Made
Core Functionality
assets/images/plus-minus.svgand integrated it into the Expensicons systemFiles Modified (26 total)
UI Components
src/components/MoneyRequestAmountInput.tsx- Added negative value props and logicsrc/components/TextInputWithCurrencySymbol/BaseTextInputWithCurrencySymbol.tsx- Added negative symbol displaysrc/components/TextInputWithCurrencySymbol/types.ts- AddedisNegativeprop typesrc/pages/iou/MoneyRequestAmountForm.tsx- Added flip button and negative state managementsrc/pages/iou/request/MoneyRequestParticipantsSelector.tsx- Added workspace-only filtering for negative amountssrc/pages/iou/request/step/IOURequestStepAmount.tsx- Added negative amount supportsrc/pages/iou/request/step/IOURequestStepConfirmation.tsx- Removed Math.abs() to preserve negative valuessrc/pages/iou/request/step/IOURequestStepParticipants.tsx- Added workspace constraint logicBackend Logic
src/libs/TransactionUtils/index.ts- UpdatedgetAmount()withallowNegativeanddisableOppositeConversionparameterssrc/libs/ReportUtils.ts- AddedshouldEnableNegative()function and updated transaction processingsrc/libs/actions/IOU.ts- Updated money request handlers to support negative amountssrc/libs/ModifiedExpenseMessage.ts- Fixed amount comparison to handle negative valuesInternationalization
src/languages/en.ts- "Flip"src/languages/de.ts- "Umkehren"src/languages/es.ts- "Cambiar"src/languages/fr.ts- "Inverser"src/languages/it.ts- "Inverti"src/languages/ja.ts- "反転"src/languages/nl.ts- "Omdraaien"src/languages/pl.ts- "Odwróć"src/languages/pt-BR.ts- "Inverter"src/languages/zh-hans.ts- "翻转"Supporting Files
src/components/Icon/Expensicons.ts- Added PlusMinus icon exportsrc/styles/utils/spacing.ts- AddedminWidth18style for flip buttonsrc/components/ReportActionItem/MoneyRequestView.tsx- Updated to use negative-aware transaction detailsTechnical Implementation
New Props and Functions
allowFlippingAmount: boolean- Controls visibility of flip buttonisNegative: boolean- Tracks negative statetoggleNegative()- Toggles between positive/negativeclearNegative()- Resets to positiveshouldEnableNegative(report, policy, iouType)- Determines if negative amounts are allowedAmount Processing
getAmount()in TransactionUtils to preserve negative values whenallowNegative=truedisableOppositeConversionparameter to bypass automatic sign flippingUI Behavior
-input for workspace expensesTesting
✅ All automated tests pass
✅ Icon integration verified
✅ Translation coverage confirmed
✅ Component prop validation successful
✅ Backend logic validation complete
Manual Testing Scenarios
Based on the original PR test plan:
Mobile Testing
Desktop Testing
-key input works for workspace expensesRelated Issues
Risk Assessment
Low Risk - This is a direct restoration of previously merged and tested functionality. All changes are isolated to expense reporting flows and maintain backward compatibility.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.