-
Notifications
You must be signed in to change notification settings - Fork 3.6k
feat: ability to switch currency format #12542
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
feat: ability to switch currency format #12542
Conversation
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.
PR Summary
Added format switching capability to currency fields, allowing toggle between abbreviated (12M) and full (12,000,000) number displays across the application.
- Extends
currencyFieldDefaultValueSchema.ts
with new format field using Zod enum validation, improving type safety - Adds format selector component in
SettingsDataModelFieldCurrencyForm.tsx
with Short/Full options using IconCheckbox - Implements format switching in
CurrencyDisplay.tsx
while maintaining backwards compatibility with default 'short' format - Ensures format property is properly propagated through
useCurrencyFieldDisplay
hook to maintain consistent display behavior
6 files reviewed, 4 comments
Edit PR Review Bot Settings | Greptile
...src/modules/object-record/record-field/validation-schemas/currencyFieldDefaultValueSchema.ts
Outdated
Show resolved
Hide resolved
.../settings/data-model/fields/forms/currency/components/SettingsDataModelFieldCurrencyForm.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx
Outdated
Show resolved
Hide resolved
...ules/settings/data-model/fields/forms/currency/hooks/useCurrencySettingsFormInitialValues.ts
Outdated
Show resolved
Hide resolved
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:46276 This environment will automatically shut down when the PR is closed or after 5 hours. |
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.
Hello @MohitAgrawal16 thanks for your contribution !
Unfortunately this PR seems to introduce several regressions:
- the currency type select isn't filled with the current selected value
- unable to create a field metadata currency
- After changing the currency format only it does not seem possible to save CTA is still disabled
I've pushed few updates to make the format property integration more idiomatic
Hello @prastoin, thanks for updates. I was also trying to maintain only fieldValue means one prop only, but facing some problems in it, that's why I done it in other way. |
@prastoin, Oh, so after your updates, the above-mentioned issues are there; I will try to solve them. |
9bf4fb0
to
d14bc5d
Compare
@greptileai trigger |
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.
PR Summary
Updates currency format settings across multiple UI components and field definitions, ensuring consistent format application throughout the application.
- Extended
FieldMetadata.ts
types withFieldCurrencyMetadata
to support format settings system-wide - Added currency format preview handling in
getCurrencyFieldPreviewValue.ts
by including settings inFieldMetadataItem
type
14 files reviewed, 1 comment
Edit PR Review Bot Settings | Greptile
packages/twenty-front/src/modules/object-record/record-field/types/FieldMetadata.ts
Show resolved
Hide resolved
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.
Waiting for another core team member review
Waiting for another core team member review
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 ! It works great 👏
.../settings/data-model/fields/forms/currency/components/SettingsDataModelFieldCurrencyForm.tsx
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx
Show resolved
Hide resolved
This PR is ready to merge. |
Thanks @MohitAgrawal16 for your contribution! |
Fixes #11927
I have added 'format' in the zod schema of currency, and for using it, I am separately passing 'format' to 'currencyDisplay.'
The feature is working correctly.