From 453f30f8d1d828f045db1c1ebcb54ea5b9c628d0 Mon Sep 17 00:00:00 2001 From: Rakov Roman Date: Tue, 28 Jun 2022 11:07:10 +0300 Subject: [PATCH] fix(#2524): wrong currency icon for the subscription price --- .../components/SelectSubscription/index.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/features/BuyMatchPopup/components/SelectSubscription/index.tsx b/src/features/BuyMatchPopup/components/SelectSubscription/index.tsx index 19b14a63..f7d746a0 100644 --- a/src/features/BuyMatchPopup/components/SelectSubscription/index.tsx +++ b/src/features/BuyMatchPopup/components/SelectSubscription/index.tsx @@ -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>) => { + 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 = () => {