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

ux: currency picker ehancements #18

Merged
merged 1 commit into from
Dec 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions ui/src/views/Settings/SettingsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function SettingsForm() {
const vsCurrencyQuery = useSupportedVsCurrencies();

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

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

return (
<form onSubmit={onSubmit}>
<label>vsCurrency</label>
<select defaultValue={vsCurrency || undefined} {...register("vsCurrency")}>
{
currencyOptions.map(c => {
return (
<option value={c} key={c}>{c}</option>
)
})
}
{errors.vsCurrency ? <p>Currency error</p> : null}
</select>
<input type="submit" />
<section>
<h3>
Base Currency
</h3>
<p>This currency is used in dashboard calculations.</p>
<p>For each asset, the corresponding base currency exchange rate from Coingecko is used to determine profit / loss and total portfolio value.</p>
<select style={{ marginTop: '10px', marginBottom: '10px' }} disabled={vsCurrencyQuery.isLoading} defaultValue={vsCurrency || undefined} {...register("vsCurrency")}>
{
currencyOptions.map(c => {
return (
<option value={c} key={c}>{c.toLocaleUpperCase()}</option>
)
})
}
{errors.vsCurrency ? <p>Currency error</p> : null}
</select>
</section>
<section>
<input type="submit" />
</section>
</form>
);
}