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

Add formatter to central text in PieWidgetUI #843

Closed
wants to merge 3 commits into from

Conversation

jantolg
Copy link
Contributor

@jantolg jantolg commented Feb 28, 2024

Description

Add to central text in PieChartUI the same text formatter

Acceptance

Please describe how to validate the feature or fix

  1. Go to PieWidgetUI
  2. Use a custom formatter
  3. Check the central text as the same format as you set at formatter func

Copy link

github-actions bot commented Feb 28, 2024

Pull Request Test Coverage Report for Build 8099436624

Details

  • 8 of 8 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 68.596%

Totals Coverage Status
Change from base Build 7956818395: 0.04%
Covered Lines: 2630
Relevant Lines: 3491

💛 - Coveralls

Copy link

github-actions bot commented Feb 28, 2024

Visit the preview URL for this PR (updated for commit abd2547):

https://cartodb-fb-storybook-react-dev--pr843-feat-add-central-nmfupptg.web.app

(expires Thu, 07 Mar 2024 16:42:13 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 517cc4d31d7e09cf277774e034094b67c301cd4c

@VictorVelarde VictorVelarde changed the title feat: add formatter to central text in widget pie ui Add formatter to central text in widget pie ui Feb 28, 2024
@VictorVelarde VictorVelarde changed the title Add formatter to central text in widget pie ui Add formatter to central text in PieWidgetUI Feb 28, 2024
Copy link
Contributor

@VictorVelarde VictorVelarde left a comment

Choose a reason for hiding this comment

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

Have a look at it please @vmilan, LGTM

Copy link
Contributor

@vmilan vmilan left a comment

Choose a reason for hiding this comment

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

Could you add an example of use in storybook and a new entry in the changelog? 🙏

@VictorVelarde
Copy link
Contributor

The approach LGTM, just 2 caveats:

Thx for the help here @jantolg

fix: remove default props formatter ui
chore: add entry to CHANGELOG.md
@jantolg
Copy link
Contributor Author

jantolg commented Feb 29, 2024

I've just to add an example of storybook, a new changelog entry, and a default behaviour of formatter based on useIntl.formatNumber

@jantolg jantolg requested a review from vmilan March 1, 2024 08:45
Copy link
Contributor

@vmilan vmilan left a comment

Choose a reason for hiding this comment

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

I've seen a weird behavior in the storybook generated with your changes:
https://cartodb-fb-storybook-react-dev--pr843-feat-add-central-nmfupptg.web.app/?path=/docs/widgets-piewidgetui--default

master:
https://storybook-react.carto.com/?path=/docs/widgets-piewidgetui--default

At least in Storybook something is broken.

Screen.Recording.2024-03-01.at.09.49.43.mov

Please check the widget is still working properly, we use it in Builder.

@jantolg
Copy link
Contributor Author

jantolg commented Mar 4, 2024

I close this PR.

Upon reviewing the behavior, maybe using the same formatter for units and percentage values is not a good approach, as it represents two different types of values. After discussing this issue with @aaranadev and @menusal, we believe it would be better to have a separate formatter for each type of value.

I have created a new PR with these changes to avoid mixing different approaches.

NOTE: It might be worth considering a standardized approach for using formatters, perhaps by unifying all formatters into a single property or something similar. This would be a good topic to open a discussion about for future C4R versions

Continue in this new PR #844

@jantolg jantolg closed this Mar 4, 2024
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.

3 participants