diff --git a/public/assets/locales/fa/translation.json b/public/assets/locales/fa/translation.json index 034d07df..fa3ce4ba 100644 --- a/public/assets/locales/fa/translation.json +++ b/public/assets/locales/fa/translation.json @@ -384,6 +384,7 @@ "minWithdraw": "حداقل مقدار برداشت", "maxWithdrawal": "حداکثر مقدار برداشت", "minDeposit": "حداقل مقدار واریز", + "maxDeposit": "حداکثر مقدار واریز", "maxWithdraw": "سقف برداشت روزانه شما", "maxMonthWithdraw": "سقف برداشت ماهانه شما", "withdrawWarn": "لطفا دقت کنید! ورود اشتباه آدرس می تواند به از دست رفتن سرمایه منجر شود.", diff --git a/src/components/Popup/Popup.js b/src/components/Popup/Popup.js index b844d591..d3c7b011 100644 --- a/src/components/Popup/Popup.js +++ b/src/components/Popup/Popup.js @@ -1,18 +1,15 @@ -import React, {useEffect, useRef, useState} from "react"; +import React from "react"; import classes from "./Popup.module.css"; import {useTranslation} from "react-i18next"; import {useSelector} from "react-redux"; import Button from "../Button/Button"; -import {Link, Navigate} from "react-router-dom"; +import {Link} from "react-router-dom"; import * as Routes from "../../main/Browser/Routes/routes"; -import {Login} from "../../main/Browser/Routes/routes"; -import TextInput from "../TextInput/TextInput"; -import {useGetCurrencyInfo} from "../../queries"; -import Loading from "../Loading/Loading"; -import Error from "../Error/Error"; -import PopupAddress from "./PopupAddress/PopupAddress"; import i18n from "i18next"; import {getCurrencyNameOrAlias} from "../../utils/utils"; +import Deposit + from "../../main/Browser/Pages/UserPanel/Sections/Content/components/Wallet/components/DepositWithdraw/components/Deposit/Deposit"; +import {Login} from "../../main/Browser/Routes/routes"; const Popup = ({currency, closePopup}) => { @@ -23,57 +20,18 @@ const Popup = ({currency, closePopup}) => { const language = i18n.language const currencies = useSelector((state) => state.exchange.currencies) - const [networkName, setNetworkName] = useState({value: 0, error: []}); - - const selectRef = useRef() - const {data: currencyInfo, isLoading: CILoading, error: CIError, refetch: refetchCI} = useGetCurrencyInfo(currency) - - useEffect(() => { - setNetworkName({value: 0, error: []}) - - }, [currency]); - - - - useEffect(() => { - if (currency !== "IRT") { - refetchCI() - } - }, [currency]); - - const content = () => { + if(!isLogin) return
- {t("commission")} : {new BN(tr.commission).decimalPlaces(currencies[tr.commissionAsset.toUpperCase()].precision).toFormat()} + {t("commission")} : {formatWithPrecision(tr.commission, currencies[tr.commissionAsset.toUpperCase()].precision)} {getCurrencyNameOrAlias(currencies[tr.commissionAsset.toUpperCase()], language)}
{t("orders.tradeFee")}:{" "} - {order.tradeFee.toFormat()}{" "} + {formatWithPrecision(order.tradeFee, currencies[activePair.baseAsset]?.precision ?? 0)}{" "} {getCurrencyNameOrAlias(currencies[activePair.baseAsset], language)}
diff --git a/src/main/Browser/Pages/UserPanel/Sections/Content/components/Market/components/Order/components/SellOrder/SellOrder.js b/src/main/Browser/Pages/UserPanel/Sections/Content/components/Market/components/Order/components/SellOrder/SellOrder.js index 852a2a07..7f96b88e 100644 --- a/src/main/Browser/Pages/UserPanel/Sections/Content/components/Market/components/Order/components/SellOrder/SellOrder.js +++ b/src/main/Browser/Pages/UserPanel/Sections/Content/components/Market/components/Order/components/SellOrder/SellOrder.js @@ -3,7 +3,12 @@ import {Trans, useTranslation} from "react-i18next"; import classes from "../../Order.module.css"; import {useDispatch, useSelector} from "react-redux"; import {toast} from "react-hot-toast"; -import {BN, getCurrencyNameOrAlias, parsePriceString} from "../../../../../../../../../../../../utils/utils"; +import { + BN, + formatWithPrecision, + getCurrencyNameOrAlias, + parsePriceString +} from "../../../../../../../../../../../../utils/utils"; import NumberInput from "../../../../../../../../../../../../components/NumberInput/NumberInput"; import Button from "../../../../../../../../../../../../components/Button/Button"; import {setLastTransaction} from "../../../../../../../../../../../../store/actions/auth"; @@ -263,7 +268,7 @@ const SellOrder = () => {
fillSellByBestPrice()}> {t("orders.bestOffer")}:{" "} - {new BN(bestSellPrice).toFormat()}{" "}{getCurrencyNameOrAlias(currencies[activePair.quoteAsset], language)} + {formatWithPrecision(bestSellPrice, currencies[activePair.quoteAsset]?.precision ?? 0)}{" "}{getCurrencyNameOrAlias(currencies[activePair.quoteAsset], language)}
{t("orders.tradeFee")}:{" "} {order.tradeFee.toFormat()}{" "} + {formatWithPrecision(order.tradeFee, currencies[activePair.quoteAsset]?.precision ?? 0)}{" "} {getCurrencyNameOrAlias(currencies[activePair.quoteAsset], language)}
diff --git a/src/main/Browser/Pages/UserPanel/Sections/Content/components/Wallet/components/DepositTxTable/DepositTxTable.js b/src/main/Browser/Pages/UserPanel/Sections/Content/components/Wallet/components/DepositTxTable/DepositTxTable.js index 47f90d83..fdaacb28 100644 --- a/src/main/Browser/Pages/UserPanel/Sections/Content/components/Wallet/components/DepositTxTable/DepositTxTable.js +++ b/src/main/Browser/Pages/UserPanel/Sections/Content/components/Wallet/components/DepositTxTable/DepositTxTable.js @@ -3,7 +3,7 @@ import classes from './DepositTxTable.module.css'; import {useTranslation} from "react-i18next"; import Date from "../../../../../../../../../../components/Date/Date"; import moment from "moment-jalaali"; -import {BN} from "../../../../../../../../../../utils/utils"; +import {BN, formatWithPrecision} from "../../../../../../../../../../utils/utils"; import Icon from "../../../../../../../../../../components/Icon/Icon"; import {useSelector} from "react-redux"; import i18n from "i18next"; @@ -47,7 +47,7 @@ const DepositTxTable = ({txs}) => { - {new BN(tr?.amount).decimalPlaces(currencies[tr.currency].precision).toFormat()} + {formatWithPrecision(tr?.amount, currencies[tr.currency].precision)} diff --git a/src/main/Browser/Pages/UserPanel/Sections/Content/components/Wallet/components/DepositWithdraw/components/Deposit/Deposit.js b/src/main/Browser/Pages/UserPanel/Sections/Content/components/Wallet/components/DepositWithdraw/components/Deposit/Deposit.js index ec156ae8..b36fdaad 100644 --- a/src/main/Browser/Pages/UserPanel/Sections/Content/components/Wallet/components/DepositWithdraw/components/Deposit/Deposit.js +++ b/src/main/Browser/Pages/UserPanel/Sections/Content/components/Wallet/components/DepositWithdraw/components/Deposit/Deposit.js @@ -7,10 +7,13 @@ import {useGetGatewaysByCurrency} from "../../../../../../../../../../../../quer import OnChainDeposit from "./Module/OnChainDeposit/OnChainDeposit"; import {useSelector} from "react-redux"; -const Deposit = () => { +const Deposit = ({currency}) => { const {t} = useTranslation(); - const {id} = useParams(); + let {id} = useParams(); + if (currency) { + id = currency; + } const currencies = useSelector((state) => state.exchange.currencies) const { data, isLoading, error } = useGetGatewaysByCurrency(id, { @@ -39,7 +42,7 @@ const Deposit = () => { {t("comingSoon")}