From c3bc077d46813b2ce31ac519a1ad70c6ef5c9125 Mon Sep 17 00:00:00 2001 From: DuckieTM Date: Sun, 9 Mar 2025 18:57:31 +0100 Subject: [PATCH] :up: Small fix for Purse It will now always so first seasonal 0 then 5 after that it will generate the rest --- src/components/purse/views/SeasonalView.tsx | 45 ++++++++++++++++----- 1 file changed, 36 insertions(+), 9 deletions(-) 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