diff --git a/src/config/currencies.tsx b/src/config/currencies.tsx index 03cf0426..65d9066f 100644 --- a/src/config/currencies.tsx +++ b/src/config/currencies.tsx @@ -1,4 +1,16 @@ export const currencySymbols = { - dollar: '$', - ruble: '₽', -} + AUD: '$', + BRL: 'R$', + BYN: 'Br', + CAD: '$', + CHF: 'CHF', + CNY: '¥', + EUR: '€', + GBP: '£', + HUF: 'ft', + INR: '₹', + KZT: '₸', + MDL: 'L', + RUB: '₽', + USD: '$', +} as const diff --git a/src/features/BuyMatchPopup/components/SubscriptionsList/index.tsx b/src/features/BuyMatchPopup/components/SubscriptionsList/index.tsx index c88919ea..1efa60ce 100644 --- a/src/features/BuyMatchPopup/components/SubscriptionsList/index.tsx +++ b/src/features/BuyMatchPopup/components/SubscriptionsList/index.tsx @@ -1,13 +1,16 @@ import map from 'lodash/map' -import type { MatchSubscriptions, MatchSubscription } from 'features/BuyMatchPopup/types' import { T9n } from 'features/T9n' +import type { + MatchSubscriptions, + MatchSubscription, +} from 'features/BuyMatchPopup/types' import { - List, - Item, - InfoWrapper, Header, + InfoWrapper, + Item, + List, Price, } from './styled' @@ -24,21 +27,37 @@ export const SubscriptionsList = ({ }: Props) => ( { - map(subscriptions, (subscription) => ( - onSelect?.(subscription)} - active={subscription === selectedSubscription} - > - -
- -
-
+ map( + subscriptions, + (subscription) => { + const { + currency, + id, + lexic, + price, + type, + } = subscription - -
- )) + return ( + onSelect?.(subscription)} + active={subscription === selectedSubscription} + > + +
+ +
+
+ +
+ ) + }, + ) }
) diff --git a/src/features/BuyMatchPopup/store/helpers.tsx b/src/features/BuyMatchPopup/store/helpers.tsx index aad6bd0c..d462d3da 100644 --- a/src/features/BuyMatchPopup/store/helpers.tsx +++ b/src/features/BuyMatchPopup/store/helpers.tsx @@ -1,12 +1,15 @@ import map from 'lodash/map' import isNumber from 'lodash/isNumber' +import { currencySymbols } from 'config' + import type { MatchSubscriptionsResponse } from 'requests' import { SubscriptionType } from '../types' export const transformSubsciptions = (subscriptions: MatchSubscriptionsResponse) => ( map(subscriptions, (subscription) => ({ + currency: currencySymbols[subscription.currency_iso || 'RUB'], id: subscription.id, lexic: subscription.lexic, price: subscription.price_month || subscription.price_year || 0, diff --git a/src/features/BuyMatchPopup/types.tsx b/src/features/BuyMatchPopup/types.tsx index 81bc0609..a6e7b063 100644 --- a/src/features/BuyMatchPopup/types.tsx +++ b/src/features/BuyMatchPopup/types.tsx @@ -11,6 +11,7 @@ export enum SubscriptionType { } export type MatchSubscription = { + currency: string, id: number, lexic: number, price: number, diff --git a/src/features/Price/index.tsx b/src/features/Price/index.tsx index d8ba71e7..a4244cf7 100644 --- a/src/features/Price/index.tsx +++ b/src/features/Price/index.tsx @@ -3,9 +3,9 @@ import { currencySymbols } from 'config' import { T9n } from 'features/T9n' import { - PriceWrapper, PriceAmount, PriceDetails, + PriceWrapper, } from './styled' type Props = { @@ -18,7 +18,7 @@ type Props = { export const Price = ({ amount, className, - currency = currencySymbols.ruble, + currency = currencySymbols.RUB, perPeriod = 'month', }: Props) => ( diff --git a/src/requests/getSubscriptions.tsx b/src/requests/getSubscriptions.tsx index 94fd1938..49a062dc 100644 --- a/src/requests/getSubscriptions.tsx +++ b/src/requests/getSubscriptions.tsx @@ -1,4 +1,5 @@ import { + currencySymbols, DATA_URL, PROCEDURES, SportTypes, @@ -8,6 +9,8 @@ import { callApi } from 'helpers' const proc = PROCEDURES.get_match_subscriptions type Subscription = { + currency_id: number, + currency_iso: keyof typeof currencySymbols, id: number, lexic: number, price_month: number | null,