fix: investment form leading zeros, nav prop mismatch, decimal rounding + add return projection - #491
Merged
Conversation
…eturn projection - Strip leading zeros in AmountInput so "007" becomes "7" instead of displaying an unprofessional zero-padded number (Heliobond#370). - Simplify Landing's onNav(screen) to onExplore(), since it was only ever called with 'explore' — the prop signature now matches its actual, single behaviour (Heliobond#373). - Add roundToDecimals/roundToCents/formatDecimal helpers and round investment amounts once to cents, reusing that value everywhere it's displayed, so Deposit and Withdraw no longer show inconsistent rounded figures like 2.00 next to an underlying 1.995 (Heliobond#369). - Show a real-time projected 1-year return next to the deposit amount input, computed from the pool's bond yield via a new projectedReturn helper (Heliobond#367). Closes Heliobond#370 Closes Heliobond#373 Closes Heliobond#369 Closes Heliobond#367
|
@SarahDoma is attempting to deploy a commit to the David Dada's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@SarahDoma Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
sshdopey
approved these changes
Aug 30, 2026
sshdopey
left a comment
Contributor
There was a problem hiding this comment.
This is a lovely, well-scoped PR that tackles four distinct issues with care. The leading-zero fix, the prop rename, the consistent rounding helpers, and the new projection feature all directly address the linked issues and include tests. The code is clean and the changes are focused. Great work, Sarah! 🎉 Keep it up!
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
Four small, focused fixes/enhancements to the investment (deposit) flow:
sanitizeAmountnow strips leading zeros from the whole-number part as the user types, so007becomes7instead of displaying an unprofessional zero-padded amount.0and0.5still work correctly while typing.onNavignoring its argument —Landing'sonNav: (screen: Screen) => voidprop was only ever called with'explore'. Renamed toonExplore: () => voidinLanding.tsx,src/app/page.tsx, andsrc/app/verify/page.tsxso the prop's type now matches its actual, single behaviour.roundToDecimals/roundToCents/formatDecimaltosrc/lib/format.ts(decimal-precision rounding, avoiding binary floating-point artifacts like(1.005).toFixed(2) === '1.00').Deposit.tsxandWithdraw.tsxnow round the entered amount once to cents and reuse that single rounded value everywhere it's displayed (pay amount, fee, net proceeds, review row), instead of each.toFixed()call re-rounding the raw float independently.projectedReturn(amount, annualYieldPct, years)tosrc/lib/bondUtils.tsand a real-time "Projected return in 1 year" line next to the deposit amount input, computed from the pool's bond yield (HB_DATA.pool.projectedRate). NewDeposit.projectionkey added to bothmessages/en.jsonandmessages/fr.json.Linked issues
Closes #370
Closes #373
Closes #369
Closes #367
Type of change
Testing
AmountInput.test.tsx.bun run buildcompiles successfully (Turbopack); the TypeScript check step surfaces pre-existing type errors unrelated to this change (present onmainprior to this branch, verified by diffing typecheck output againstmain).bun run lint— no new lint errors introduced (verified by diffing againstmain).bun run format:check— all files touched by this PR are formatted; remaining warnings are in files not touched by this PR.bun run test— all new/existing tests around the changed code pass; the 3 pre-existing failing test files (useSessionTimeout.test.ts,AdminConsole.test.tsx) fail identically onmainand are unrelated to this change.Checklist
Closes #…)messages/en.jsonandmessages/fr.json