Skip to content

Conversation

@Bekiboo
Copy link
Collaborator

@Bekiboo Bekiboo commented Jan 27, 2026

Description of change

transfer-modal.tsx

  • Preserve trailing decimals (e.g., "100." stays as "100.")
  • Format only integer part with thousand separators
  • Decimal part remains unformatted

custom-number-input.tsx

  • Simplified comma handling: if user types comma without existing dot → convert to decimal point
  • Strip all other commas (thousand separators from formatting)
  • Replaced deprecated keyCode with modern e.key API
  • Allow all Ctrl/Cmd shortcuts (undo, redo, etc.)

Issue Number

Closes #710

Type of change

  • Update (a change which updates existing functionality)
  • Fix (a change which fixes an issue)

How the change has been tested

Tested on desktop + virtual device.
Couldn't test on iOS, but it should work

Change checklist

  • I have ensured that the CI Checks pass locally
  • I have removed any unnecessary logic
  • My code is well documented
  • I have signed my commits
  • My code follows the pattern of the application
  • I have self reviewed my code

Summary by CodeRabbit

  • Bug Fixes
    • Amount input preserves decimals while adding thousand separators, including proper trailing-decimal behavior on mobile.
    • International input normalization: commas and dots handled reliably for typing and paste scenarios.
    • Improved keyboard handling to allow locale decimal entry and common shortcuts while blocking invalid characters for more consistent cross-platform input.

✏️ Tip: You can customize this high-level summary in your review settings.

@Bekiboo Bekiboo self-assigned this Jan 27, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

Reworked numeric input handling: custom-number-input.tsx now normalizes international decimal/thousand separators on keypress and paste, and centralizes cleaned-value validation. transfer-modal.tsx formats the integer part with thousands separators while preserving the decimal fraction and any trailing decimal point for correct iOS behavior.

Changes

Cohort / File(s) Summary
International Decimal Input Handling
platforms/eCurrency/client/src/components/ui/custom-number-input.tsx
Key-based keyboard handling; detect typed comma via nativeEvent.data; convert trailing comma to dot when appropriate; normalize pasted input (handle mixed dot/comma separators, select last separator as decimal, strip thousands separators); sanitize to a numeric string with at most one decimal and call onChange with the cleaned value.
Transfer Modal Formatting
platforms/eCurrency/client/src/components/currency/transfer-modal.tsx
Assume incoming value is cleaned (no thousands separators); format integer part with thousands separators while preserving decimal fraction and trailing decimal point; update amount state accordingly to preserve iOS trailing-decimal entry and correct decimal handling.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Browser
  participant CustomInput as CustomNumberInput
  participant TransferModal as TransferModal

  User->>Browser: Type key or paste clipboard
  Browser->>CustomInput: deliver key event / paste data
  CustomInput->>CustomInput: detect comma/dot, normalize separators, strip thousands, sanitize value
  alt valid cleaned value
    CustomInput->>TransferModal: onChange(cleanedValue)
    TransferModal->>TransferModal: format integer with thousands, preserve decimal/trailing dot
    TransferModal->>CustomInput: set formatted display value
  else invalid
    CustomInput->>CustomInput: block/ignore input
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • coodos

Poem

🐰 I nudged the commas, nudged the dot with care,

so tiny decimals can dance in the air—
iPhone taps now hum a tidy tune,
numbers sparkle under a thousand-moon,
a hopping rabbit claps, delighted and fair.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the primary change: enhancing keyboard input handling for the CustomNumberInput component to support decimal value entry.
Description check ✅ Passed The description covers required sections (change details, issue number, type of change, testing method) and includes a completed checklist, though testing coverage is limited to non-iOS devices.
Linked Issues check ✅ Passed The changes directly address issue #710 by improving decimal input handling on iOS through comma-to-dot conversion, handling thousand separators, and using modern keyboard APIs.
Out of Scope Changes check ✅ Passed All changes are focused on fixing decimal value input in CustomNumberInput and transfer-modal components, directly addressing the iOS decimal entry issue without unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Bekiboo Bekiboo marked this pull request as ready for review January 27, 2026 11:32
@Bekiboo Bekiboo requested a review from coodos as a code owner January 27, 2026 11:32
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@platforms/eCurrency/client/src/components/ui/custom-number-input.tsx`:
- Around line 28-43: The paste handler handlePaste currently blindly replaces
all commas with dots which corrupts numbers using thousands separators; update
handlePaste to detect the decimal separator by checking the last occurrence of
'.' and ',' in pastedText (whichever appears later is the decimal separator),
then remove all occurrences of the other separator (treat as thousands
separators), normalize the detected decimal separator to a dot, strip any
non-digits or the single decimal point, and ensure only one decimal point
remains before calling onChange with the sanitized value; reference handlePaste,
pastedText, cleaned, parts, and sanitized to locate and adjust the logic.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@platforms/eCurrency/client/src/components/ui/custom-number-input.tsx`:
- Around line 15-25: The handling currently only replaces a trailing comma;
update the logic that uses nativeEvent.data to convert a user-inserted comma at
the caret into a dot anywhere in the string: when nativeEvent.data === ','
determine the insertion index from the input's caret (using
selectionStart/selectionEnd from the event target), replace the comma at that
index in value with '.' (instead of only replacing a trailing comma), then
proceed to strip formatting commas into cleanValue; reference nativeEvent.data,
value, cleanValue and use the event target's selectionStart/selectionEnd to
locate the inserted comma.

@coodos coodos merged commit 2ca826c into main Jan 27, 2026
4 checks passed
@coodos coodos deleted the fix/decimal-values-ecurrency branch January 27, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [iPhone] [Chrome/Safari] eCurrency: Cannot enter decimal values in transactions

3 participants