From ba79f6aae042d7f6f7cba41de81cb858c541611c Mon Sep 17 00:00:00 2001 From: Amir Ekbatanifard Date: Sat, 8 Jun 2024 13:05:41 +0330 Subject: [PATCH 1/2] Small refactor on first time stake review page --- .../src/fullscreen/stake/easyMode/Review.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/extension-polkagate/src/fullscreen/stake/easyMode/Review.tsx b/packages/extension-polkagate/src/fullscreen/stake/easyMode/Review.tsx index 5495215bd..0192b83c6 100644 --- a/packages/extension-polkagate/src/fullscreen/stake/easyMode/Review.tsx +++ b/packages/extension-polkagate/src/fullscreen/stake/easyMode/Review.tsx @@ -104,7 +104,7 @@ export default function Review ({ address, balances, inputs, setRefresh, setStep chain={chain} label={t('Pool')} labelPosition='center' - mode='Joining' + mode={inputs.pool.bondedPool?.state.toString() === 'Creating' ? 'Creating' : 'Joining'} pool={inputs?.pool} showInfo style={{ @@ -137,7 +137,7 @@ export default function Review ({ address, balances, inputs, setRefresh, setStep From 5ef3358af9d8c3b086ad937d17f1d86cf07092e5 Mon Sep 17 00:00:00 2001 From: Nick Date: Sun, 16 Jun 2024 11:51:47 +0330 Subject: [PATCH 2/2] Update Review.tsx --- .../src/fullscreen/stake/easyMode/Review.tsx | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/packages/extension-polkagate/src/fullscreen/stake/easyMode/Review.tsx b/packages/extension-polkagate/src/fullscreen/stake/easyMode/Review.tsx index 7956c7809..c8ce9c831 100644 --- a/packages/extension-polkagate/src/fullscreen/stake/easyMode/Review.tsx +++ b/packages/extension-polkagate/src/fullscreen/stake/easyMode/Review.tsx @@ -1,9 +1,12 @@ // Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors // SPDX-License-Identifier: Apache-2.0 -// @ts-nocheck /* eslint-disable react/jsx-max-props-per-line */ +import type { ApiPromise } from '@polkadot/api'; +import type { BalancesInfo, Proxy, TxInfo } from '../../../util/types'; +import type { Inputs } from '../Entry'; + import { MoreVert as MoreVertIcon } from '@mui/icons-material'; import { Divider, Grid, Typography, useTheme } from '@mui/material'; import React, { useCallback, useMemo, useState } from 'react'; @@ -17,10 +20,8 @@ import { ThroughProxy } from '../../../partials'; import ShowPool from '../../../popup/staking/partial/ShowPool'; import RewardsDestination from '../../../popup/staking/solo/stake/partials/RewardDestination'; import { SYSTEM_SUGGESTION_TEXT } from '../../../util/constants'; -import type { BalancesInfo, Proxy, TxInfo } from '../../../util/types'; import { amountToMachine, pgBoxShadow } from '../../../util/utils'; import DisplayValue from '../../governance/post/castVote/partial/DisplayValue'; -import type { Inputs } from '../Entry'; import { STEPS } from '..'; interface Props { @@ -33,7 +34,7 @@ interface Props { setTxInfo: React.Dispatch> } -export default function Review({ address, balances, inputs, setRefresh, setStep, setTxInfo, step }: Props): React.ReactElement { +export default function Review ({ address, balances, inputs, setRefresh, setStep, setTxInfo, step }: Props): React.ReactElement { const { t } = useTranslation(); const { api, chain } = useInfo(address); const theme = useTheme(); @@ -56,6 +57,12 @@ export default function Review({ address, balances, inputs, setRefresh, setStep, return undefined; }, [estimatedFee, inputs]); + + const staked = useMemo(() => + inputs?.extraInfo?.['amount'] && balances?.decimal + ? amountToMachine((inputs.extraInfo as any)['amount'], balances.decimal) + :undefined + , [inputs, balances]); const handleCancel = useCallback(() => { setStep(inputs?.mode || STEPS.INDEX); @@ -92,7 +99,7 @@ export default function Review({ address, balances, inputs, setRefresh, setStep, @@ -148,7 +155,7 @@ export default function Review({ address, balances, inputs, setRefresh, setStep, }