Revert "🆙 Small fix for Purse"

This reverts commit c3bc077d46813b2ce31ac519a1ad70c6ef5c9125.
This commit is contained in:
DuckieTM 2025-03-09 20:12:41 +01:00
parent c3bc077d46
commit 490e2606ff

View File

@ -2,53 +2,26 @@ import { FC } from 'react';
import { GetConfiguration, LocalizeFormattedNumber, LocalizeText } from '../../../api'; import { GetConfiguration, LocalizeFormattedNumber, LocalizeText } from '../../../api';
import { Flex, LayoutCurrencyIcon, Text } from '../../../common'; import { Flex, LayoutCurrencyIcon, Text } from '../../../common';
interface SeasonalViewProps { interface SeasonalViewProps
{
type: number; type: number;
amount: number; amount: number;
} }
// Individual currency display component export const SeasonalView: FC<SeasonalViewProps> = props =>
export const SeasonalView: FC<SeasonalViewProps> = props => { {
const { type = -1, amount = -1 } = props; const { type = -1, amount = -1 } = props;
return ( return (
<Flex fullWidth justifyContent="between" className={`nitro-purse-seasonal-currency nitro-notification ${GetConfiguration<boolean>('currency.seasonal.color')}`} > <Flex fullWidth justifyContent="between" className={ 'nitro-purse-seasonal-currency nitro-notification ' + GetConfiguration<boolean>('currency.seasonal.color') }>
<Flex fullWidth> <Flex fullWidth>
<Text bold truncate fullWidth variant="white" className="seasonal-padding seasonal-bold" > <Text bold truncate fullWidth variant="white" className="seasonal-padding seasonal-bold">{ LocalizeText(`purse.seasonal.currency.${ type }`) }</Text>
{LocalizeText(`purse.seasonal.currency.${type}`)} <Text bold truncate variant="white" className="seasonal-amount text-end" title={ amount > 99999 ? LocalizeFormattedNumber(amount) : '' }>{ amount > 99999 ? '99 999' : LocalizeFormattedNumber(amount) }</Text>
</Text>
<Text bold truncate variant="white" className="seasonal-amount text-end" title={amount > 99999 ? LocalizeFormattedNumber(amount) : '' } >
{amount > 99999 ? '99 999' : LocalizeFormattedNumber(amount)}
</Text>
<Flex className="nitro-seasonal-box seasonal-padding"> <Flex className="nitro-seasonal-box seasonal-padding">
<LayoutCurrencyIcon type={ type } /> <LayoutCurrencyIcon type={ type } />
</Flex> </Flex>
</Flex> </Flex>
</Flex> </Flex>
); );
};
interface SeasonalCurrenciesViewProps {
currencies: { type: number; amount: number }[];
} }
export const SeasonalCurrenciesView: FC<SeasonalCurrenciesViewProps> = 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 (
<Flex column gap={2}>
{
sortedCurrencies.map(currency => (<SeasonalView key={currency.type} type={currency.type} amount={currency.amount} />))
}
</Flex>
);
};