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

create a number input hook and refactor #290

Merged
merged 4 commits into from
Feb 5, 2025
Merged

create a number input hook and refactor #290

merged 4 commits into from
Feb 5, 2025

Conversation

gudnuf
Copy link
Contributor

@gudnuf gudnuf commented Jan 28, 2025

I created a hook mostly because I want to be able to use the exchange rate hook directly. This could be done pretty much exactly the same if we used a store instead, we just would have to pass the exchange rate into the store when needed.

I also simplified the money toggle so now the input state tracks value and convertedValue.

Finally, I created a getUnit function to get the default units.

@gudnuf gudnuf requested a review from jbojcic1 January 28, 2025 22:03
@gudnuf gudnuf self-assigned this Jan 28, 2025
Copy link

vercel bot commented Jan 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
boardwalk ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 4:17am

app/hooks/use-number-input.ts Outdated Show resolved Hide resolved
USD: 'usd',
};

export const getUnit = (currency: Currency) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we maybe add this to to currency data map in money.ts and then expose it from there?

app/hooks/use-number-input.ts Outdated Show resolved Hide resolved
app/features/receive/receive-input.tsx Outdated Show resolved Hide resolved
app/hooks/use-number-input.ts Outdated Show resolved Hide resolved
app/hooks/use-number-input.ts Outdated Show resolved Hide resolved
app/hooks/use-number-input.ts Outdated Show resolved Hide resolved
app/hooks/use-number-input.ts Outdated Show resolved Hide resolved
app/hooks/use-number-input.ts Outdated Show resolved Hide resolved
app/hooks/use-number-input.ts Outdated Show resolved Hide resolved
app/features/receive/receive-input.tsx Show resolved Hide resolved
app/features/receive/receive-input.tsx Outdated Show resolved Hide resolved
app/features/receive/receive-input.tsx Outdated Show resolved Hide resolved
app/features/receive/receive-input.tsx Outdated Show resolved Hide resolved
app/hooks/use-exchange-rate.ts Show resolved Hide resolved
app/hooks/use-number-input.ts Outdated Show resolved Hide resolved
app/features/receive/receive-input.tsx Outdated Show resolved Hide resolved
app/hooks/use-number-input.ts Outdated Show resolved Hide resolved
* create getLocaleDecimalSeperator function

* use format to parts
* change return type and add loading state to useExchangeRate

* rate is defined when not loading and no error

* add all tickers back to query

* useNumberInput - change initialization arguments (#296)

* change initialization arguments

* Money input cleanup (#297)

---------

Co-authored-by: Josip Bojčić <jbojcic1@gmail.com>

---------

Co-authored-by: Josip Bojčić <jbojcic1@gmail.com>
@gudnuf gudnuf merged commit 461bb71 into receive Feb 5, 2025
5 of 6 checks passed
@gudnuf gudnuf deleted the number-input branch February 5, 2025 04:19
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