Skip to content

Commit 80df6c6

Browse files
committed
ux: currency picker ehancements
This resolves #6 by: - adding explainer copy - spacing out the form - sorting the values - disabling the select while loading Future work to be tracked in another issue: - mobile UX (#7) - cache loaded currency options (#17)
1 parent 5c90702 commit 80df6c6

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

ui/src/views/Settings/SettingsForm.tsx

+21-13
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default function SettingsForm() {
2020
const vsCurrencyQuery = useSupportedVsCurrencies();
2121

2222
const currencyOptions = useMemo(() => {
23-
if(!(vsCurrencyQuery.isSuccess && vsCurrencyQuery.data)) { return Object.keys(CURRENCY_SYMBOLS) };
23+
if(!(vsCurrencyQuery.isSuccess && vsCurrencyQuery.data)) { return Object.keys(CURRENCY_SYMBOLS).sort() };
2424

2525
const output = vsCurrencyQuery.data;
2626
output.sort();
@@ -30,18 +30,26 @@ export default function SettingsForm() {
3030

3131
return (
3232
<form onSubmit={onSubmit}>
33-
<label>vsCurrency</label>
34-
<select defaultValue={vsCurrency || undefined} {...register("vsCurrency")}>
35-
{
36-
currencyOptions.map(c => {
37-
return (
38-
<option value={c} key={c}>{c}</option>
39-
)
40-
})
41-
}
42-
{errors.vsCurrency ? <p>Currency error</p> : null}
43-
</select>
44-
<input type="submit" />
33+
<section>
34+
<h3>
35+
Base Currency
36+
</h3>
37+
<p>This currency is used in dashboard calculations.</p>
38+
<p>For each asset, the corresponding base currency exchange rate from Coingecko is used to determine profit / loss and total portfolio value.</p>
39+
<select style={{ marginTop: '10px', marginBottom: '10px' }} disabled={vsCurrencyQuery.isLoading} defaultValue={vsCurrency || undefined} {...register("vsCurrency")}>
40+
{
41+
currencyOptions.map(c => {
42+
return (
43+
<option value={c} key={c}>{c.toLocaleUpperCase()}</option>
44+
)
45+
})
46+
}
47+
{errors.vsCurrency ? <p>Currency error</p> : null}
48+
</select>
49+
</section>
50+
<section>
51+
<input type="submit" />
52+
</section>
4553
</form>
4654
);
4755
}

0 commit comments

Comments
 (0)