From 8fc7a19a55d18a4bf909cbd3b036eae49d8f0433 Mon Sep 17 00:00:00 2001 From: ClaudiaHolhos Date: Wed, 8 Jun 2022 16:18:37 +0300 Subject: [PATCH] currency, prices props fixes --- src/components/@shared/FormInput/InputElement.tsx | 10 ++++++++++ .../Compute/AlgorithmDatasetsListForCompute.tsx | 12 +++++++++--- .../Asset/AssetActions/Compute/PriceOutput.tsx | 11 +++++++++-- .../Asset/AssetActions/Compute/index.tsx | 6 +++++- src/components/Asset/AssetActions/Download.tsx | 6 +++++- .../Asset/AssetActions/UserLiquidity.tsx | 14 ++++++++++++-- 6 files changed, 50 insertions(+), 9 deletions(-) diff --git a/src/components/@shared/FormInput/InputElement.tsx b/src/components/@shared/FormInput/InputElement.tsx index 343889238..902289879 100644 --- a/src/components/@shared/FormInput/InputElement.tsx +++ b/src/components/@shared/FormInput/InputElement.tsx @@ -11,6 +11,8 @@ import AssetSelection, { } from '../FormFields/AssetSelection' import Nft from '../FormFields/Nft' import InputRadio from './InputRadio' +import { useUserPreferences } from '@context/UserPreferences' +import { usePrices } from '@context/Prices' const cx = classNames.bind(styles) @@ -55,6 +57,8 @@ export default function InputElement({ ...props }: InputProps): ReactElement { const styleClasses = cx({ select: true, [size]: size }) + const { locale, currency } = useUserPreferences() + const { prices } = usePrices() switch (props.type) { case 'select': { const sortedOptions = @@ -91,6 +95,9 @@ export default function InputElement({ return ( @@ -100,6 +107,9 @@ export default function InputElement({ return ( () const newCancelToken = useCancelToken() - const { locale } = useUserPreferences() + const { locale, currency } = useUserPreferences() + const { prices } = usePrices() useEffect(() => { if (!asset) return @@ -44,7 +45,12 @@ export default function AlgorithmDatasetsListForCompute({ return (

Datasets algorithm is allowed to run on

- +
) } diff --git a/src/components/Asset/AssetActions/Compute/PriceOutput.tsx b/src/components/Asset/AssetActions/Compute/PriceOutput.tsx index 124ef6330..cd454006f 100644 --- a/src/components/Asset/AssetActions/Compute/PriceOutput.tsx +++ b/src/components/Asset/AssetActions/Compute/PriceOutput.tsx @@ -5,6 +5,7 @@ import Tooltip from '@shared/atoms/Tooltip' import styles from './PriceOutput.module.css' import { AccessDetails } from 'src/@types/Price' import { useUserPreferences } from '@context/UserPreferences' +import { usePrices } from '@context/Prices' interface PriceOutputProps { totalPrice: number hasPreviousOrder: boolean @@ -32,7 +33,8 @@ function Row({ timeout?: string sign?: string }) { - const { locale } = useUserPreferences() + const { locale, currency } = useUserPreferences() + const { prices } = usePrices() return (
{sign}
@@ -43,6 +45,8 @@ function Row({ size="small" className={styles.price} locale={locale} + currency={currency} + prices={prices} /> {timeout && @@ -67,7 +71,8 @@ export default function PriceOutput({ selectedComputeAssetTimeout }: PriceOutputProps): ReactElement { const { asset } = useAsset() - const { locale } = useUserPreferences() + const { locale, currency } = useUserPreferences() + const { prices } = usePrices() return (
You will pay{' '} @@ -76,6 +81,8 @@ export default function PriceOutput({ symbol={symbol} size="small" locale={locale} + currency={currency} + prices={prices} /> () @@ -395,6 +397,8 @@ export default function Compute({ conversion size="large" locale={locale} + currency={currency} + prices={prices} />
diff --git a/src/components/Asset/AssetActions/Download.tsx b/src/components/Asset/AssetActions/Download.tsx index e064d0fec..fa86bf37e 100644 --- a/src/components/Asset/AssetActions/Download.tsx +++ b/src/components/Asset/AssetActions/Download.tsx @@ -20,6 +20,7 @@ import { useIsMounted } from '@hooks/useIsMounted' import { usePool } from '@context/Pool' import { useMarketMetadata } from '@context/MarketMetadata' import { useUserPreferences } from '@context/UserPreferences' +import { usePrices } from '@context/Prices' export default function Download({ asset, @@ -37,7 +38,8 @@ export default function Download({ consumableFeedback?: string }): ReactElement { const { accountId, web3 } = useWeb3() - const { locale } = useUserPreferences() + const { locale, currency } = useUserPreferences() + const { prices } = usePrices() const { getOpcFeeForToken } = useMarketMetadata() const { isInPurgatory, isAssetNetwork } = useAsset() const { poolData } = usePool() @@ -216,6 +218,8 @@ export default function Download({ conversion size="large" locale={locale} + currency={currency} + prices={prices} /> {!isInPurgatory && }
diff --git a/src/components/Asset/AssetActions/UserLiquidity.tsx b/src/components/Asset/AssetActions/UserLiquidity.tsx index 0936bab84..452d1fde1 100644 --- a/src/components/Asset/AssetActions/UserLiquidity.tsx +++ b/src/components/Asset/AssetActions/UserLiquidity.tsx @@ -2,6 +2,7 @@ import React, { ReactElement } from 'react' import PriceUnit from '@shared/Price/PriceUnit' import styles from './UserLiquidity.module.css' import { useUserPreferences } from '@context/UserPreferences' +import { usePrices } from '@context/Prices' function UserLiquidityLine({ title, @@ -12,11 +13,20 @@ function UserLiquidityLine({ amount: string symbol: string }) { - const { locale } = useUserPreferences() + const { locale, currency } = useUserPreferences() + const { prices } = usePrices() + return (
{title} - +
) }