appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

feat: added differentiation between indian numeral system and international numeral system in currency input widget #28862

Open prasad-madine opened this issue 1 year ago • 10 comments

Issue Link

Description:

I have raised this PR to Add the Added Differentiation between Indian numeral system and International numeral system in currency input widget

The Currency Input widget currently formats numbers in a generic manner, without differentiating between the Indian numeral system and the International numeral system. This can lead to confusion and errors, particularly for users accustomed to a specific formatting style.

Cypress video

https://github.com/user-attachments/assets/5a48fc65-7c2c-40d7-9270-33b793923ec5

Screenshots:

Before resolving bug:

image (7)

After resolving bug:

Screenshot from 2024-07-26 10-19-08 Screenshot from 2024-07-26 10-19-26

Summary by CodeRabbit

  • New Features

    • Enhanced Currency Input Widget with improved currency formatting based on country code.
    • Added an end-to-end test suite for the Currency Input Widget to ensure proper numeral system differentiation.
  • Bug Fixes

    • Fixed validation logic in KeyValueComponent to ensure consistent error messaging for empty fields.
  • Documentation

    • Updated test coverage to include country-specific formatting for currency inputs.
  • Chores

    • Enhanced utility functions for locale-aware currency formatting.

prasad-madine avatar Jul 29 '24 11:07 prasad-madine

Walkthrough

The recent updates improve the Currency Input Widget and related components by adding country-specific currency formatting and enhancing input validation. A new test suite is introduced to ensure the widget handles different numeral systems correctly. Additionally, the utility functions now support locale-aware formatting, making the system more adaptable to various regional requirements and enhancing overall user experience.

Changes

Files Change Summary
app/client/cypress/e2e/Regression/.../CurrencyInput_spec4.js Added an end-to-end test suite for the Currency Input Widget, validating its handling of different numeral systems and currency types.
app/client/src/widgets/CurrencyInputWidget/component/utilities.ts Introduced a new getLocaleString function and modified formatCurrencyNumber to accept a countryCode, enhancing locale-aware currency formatting.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CurrencyInputWidget
    participant Utilities

    User->>CurrencyInputWidget: Input value
    CurrencyInputWidget->>Utilities: formatCurrencyNumber(value, countryCode)
    Utilities->>Utilities: getLocaleString(countryCode)
    Utilities-->>CurrencyInputWidget: Return formatted value
    CurrencyInputWidget-->>User: Display formatted currency

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Jul 29 '24 11:07 coderabbitai[bot]

@PrasadMadine We have seen there is change in src with business logic. This logic can be tested with Jest unit tests or React testing library. Cypress is redundant here. Let me know reason behind cypress case writing.

sagar-qa007 avatar Jul 30 '24 06:07 sagar-qa007

Hello @sagar-qa007 , Will update the PR with unit test cases. I have written cypress test to visually check the functionality is working as expected.

prasad-madine avatar Jul 30 '24 07:07 prasad-madine

Hello @sagar-qa007 , Updated the test cases, could you please review this PR

prasad-madine avatar Jul 31 '24 12:07 prasad-madine

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

github-actions[bot] avatar Aug 07 '24 16:08 github-actions[bot]

Hi @sagar-qa007 @ApekshaBhosale , Could you please review this PR when you have sometime. Thankyou

prasad-madine avatar Aug 09 '24 04:08 prasad-madine

Hello @sagar-qa007 @znamenskii-ilia , Could you please review this PR, I have updated it.

prasad-madine avatar Aug 29 '24 02:08 prasad-madine

@rahulbarwal Please create shadow PR as changes looks fine.

sagar-qa007 avatar Sep 03 '24 05:09 sagar-qa007

Any changes in the older layout or widget need to be approved by the current Widgets team. @sagar-qa007 kindly ensure that it always happens.

@rahulbarwal this seems more related to your POD, kindly check. Ilia has done it on Anvil teams behalf.

QQ @znamenskii-ilia, Why is Anvil team getting tagged on this widget, isint this from the fixed layout?

somangshu avatar Sep 06 '24 05:09 somangshu

Hello @rahulbarwal , Could you please review this PR.

prasad-madine avatar Sep 09 '24 06:09 prasad-madine

Hello @rahulbarwal , Please review this PR..

prasad-madine avatar Sep 23 '24 06:09 prasad-madine

hey @PrasadMadine, I'll prioritise this soon. Thanks for your effort here.

rahulbarwal avatar Sep 23 '24 06:09 rahulbarwal

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

github-actions[bot] avatar Feb 05 '25 16:02 github-actions[bot]

This PR has been closed because of inactivity.

github-actions[bot] avatar Mar 10 '25 16:03 github-actions[bot]