-
Notifications
You must be signed in to change notification settings - Fork 4.7k
use micros converters in FormCurrencyFieldInput #16330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
use micros converters in FormCurrencyFieldInput #16330
Conversation
Welcome!
Hello there, congrats on your first PR! We're excited to have you contributing to this project. |
Greptile OverviewGreptile SummaryImproved user experience by converting currency input from micros (e.g., 3210000) to human-readable format (e.g., 3.21) using
Issues found:
Confidence Score: 3/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant FormCurrencyFieldInput
participant FormNumberFieldInput
participant Converter as convertCurrencyToCurrencyMicros
participant Parent as onChange callback
User->>FormCurrencyFieldInput: Loads form with defaultValue
FormCurrencyFieldInput->>Converter: convertCurrencyMicrosToCurrencyAmount(defaultValue.amountMicros)
Converter-->>FormCurrencyFieldInput: Returns human-readable amount (e.g., 3.21)
FormCurrencyFieldInput->>FormNumberFieldInput: Renders with converted defaultValue
User->>FormNumberFieldInput: Enters amount (e.g., "3.21")
FormNumberFieldInput->>FormCurrencyFieldInput: handleAmountMicrosChange(3.21)
FormCurrencyFieldInput->>Converter: convertCurrencyAmountToCurrencyMicros(Number(3.21))
Converter-->>FormCurrencyFieldInput: Returns 3210000 micros
FormCurrencyFieldInput->>Parent: onChange({currencyCode, amountMicros: 3210000})
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 2 comments
...t/src/modules/object-record/record-field/ui/form-types/components/FormCurrencyFieldInput.tsx
Outdated
Show resolved
Hide resolved
...t/src/modules/object-record/record-field/ui/form-types/components/FormCurrencyFieldInput.tsx
Outdated
Show resolved
Hide resolved
...t/src/modules/object-record/record-field/ui/form-types/components/FormCurrencyFieldInput.tsx
Outdated
Show resolved
Hide resolved
...t/src/modules/object-record/record-field/ui/form-types/components/FormCurrencyFieldInput.tsx
Outdated
Show resolved
Hide resolved
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:26830 This environment will automatically shut down when the PR is closed or after 5 hours. |
Fixes: #15887
The currency fields were expecting values in micros (multiplied by 10^6), but
this requirement was not indicated anywhere in the workflow UI. Users had to
manually add a code node to multiply amounts by 10^6 before using the new
currency value.
This change integrates the micros conversion logic directly into
FormCurrencyFieldInput by using convertCurrencyAmountToCurrencyMicros and
convertCurrencyMicrosToCurrencyAmount utilities. This allows users to input
human-readable decimal amounts (e.g., 3.21 for $3.21) in the form, which are
automatically converted to micros internally for storage and processing.
This eliminates the need for users to add separate code nodes for conversion
and improves the user experience by making the expected input format clear.