negative currency bug fixed
Refactor TransactionModal component for improved readability and functionality. Added validation for cost input and adjusted form handling for better user experience.also fix negative currency issue
Description
This PR refactors the TransactionModal component to enhance readability, maintainability, and user experience. It also adds validation logic to prevent users from entering negative or invalid values in the amount (cost) field. Additionally, the form handling flow has been simplified to improve clarity and usability. Key updates include:
Added validation to block negative or zero values for cost.
Improved input handling and error feedback for smoother UX.
Refactored code into smaller logical sections for better readability.
Adjusted default form data initialization and view switching.
Fixed issue where negative amounts appeared in transaction history.
Related Issue
This PR addresses a reported bug where negative transaction amounts were accepted and displayed.
Motivation and Context
Previously, users were able to input negative values for transaction amounts, which caused inaccurate balance calculations and incorrect transaction records. This fix ensures that:
Expense and income inputs remain positive.
The form provides clear feedback when invalid input is detected.
The overall user experience and data consistency are improved.
Types of Changes
- [x ] Bug fix (non-breaking change which fixes an issue)
- [ x] New feature (non-breaking change which adds functionality)
- [ ] Enhancement (improvement to an existing feature)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Test (adds or updates tests only)
- [ ] Documentation (non-code change)
How Has This Been Tested?
Manually tested form submissions for both expense and income transactions.
Attempted to enter negative and non-numeric values — validation prevented submission as expected.
Verified transactions are recorded correctly in both add and edit modes.
Checked modal switching between expense/income modes for data consistency.
Confirmed UI displays correct error messages and handles valid inputs smoothly. Environment: OS: Windows 11
Browser: Chrome (latest)
Framework: React 18
Backend: Flask API (via Docker)
Checklist
- [x ] My code follows the code style of this project
- [ ] My change requires a change to the documentation
- [x ] I have updated the documentation accordingly
- [x ] I have added tests to cover my changes
- [ ] All new and existing tests passed
Deploy Preview for paisable ready!
| Name | Link |
|---|---|
| Latest commit | faff3e7561ce7280a3632299be3f586172924c4d |
| Latest deploy log | https://app.netlify.com/projects/paisable/deploys/68ff61ccfb94e100081a67a7 |
| Deploy Preview | https://deploy-preview-178--paisable.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
Lighthouse |
1 paths audited Performance: 94 Accessibility: 100 Best Practices: 100 SEO: 91 PWA: 80 View the detailed breakdown and full score reports |
To edit notification comments on pull requests, go to your Netlify project configuration.
please review this changes
