Skip to content
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

Feature : Adding percentage option to Input Number #8481

Merged
merged 15 commits into from
Nov 14, 2024

Conversation

guillim
Copy link
Contributor

@guillim guillim commented Nov 13, 2024

fixing #7375

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR adds percentage type support to number fields, allowing users to configure decimal precision and display values with percentage formatting.

  • Added percentage type option in SettingsDataModelFieldNumberForm.tsx with a new Select component for choosing between 'Number' and 'Percentage' types
  • Modified NumberFieldDisplay.tsx and NumberFieldInput.tsx to handle percentage values by multiplying/dividing by 100 and appending '%'
  • Updated useNumberField.ts hook to handle percentage persistence with proper value conversion
  • Restructured field settings to be accessed through metadata.settings instead of direct settings property for better consistency
  • Added Zod validation schema in field-metadata-validation.service.ts to validate percentage type and decimal settings

16 file(s) reviewed, 14 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -13,6 +13,7 @@ type FieldMetadataDefaultSettings = {
type FieldMetadataNumberSettings = {
dataType: NumberDataType;
decimals?: number;
type?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider using a union type 'percentage' | 'number' instead of string for better type safety

@twentyhq twentyhq deleted a comment from greptile-apps bot Nov 13, 2024
@twentyhq twentyhq deleted a comment from greptile-apps bot Nov 13, 2024
@twentyhq twentyhq deleted a comment from greptile-apps bot Nov 13, 2024
@twentyhq twentyhq deleted a comment from greptile-apps bot Nov 13, 2024
@twentyhq twentyhq deleted a comment from greptile-apps bot Nov 13, 2024
@twentyhq twentyhq deleted a comment from greptile-apps bot Nov 13, 2024
@twentyhq twentyhq deleted a comment from greptile-apps bot Nov 13, 2024
@twentyhq twentyhq deleted a comment from greptile-apps bot Nov 13, 2024
@twentyhq twentyhq deleted a comment from greptile-apps bot Nov 13, 2024
@twentyhq twentyhq deleted a comment from greptile-apps bot Nov 13, 2024
Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

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

Good job! Left a few comments and we can merge!

@guillim
Copy link
Contributor Author

guillim commented Nov 14, 2024

feedback from Charles : disable percentage option on standard object !

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

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

LGTM, bravo!

@charlesBochet charlesBochet merged commit 15b8b9b into main Nov 14, 2024
18 of 19 checks passed
@charlesBochet charlesBochet deleted the guillim-feature-percentatge branch November 14, 2024 13:23
Copy link

Thanks @guillim for your contribution!
This marks your 5th PR on the repo. You're top 6% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

khuddite pushed a commit to khuddite/twenty that referenced this pull request Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants