From c8dc16e4c3cd65705b983b348f3bd7edd9d7495e Mon Sep 17 00:00:00 2001 From: fetok12 Date: Tue, 16 Jan 2024 11:51:51 +0300 Subject: [PATCH 1/3] stake-modal-ui-text-redability --- .../Stake/components/CeFiUserStake.js | 47 ++++++++++++------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/web/src/containers/Stake/components/CeFiUserStake.js b/web/src/containers/Stake/components/CeFiUserStake.js index 63f702be20..f77b5f4514 100644 --- a/web/src/containers/Stake/components/CeFiUserStake.js +++ b/web/src/containers/Stake/components/CeFiUserStake.js @@ -543,18 +543,18 @@ const CeFiUserStake = ({ balance, coins, theme }) => {

{STRINGS['CEFI_STAKE.DURATION_LABEL']}

-
+
{STRINGS['CEFI_STAKE.LOCKUP_DURATION_LABEL']}:{' '} {selectedPool.duration ? `${selectedPool.duration} days` : 'Perpetual'}
-
-
+
-
{selectedPool.slashing && ( <>

Slashing

-
+
{ STRINGS[ 'CEFI_STAKE.PENALTY_UPON_INITIAL_STAKE_PRINCIPLE_LABEL' @@ -562,7 +562,7 @@ const CeFiUserStake = ({ balance, coins, theme }) => { } : -{selectedPool.slashing_principle_percentage}%{' '}
-
+
{STRINGS['CEFI_STAKE.FORFEITURE_OF_EARNINGS_LABEL']}: - {selectedPool.slashing_earning_percentage}%
@@ -675,36 +675,41 @@ const CeFiUserStake = ({ balance, coins, theme }) => {

{STRINGS['CEFI_STAKE.CHECK_STAKE_DETAILS_BUTTON']}

-
+
{STRINGS['CEFI_STAKE.STAKING_POOL_LABEL']}: {selectedPool.name}
-
+
{STRINGS['CEFI_STAKE.ANNUAL_PERCENTAGE_YIELD_LABEL']}:{' '} {selectedPool.apy}% APY
-
+
{STRINGS['CEFI_STAKE.DURATION_LABEL']}: {selectedPool.duration}{' '} days{' '}
-
+
{STRINGS['CEFI_STAKE.PENALTY_UPON_INITIAL_STAKE_PRINCIPLE_LABEL']} : -{selectedPool.slashing_principle_percentage}%
-
+
{STRINGS['CEFI_STAKE.FORFEITURE_OF_EARNINGS_DETAILS_LABEL']}: - {selectedPool.slashing_earning_percentage}%
-
+
{STRINGS['CEFI_STAKE.STAKE_AMOUNT_LABEL']}: {stakerAmount}{' '} {selectedPool.currency.toUpperCase()}

-
+
{selectedPool.disclaimer}
-
{STRINGS['CEFI_STAKE.SETTLEMENT_NOTICE']}
+
+ {STRINGS['CEFI_STAKE.SETTLEMENT_NOTICE']} +
{ }} >
{ }} >
{
- + Here we go!{' '}
-
{STRINGS['CEFI_STAKE.STAKE_RULES_NOTICE']}
-
Do you understand?
-
+
+ {STRINGS['CEFI_STAKE.STAKE_RULES_NOTICE']} +
+
+ {' '} + Do you understand? +
+
Date: Tue, 16 Jan 2024 12:55:18 +0300 Subject: [PATCH 2/3] stake-new-formatting-currency --- .../Stake/components/CeFiUserStake.js | 50 ++++++++++++------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/web/src/containers/Stake/components/CeFiUserStake.js b/web/src/containers/Stake/components/CeFiUserStake.js index 63f702be20..5c5b0d352a 100644 --- a/web/src/containers/Stake/components/CeFiUserStake.js +++ b/web/src/containers/Stake/components/CeFiUserStake.js @@ -23,6 +23,7 @@ import moment from 'moment'; import BigNumber from 'bignumber.js'; import { Link } from 'react-router'; import STRINGS from 'config/localizedStrings'; +import { formatToCurrency } from 'utils/currency'; import '../CeFiStake.scss'; import { NotLoggedIn } from 'components'; @@ -151,18 +152,23 @@ const CeFiUserStake = ({ balance, coins, theme }) => { dataIndex: 'earnt', key: 'earnt', render: (_user_id, data) => { - const incrementUnit = - coins[data.reward_currency || data.currency].increment_unit; - const decimalPoint = new BigNumber(incrementUnit).dp(); - const sourceAmount = - data?.reward && - new BigNumber(data?.reward - data?.slashed) - .decimalPlaces(decimalPoint) - .toNumber(); + // const incrementUnit = + // coins[data.reward_currency || data.currency].increment_unit; + + const min = coins[data.reward_currency || data.currency].min; + // const decimalPoint = new BigNumber(incrementUnit).dp(); + // const sourceAmount = + // data?.reward && + // new BigNumber(data?.reward - data?.slashed) + // .decimalPlaces(decimalPoint) + // .toNumber(); + + const formattedAmount = + data?.reward && formatToCurrency(data?.reward - data?.slashed, min); return (
- {sourceAmount}{' '} + {formattedAmount}{' '} {(data?.reward_currency || data?.currency).toUpperCase()}
); @@ -1567,23 +1573,29 @@ const CeFiUserStake = ({ balance, coins, theme }) => { )}
{accumulateReward(userStakeData).map((stake) => { - const incrementUnit = - coins[stake.currency].increment_unit; - const decimalPoint = new BigNumber( - incrementUnit - ).dp(); - const sourceAmount = + const min = coins[stake.currency].min; + + // const incrementUnit = + // coins[stake.currency].increment_unit; + // const decimalPoint = new BigNumber( + // incrementUnit + // ).dp(); + // const sourceAmount = + // stake?.reward && + // new BigNumber(stake?.reward) + // .decimalPlaces(decimalPoint) + // .toNumber(); + + const formattedAmount = stake?.reward && - new BigNumber(stake?.reward) - .decimalPlaces(decimalPoint) - .toNumber(); + formatToCurrency(stake?.reward, min); return (
{( stake.reward_currency || stake.currency ).toUpperCase()} - : {sourceAmount} + : {formattedAmount}
); })} From 8613f6d213f245dcd5e93def7a3cbeed0ebbecba Mon Sep 17 00:00:00 2001 From: fetok12 Date: Tue, 16 Jan 2024 12:56:12 +0300 Subject: [PATCH 3/3] Remove Switch --- web/src/containers/Stake/DesktopStake.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/containers/Stake/DesktopStake.js b/web/src/containers/Stake/DesktopStake.js index 2ed7b761ef..2a2d3af516 100644 --- a/web/src/containers/Stake/DesktopStake.js +++ b/web/src/containers/Stake/DesktopStake.js @@ -4,7 +4,7 @@ import { bindActionCreators } from 'redux'; import mathjs from 'mathjs'; import classnames from 'classnames'; import { ClockCircleOutlined } from '@ant-design/icons'; -import { Button as AntBtn, Switch } from 'antd'; +import { Button as AntBtn } from 'antd'; import { connectWallet, loadBlockchainData,