import { useCallback } from 'react' import map from 'lodash/map' import { MDASH } from 'config' import { isSubscribePopup } from 'helpers' import { Name as Names } from 'features/Name' import { T9n } from 'features/T9n' import { useBuyMatchPopupStore } from 'features/BuyMatchPopup/store' import { CloseButton, HeaderActions } from 'features/PopupComponents' import { Body, Button, Footer, Header, HeaderTitle, Wrapper, } from 'features/BuyMatchPopup/styled' import { MatchPackage, SubscriptionType } from '../../types' import { Description, InfoWrapper, Name, Pass, } from '../PackagesList/styled' import { Price, ChooseSub, ChooseSubItem, ChooseSubList, } from './styled' export const SelectSubscriptionStep = () => { const { close, match, matchSubscriptions, onNext, onSubscriptionSelect, selectedSubscription, } = useBuyMatchPopupStore() const getPackagesCurrency = useCallback(( packages: Record>, ) => { const packageWithValue = Object.entries(packages).find(([key, value]) => value.length)?.[1][0] return packageWithValue ? packageWithValue.currency : 'RUB' }, []) if (!match || !matchSubscriptions) return null return (
{!isSubscribePopup() && ( {` ${MDASH} `} )}
{map(matchSubscriptions, (subscription) => ( onSubscriptionSelect(subscription)} active={subscription === selectedSubscription} > ))}
) }