|
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
import first from 'lodash/first' |
|
|
|
|
import { useCallback } from 'react' |
|
|
|
|
|
|
|
|
|
import map from 'lodash/map' |
|
|
|
|
|
|
|
|
|
import { MDASH } from 'config' |
|
|
|
|
@ -7,7 +8,6 @@ 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, |
|
|
|
|
@ -16,6 +16,9 @@ import { |
|
|
|
|
HeaderTitle, |
|
|
|
|
Wrapper, |
|
|
|
|
} from 'features/BuyMatchPopup/styled' |
|
|
|
|
|
|
|
|
|
import { MatchPackage, SubscriptionType } from '../../types' |
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
Description, |
|
|
|
|
InfoWrapper, |
|
|
|
|
@ -40,6 +43,13 @@ export const SelectSubscriptionStep = () => { |
|
|
|
|
selectedSubscription, |
|
|
|
|
} = useBuyMatchPopupStore() |
|
|
|
|
|
|
|
|
|
const getPackagesCurrency = useCallback( |
|
|
|
|
(packages: Record<SubscriptionType, Array<MatchPackage>>) => { |
|
|
|
|
const packageWithValue = Object.entries(packages).find(([key, value]) => value.length)?.[1][0] |
|
|
|
|
return packageWithValue ? packageWithValue.currency : 'RUB' |
|
|
|
|
}, [], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
if (!match || !matchSubscriptions) return null |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
@ -79,7 +89,7 @@ export const SelectSubscriptionStep = () => { |
|
|
|
|
|
|
|
|
|
<Price |
|
|
|
|
amount={subscription.min_price || 0} |
|
|
|
|
currency={first(subscription.packages.month)?.currency} |
|
|
|
|
currency={getPackagesCurrency(subscription.packages)} |
|
|
|
|
isFrom={Boolean(subscription.min_price)} |
|
|
|
|
/> |
|
|
|
|
</ChooseSubItem> |
|
|
|
|
|