Skip to content

Commit 467b486

Browse files
committed
frontend: move active currencies to top of dropdown
Improves UX by making active currencies more visible and easier to deselect.
1 parent 15eef7f commit 467b486

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44
- Add feedback link to guide and about settings
5+
- Move active currencies to top of currency dropdown
56

67
## v4.49.0
78
- Bundle BitBox02 Nova firmware version v9.24.0

frontends/web/src/routes/settings/components/appearance/activecurrenciesdropdown.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ type TSelectProps = {
3737
onOpenChange: (isOpen: boolean) => void;
3838
};
3939

40+
const sortCurrencyOptions = (options: SelectOption[], activeCurrencies: Fiat[]): SelectOption[] => {
41+
const byLabel = (a: SelectOption, b: SelectOption) => a.label.localeCompare(b.label);
42+
const selected = options.filter(opt => activeCurrencies.includes(opt.value)).sort(byLabel);
43+
const others = options.filter(opt => !activeCurrencies.includes(opt.value)).sort(byLabel);
44+
return [...selected, ...others];
45+
};
46+
4047
export const ActiveCurrenciesDropdown = ({
4148
options,
4249
defaultCurrency,
@@ -71,12 +78,13 @@ export const ActiveCurrenciesDropdown = ({
7178
</div>
7279
);
7380
};
81+
const sortedOptions = sortCurrencyOptions(options, activeCurrencies);
7482

7583
return (
7684
<Dropdown
7785
isMulti
7886
closeMenuOnSelect={false}
79-
options={options}
87+
options={sortedOptions}
8088
value={formattedActiveCurrencies}
8189
title={t('newSettings.appearance.activeCurrencies.title')}
8290
mobileFullScreen

0 commit comments

Comments
 (0)