diff --git a/src/components/purse/views/SeasonalView.tsx b/src/components/purse/views/SeasonalView.tsx index 5820b1c..c10bdaa 100644 --- a/src/components/purse/views/SeasonalView.tsx +++ b/src/components/purse/views/SeasonalView.tsx @@ -2,26 +2,53 @@ import { FC } from 'react'; import { GetConfiguration, LocalizeFormattedNumber, LocalizeText } from '../../../api'; import { Flex, LayoutCurrencyIcon, Text } from '../../../common'; -interface SeasonalViewProps -{ +interface SeasonalViewProps { type: number; amount: number; } -export const SeasonalView: FC = props => -{ +// Individual currency display component +export const SeasonalView: FC = props => { const { type = -1, amount = -1 } = props; return ( - ('currency.seasonal.color') }> + ('currency.seasonal.color')}`} > - { LocalizeText(`purse.seasonal.currency.${ type }`) } - 99999 ? LocalizeFormattedNumber(amount) : '' }>{ amount > 99999 ? '99 999' : LocalizeFormattedNumber(amount) } + + {LocalizeText(`purse.seasonal.currency.${type}`)} + + 99999 ? LocalizeFormattedNumber(amount) : '' } > + {amount > 99999 ? '99 999' : LocalizeFormattedNumber(amount)} + - + - ); +}; + +interface SeasonalCurrenciesViewProps { + currencies: { type: number; amount: number }[]; } + +export const SeasonalCurrenciesView: FC = props => { + const { currencies } = props; + + // Sort currencies: 0 first, then 5, then others + const sortedCurrencies = [...currencies].sort((a, b) => { + if (a.type === 0) return -1; + if (b.type === 0) return 1; + if (a.type === 5) return -1; + if (b.type === 5) return 1; + return a.type - b.type; + }); + + return ( + + { + sortedCurrencies.map(currency => ()) + } + + ); +}; \ No newline at end of file