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

Tan 3667/useformatcurrency hook #10177

Merged
merged 18 commits into from
Jan 29, 2025
Merged

Conversation

brentguf
Copy link
Contributor

@brentguf brentguf commented Jan 24, 2025

Context: formatCurrency, obtained from calling useFormatCurrency, will be used in all places where we're formatting currencies in future PRs. An example: #10150.

First I created just the formatCurrency function, but it was cumbersome to provide locale and appConfiguration on each use, hence the hook.

Changelog

Technical

  • Add utils: formatCurrency and useFormatCurrency hook.

Copy link

@cl-dev-bot
Copy link
Collaborator

cl-dev-bot commented Jan 24, 2025

Warnings
⚠️

The changelog is empty. What should I put in the changelog?

⚠️ The PR title contains no Jira issue key (case-sensitive)
Messages
📖 Notion issue: TAN-3667
📖

Run the e2e tests

📖 Check translation progress

Generated by 🚫 dangerJS against aae74f7

@brentguf brentguf force-pushed the TAN-3667/useformatcurrency-hook branch from 1af52ff to 18126af Compare January 24, 2025 10:00
@brentguf brentguf mentioned this pull request Jan 24, 2025
@brentguf brentguf requested a review from EdwinKato January 24, 2025 10:22
Comment on lines +16 to +26
if (currency === 'TOK') {
return (amount: number) =>
formatMessage(messages.xTokens, { numberOfTokens: formatNumber(amount) });
}

if (currency === 'CRE') {
return (amount: number) =>
formatMessage(messages.xCredits, {
numberOfCredits: formatNumber(amount),
});
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This ~mimics behavior from FormattedBudget.

@brentguf brentguf merged commit c343384 into master Jan 29, 2025
10 checks passed
@brentguf brentguf deleted the TAN-3667/useformatcurrency-hook branch January 29, 2025 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants