diff --git a/nym-wallet/src/components/Bonding/modals/UnbondModal.tsx b/nym-wallet/src/components/Bonding/modals/UnbondModal.tsx index 356b53106b..fdca29ba30 100644 --- a/nym-wallet/src/components/Bonding/modals/UnbondModal.tsx +++ b/nym-wallet/src/components/Bonding/modals/UnbondModal.tsx @@ -1,6 +1,6 @@ -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import { Typography, Alert, TextField } from '@mui/material'; -import { useEffect } from 'react'; +import { useTheme } from '@mui/material/styles'; import { TBondedGateway, TBondedMixnode } from 'src/context'; import { useGetFee } from 'src/hooks/useGetFee'; import { isGateway, isMixnode } from 'src/types'; @@ -21,13 +21,54 @@ interface Props { onError: (e: string) => void; } -type TUnbondModalStep = 1 | 2; +type TUnbondModalStep = 1 | 2 | 3; -export const UnbondModal = ({ node, onConfirm, onClose, onError }: Props) => { - const { fee, isFeeLoading, getFee, feeError } = useGetFee(); - const [step, setStep] = useState(1); +const UnbondFirstStep = ({ handleVerification, onClose }: { handleVerification: any; onClose: () => void }) => { const [verificationText, setVerificationText] = useState(''); + const theme = useTheme(); + + return ( + + + If you unbond your node you will loose all your delegators! + + + This action is irreversible and it will not be possible to restore the current state again + + + To unbond, type UNBOND in the field below and click + UNBOND button + + { + setVerificationText(e.target.value); + }} + fullWidth + /> + + ); +}; + +const UnbondSecondStep = ({ node, onConfirm, onClose, onError }: Props) => { + const { fee, isFeeLoading, getFee, feeError } = useGetFee(); useEffect(() => { if (feeError) { onError(feeError); @@ -51,63 +92,43 @@ export const UnbondModal = ({ node, onConfirm, onClose, onError }: Props) => { getFee(simulateVestingUnbondGateway, {}); } }, [node]); - console.log('step', step === 1); + + return ( + + + {isMixnode(node) && ( + + )} + + Tokens will be transferred to the account you are logged in with now + + ); +}; + +export const UnbondModal = ({ node, onConfirm, onClose, onError }: Props) => { + const [step, setStep] = useState(1); + + const handleVerification = () => { + setStep(2); + }; + return (
- {step === 1 && ( - - - This action is irreversible and it will not be possible to restore the current state again - - - To unbond, type UNBOND in the field below and click UNBOND button - - setVerificationText(e.target.value)} - autoFocus - fullWidth - /> - - )} - {step === 2 && ( - - - {isMixnode(node) && ( - - )} - - Tokens will be transferred to the account you are logged in with now - - )} + {step === 1 && } + {step === 2 && }
); }; diff --git a/nym-wallet/src/pages/bonding/node-settings/general-settings/InfoSettings.tsx b/nym-wallet/src/pages/bonding/node-settings/general-settings/InfoSettings.tsx index 8678280352..1df6f3d138 100644 --- a/nym-wallet/src/pages/bonding/node-settings/general-settings/InfoSettings.tsx +++ b/nym-wallet/src/pages/bonding/node-settings/general-settings/InfoSettings.tsx @@ -79,7 +79,7 @@ export const InfoSettings = ({ bondedNode }: { bondedNode: TBondedMixnode | TBon borderRadius: 0, bgcolor: 'background.default', color: (theme) => theme.palette.nym.nymWallet.text.blue, - '& .MuiAlert-icon': { color: (theme) => theme.palette.nym.nymWallet.text.blue }, + '& .MuiAlert-icon': { color: (theme) => theme.palette.nym.nymWallet.text.blue, mr: 1 }, }} > Your changes will be ONLY saved on the display. Remember to change the values on your node’s diff --git a/nym-wallet/src/pages/bonding/node-settings/general-settings/ParametersSettings.tsx b/nym-wallet/src/pages/bonding/node-settings/general-settings/ParametersSettings.tsx index 73b8219459..ccc2d3fa88 100644 --- a/nym-wallet/src/pages/bonding/node-settings/general-settings/ParametersSettings.tsx +++ b/nym-wallet/src/pages/bonding/node-settings/general-settings/ParametersSettings.tsx @@ -46,7 +46,7 @@ export const ParametersSettings = ({ bondedNode }: { bondedNode: TBondedMixnode borderRadius: 0, bgcolor: 'background.default', color: (theme) => theme.palette.nym.nymWallet.text.blue, - '& .MuiAlert-icon': { color: (theme) => theme.palette.nym.nymWallet.text.blue }, + '& .MuiAlert-icon': { color: (theme) => theme.palette.nym.nymWallet.text.blue, mr: 1 }, }} > Profit margin can be changed once a month, your changes will be applied in the next interval diff --git a/nym-wallet/src/pages/bonding/node-settings/index.tsx b/nym-wallet/src/pages/bonding/node-settings/index.tsx index 50d031124d..49237de56f 100644 --- a/nym-wallet/src/pages/bonding/node-settings/index.tsx +++ b/nym-wallet/src/pages/bonding/node-settings/index.tsx @@ -26,7 +26,6 @@ export const NodeSettings = () => { const navigate = useNavigate(); const handleUnbond = async (fee?: FeeDetails) => { - navigate('/bonding'); const tx = await unbond(fee); setConfirmationDetails({ status: 'success', @@ -36,7 +35,6 @@ export const NodeSettings = () => { }; const handleError = (error: string) => { - navigate('/bonding'); setConfirmationDetails({ status: 'error', title: 'An error occurred', diff --git a/nym-wallet/src/theme/mui-theme.d.ts b/nym-wallet/src/theme/mui-theme.d.ts index e4b9d518a6..5bf3fb2712 100644 --- a/nym-wallet/src/theme/mui-theme.d.ts +++ b/nym-wallet/src/theme/mui-theme.d.ts @@ -31,6 +31,7 @@ declare module '@mui/material/styles' { highlight: string; success: string; info: string; + red: string; fee: string; background: { light: string; dark: string }; text: { diff --git a/nym-wallet/src/theme/theme.tsx b/nym-wallet/src/theme/theme.tsx index 92c98b82e3..b2d943d4df 100644 --- a/nym-wallet/src/theme/theme.tsx +++ b/nym-wallet/src/theme/theme.tsx @@ -23,6 +23,7 @@ const nymPalette: NymPalette = { highlight: '#FB6E4E', success: '#21D073', info: '#60D7EF', + red: '#DA465B', fee: '#967FF0', background: { light: '#F4F6F8', dark: '#1D2125' }, text: {