-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix: Add Decimal Formatting to Units and Cost - 1529 #1606
Fix: Add Decimal Formatting to Units and Cost - 1529 #1606
Conversation
@@ -22,10 +23,12 @@ export const TransferDetails = () => { | |||
register, | |||
control, | |||
watch, | |||
formState: { errors } | |||
formState: { errors }, | |||
setValue |
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.
Why do we need setValue?
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.
Nice catch! We don't really need it.
@@ -14,6 +14,7 @@ import { Controller, useFormContext } from 'react-hook-form' | |||
import { useTranslation } from 'react-i18next' | |||
import { LabelBox } from './LabelBox' | |||
import { calculateTotalValue } from '@/utils/formatters' | |||
import { NumericFormat } from 'react-number-format' |
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.
Is the formatter formatNumberWithCommas
not good for formatting in Transfers? Just thinking on the overhead of updating dependencies when updating React library. If we have an existing formatter, I would prefer using it.
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.
I see! that was my initial thought to use number formatters to achieve it, but I faced issues with form validation and conversion, which is why I decided to go with a new solution.
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.
LGTM
Thanks, Arturo, for the code review! |
This PR adds proper decimal formatting for large numbers in transfers to improve readability.
Closes #1529