import { UserCurrencyComposer } from 'nitro-renderer'; import { FC, useCallback, useEffect, useMemo, useReducer } from 'react'; import { GetConfiguration } from '../../api'; import { NotificationCenterEvent } from '../../events'; import { dispatchUiEvent } from '../../hooks/events'; import { SendMessageHook } from '../../hooks/messages/message-event'; import { LocalizeText } from '../../utils/LocalizeText'; import { CurrencyIcon } from '../shared/currency-icon/CurrencyIcon'; import { SetLastCurrencies } from './common/CurrencyHelper'; import { PurseContextProvider } from './context/PurseContext'; import { CurrencyView } from './currency/CurrencyView'; import { PurseMessageHandler } from './PurseMessageHandler'; import { PurseViewProps } from './PurseView.types'; import { initialPurse, PurseReducer } from './reducers/PurseReducer'; import { SeasonalView } from './seasonal/SeasonalView'; export const PurseView: FC = props => { const [ purseState, dispatchPurseState ] = useReducer(PurseReducer, initialPurse); const { currencies = [] } = purseState; const displayedCurrencies = useMemo(() => { return GetConfiguration('system.currency.types', []); }, []); useEffect(() => { SendMessageHook(new UserCurrencyComposer()); }, []); SetLastCurrencies(currencies); const toggleNotificationCenter = useCallback(() => { dispatchUiEvent(new NotificationCenterEvent(NotificationCenterEvent.TOGGLE_NOTIFICATION_CENTER)); }, []); return (
{ currencies && currencies.map((currency, index) => { if (displayedCurrencies.indexOf(currency.type) === -1) return null; if (currency.type === -1 || currency.type === 0 || currency.type === 5) return ; return null; })}
{LocalizeText('purse.clubdays.zero.amount.text')}
{/*
*/}
{ currencies && currencies.map((currency, index) => { if (displayedCurrencies.indexOf(currency.type) === -1) return null; if (currency.type === -1 || currency.type === 0 || currency.type === 5) return null; return ; })}
); }