mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 18:04:18 +00:00
fix(mobile): sort currency codes explicitly
Use the shared code-unit comparator for dashboard currency options while preserving their existing order.
This commit is contained in:
@@ -14,7 +14,7 @@ import { useCollectionLists } from '../../../components/Dashboard/useCollectionL
|
||||
import { shortZone, useDashboardTimezones, zoneOptionLabel } from '../../../components/Dashboard/useDashboardTimezones'
|
||||
import { typeInfo } from '../../../components/Planner/bookings/bookingsModel'
|
||||
import { formatTime, splitReservationDateTime } from '../../../utils/formatters'
|
||||
import { normalizeAppearance, MOBILE_DASH_TOKENS, type MobileDashToken } from '@trek/shared'
|
||||
import { compareCodeUnits, normalizeAppearance, MOBILE_DASH_TOKENS, type MobileDashToken } from '@trek/shared'
|
||||
import { MOMENT_LABEL, upcomingKey, type UpcomingReservation } from '../../../pages/dashboard/dashboardModel'
|
||||
import { PLACES_ROOT, placesPath } from '../../../utils/placesRoutes'
|
||||
import MIconBtn from '../../components/MIconBtn'
|
||||
@@ -109,7 +109,7 @@ function MCurrencyWidget() {
|
||||
const { from, to, setFrom, setTo, amount, setAmount, currencies, rate, converted, swap, fetchRates, pairPending, ratePending } = useCurrencyConverter()
|
||||
const ratePendingLabel = pairPending || ratePending
|
||||
const currencyNames = new Intl.DisplayNames(locale, { type: 'currency', fallback: 'none' })
|
||||
const options = [...new Set([from, to, ...currencies])].sort().map(value => {
|
||||
const options = [...new Set([from, to, ...currencies])].sort(compareCodeUnits).map(value => {
|
||||
const name = /^[A-Z]{3}$/.test(value) ? currencyNames.of(value) : undefined
|
||||
return { value, label: name && name !== value ? `${value} · ${name}` : value }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user