Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased
- Add feedback link to guide and about settings
- Move active currencies to top of currency dropdown

## v4.49.0
- Bundle BitBox02 Nova firmware version v9.24.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ type TSelectProps = {
onOpenChange: (isOpen: boolean) => void;
};

const sortCurrencyOptions = (options: SelectOption[], activeCurrencies: Fiat[]): SelectOption[] => {
const byLabel = (a: SelectOption, b: SelectOption) => a.label.localeCompare(b.label);
const selected = options.filter(opt => activeCurrencies.includes(opt.value)).sort(byLabel);
const others = options.filter(opt => !activeCurrencies.includes(opt.value)).sort(byLabel);
return [...selected, ...others];
};

export const ActiveCurrenciesDropdown = ({
options,
defaultCurrency,
Expand Down Expand Up @@ -71,12 +78,13 @@ export const ActiveCurrenciesDropdown = ({
</div>
);
};
const sortedOptions = sortCurrencyOptions(options, activeCurrencies);

return (
<Dropdown
isMulti
closeMenuOnSelect={false}
options={options}
options={sortedOptions}
value={formattedActiveCurrencies}
title={t('newSettings.appearance.activeCurrencies.title')}
mobileFullScreen
Expand Down