Implemented Currency Selector # 34 #46
No reviewers
Labels
No Label
Large
Medium
Small
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: david/poker-chips-helper#46
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "vutukuri15/34"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR introduces a currency selection feature for the poker game app, allowing players to change the currency symbol displayed for chip values and buy-in amounts. The main updates include the addition of a dropdown or setting where users can select a currency symbol (e.g., $, €, ₹, £). Upon selection, all displayed monetary values will automatically update to reflect the chosen currency.
Good work. There's just a few minor things.
Thank you for taking the time to fix all the existing tests
The settings button seems like a good idea. I have a few thoughts
headerRight
in the RootLayout Componentscreenoptions
in_layout.tsx
This seems like a possible regression. I think this is not present currently on the main branch.
Please confirm and remove this if so
I notice you have a title of the setting here, as well as a label for "Select Currency" within the component itself. I think this combination is a bit wordy, and arguably redundant.
I think you should make one of the two above changes, but the decision is yours.
@ -10,11 +10,15 @@ import { MaterialIcons } from "@expo/vector-icons";
interface BuyInSelectorProps {
setBuyInAmount: React.Dispatch<React.SetStateAction<number>>;
selectedCurrency: string; // Accept selectedCurrency as a prop
For a global setting like this, contexts might be a better choice.
If our app was to grow and gain complexity, we would want to avoid the inevitable 'prop drilling' as described in that article.
However, you do not need to change this. Just be aware of the context feature for future reference and personal learning. Passing as props is ok for our circumstances given the scope of our app.
@ -0,0 +20,4 @@
style={styles.picker}
testID="currency-picker" // ✅ Add testID here
>
<Picker.Item label="USD ($)" value="$" />
One thing about currencies is that multiple currencies sometimes use the same symbol (example, Mexican Peso also uses the
$
sign).I think what you have is good for our app though and you do not need to change anything. This is just an interesting fact.
@ -10,11 +10,15 @@ import { MaterialIcons } from "@expo/vector-icons";
interface BuyInSelectorProps {
setBuyInAmount: React.Dispatch<React.SetStateAction<number>>;
selectedCurrency: string; // Accept selectedCurrency as a prop
Thanks for the feedback! I’ll keep that in mind for future improvements.
@ -0,0 +20,4 @@
style={styles.picker}
testID="currency-picker" // ✅ Add testID here
>
<Picker.Item label="USD ($)" value="$" />
Yes, good to know! I think we're good with the current approach, as you said
I removed title Currency Selector
I think we are already using
@expo/vector-icons
for some icons. We should avoid pulling in a separate new icon package unless the is a good justified reason. I suggest finding a suitable icon from there instead and removing this new dependency, or leave a quick note here about the reason for needing this new package please.Free to resolve.
I removed the new package and
I used only existing @expo/vector-icons