Skip to content

Commit

Permalink
show selected currency on currency chooser
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul authored and benthecarman committed Feb 10, 2024
1 parent 69d6d3d commit 8e04901
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/ChooseCurrency.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const COMBINED_OPTIONS: Currency[] = [USD_OPTION, BTC_OPTION, ...FIAT_OPTIONS];
export function ChooseCurrency() {
const i18n = useI18n();
const [error, setError] = createSignal<Error>();
const [_state, actions] = useMegaStore();
const [state, actions] = useMegaStore();
const [loading, setLoading] = createSignal(false);
const navigate = useNavigate();

Expand All @@ -37,7 +37,7 @@ export function ChooseCurrency() {
const [_chooseCurrencyForm, { Form, Field }] =
createForm<ChooseCurrencyForm>({
initialValues: {
fiatCurrency: ""
fiatCurrency: state.fiat.value
},
validate: (values) => {
const errors: Record<string, string> = {};
Expand Down Expand Up @@ -82,7 +82,12 @@ export function ChooseCurrency() {
>
<For each={COMBINED_OPTIONS}>
{({ value, label }) => (
<option value={value}>{label}</option>
<option
selected={field.value === value}
value={value}
>
{label}
</option>
)}
</For>
</select>
Expand Down

0 comments on commit 8e04901

Please sign in to comment.