diff --git a/nym-wallet/src/components/Accounts/MultiAccountHowTo.tsx b/nym-wallet/src/components/Accounts/MultiAccountHowTo.tsx index fa7ae1659c..a9da0f1ef3 100644 --- a/nym-wallet/src/components/Accounts/MultiAccountHowTo.tsx +++ b/nym-wallet/src/components/Accounts/MultiAccountHowTo.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { Alert, Box, Paper, Dialog, DialogContent, DialogTitle, IconButton, Stack, Typography } from '@mui/material'; import { Close } from '@mui/icons-material'; +import { useTheme } from '@mui/material/styles'; const passwordCreationSteps = [ 'Log out', @@ -10,34 +11,46 @@ const passwordCreationSteps = [ 'Now you can create multiple accounts', ]; -export const MultiAccountHowTo = ({ show, handleClose }: { show: boolean; handleClose: () => void }) => ( - - - - Multi accounts - - - - - theme.palette.nym.text.muted }}> - How to set up multiple accounts - - - - - (t.palette.mode === 'dark' ? { bgcolor: (theme) => theme.palette.background.paper } : {})} - > - In order to create multiple accounts your wallet needs a password. - Follow steps below to create password. - - How to create a password for your account - {passwordCreationSteps.map((step, index) => ( - {`${index + 1}. ${step}`} - ))} - - - -); +export const MultiAccountHowTo = ({ show, handleClose }: { show: boolean; handleClose: () => void }) => { + const theme = useTheme(); + return ( + + + + + Multi accounts + + + + + theme.palette.nym.text.muted }}> + How to set up multiple accounts + + + + + (t.palette.mode === 'dark' ? { bgcolor: (theme) => theme.palette.background.paper } : {})} + > + In order to create multiple accounts your wallet needs a password. + Follow steps below to create password. + + How to create a password for your account + {passwordCreationSteps.map((step, index) => ( + {`${index + 1}. ${step}`} + ))} + + + + + ); +}; diff --git a/nym-wallet/src/components/Accounts/modals/AccountsModal.tsx b/nym-wallet/src/components/Accounts/modals/AccountsModal.tsx index efe5a5428c..91525b8a54 100644 --- a/nym-wallet/src/components/Accounts/modals/AccountsModal.tsx +++ b/nym-wallet/src/components/Accounts/modals/AccountsModal.tsx @@ -12,6 +12,7 @@ import { Divider, } from '@mui/material'; import { Add, ArrowDownwardSharp, Close } from '@mui/icons-material'; +import { useTheme } from '@mui/material/styles'; import { AccountsContext } from 'src/context'; import { AccountItem } from '../AccountItem'; import { ConfirmPasswordModal } from './ConfirmPasswordModal'; @@ -21,6 +22,8 @@ export const AccountsModal = () => { useContext(AccountsContext); const [accountToSwitchTo, setAccountToSwitchTo] = useState(); + const theme = useTheme(); + const handleClose = () => { setDialogToDisplay(undefined); setError(undefined); @@ -47,48 +50,51 @@ export const AccountsModal = () => { open={dialogToDisplay === 'Accounts'} onClose={handleClose} fullWidth - PaperComponent={Paper} - PaperProps={{ elevation: 0 }} + PaperProps={{ + style: { border: `1px solid ${theme.palette.nym.nymWallet.modal.border}` }, + }} > - - - Accounts - - - - - - Switch between accounts - - - - {accounts?.map(({ id, address }) => ( - { - if (selectedAccount?.id !== id) { - setAccountToSwitchTo(id); - } - }} - /> - ))} - - - - - - + + + + Accounts + + + + + + Switch between accounts + + + + {accounts?.map(({ id, address }) => ( + { + if (selectedAccount?.id !== id) { + setAccountToSwitchTo(id); + } + }} + /> + ))} + + + + + + + ); }; diff --git a/nym-wallet/src/components/Accounts/modals/ConfirmPasswordModal.tsx b/nym-wallet/src/components/Accounts/modals/ConfirmPasswordModal.tsx index 29694fcda8..07baa9b8d8 100644 --- a/nym-wallet/src/components/Accounts/modals/ConfirmPasswordModal.tsx +++ b/nym-wallet/src/components/Accounts/modals/ConfirmPasswordModal.tsx @@ -1,6 +1,6 @@ import React, { useContext } from 'react'; -import { Box, Paper, Dialog, DialogTitle, IconButton, Typography } from '@mui/material'; -import { ArrowBack } from '@mui/icons-material'; +import { Paper, Dialog, DialogTitle, Typography } from '@mui/material'; +import { useTheme } from '@mui/material/styles'; import { ConfirmPassword } from 'src/components/ConfirmPassword'; import { AccountsContext } from 'src/context'; @@ -14,28 +14,32 @@ export const ConfirmPasswordModal = ({ onConfirm: (password: string) => Promise; }) => { const { isLoading, error } = useContext(AccountsContext); + const theme = useTheme(); return ( - - Switch account - - Confirm password - - - + + + Switch account + + Confirm password + + + + ); }; diff --git a/nym-wallet/src/components/Accounts/modals/EditAccountModal.tsx b/nym-wallet/src/components/Accounts/modals/EditAccountModal.tsx index 91a0a65e9d..8ddbb207b3 100644 --- a/nym-wallet/src/components/Accounts/modals/EditAccountModal.tsx +++ b/nym-wallet/src/components/Accounts/modals/EditAccountModal.tsx @@ -12,6 +12,7 @@ import { Typography, } from '@mui/material'; import { Close } from '@mui/icons-material'; +import { useTheme } from '@mui/material/styles'; import { AccountsContext } from 'src/context'; export const EditAccountModal = () => { @@ -19,6 +20,8 @@ export const EditAccountModal = () => { const { accountToEdit, dialogToDisplay, setDialogToDisplay, handleEditAccount } = useContext(AccountsContext); + const theme = useTheme(); + useEffect(() => { setAccountName(accountToEdit ? accountToEdit?.id : ''); }, [accountToEdit]); @@ -28,48 +31,51 @@ export const EditAccountModal = () => { open={dialogToDisplay === 'Edit'} onClose={() => setDialogToDisplay('Accounts')} fullWidth - PaperComponent={Paper} - PaperProps={{ elevation: 0 }} + PaperProps={{ + style: { border: `1px solid ${theme.palette.nym.nymWallet.modal.border}` }, + }} > - - - Edit account name - setDialogToDisplay('Accounts')}> - - - - - New wallet address - - - - - + + + Edit account name + setDialogToDisplay('Accounts')}> + + + + + New wallet address + + + + + setAccountName(e.target.value)} + autoFocus + /> + + + + - + disableElevation + variant="contained" + size="large" + onClick={() => { + if (accountToEdit) { + handleEditAccount({ ...accountToEdit, id: accountName }); + setDialogToDisplay('Accounts'); + } + }} + disabled={!accountName?.length} + > + Edit + + + ); }; diff --git a/nym-wallet/src/components/Bonding/forms/BondMixnodeForm.tsx b/nym-wallet/src/components/Bonding/forms/BondMixnodeForm.tsx index a603907e4d..fe74699dcf 100644 --- a/nym-wallet/src/components/Bonding/forms/BondMixnodeForm.tsx +++ b/nym-wallet/src/components/Bonding/forms/BondMixnodeForm.tsx @@ -157,7 +157,7 @@ const AmountFormData = ({ return ( - + {hasVestingTokens && setValue('tokenPool', pool)} />} {step === 1 && ( <> - + diff --git a/nym-wallet/src/components/Bonding/modals/BondMixnodeModal.tsx b/nym-wallet/src/components/Bonding/modals/BondMixnodeModal.tsx index c2bf747d83..3151ffad5d 100644 --- a/nym-wallet/src/components/Bonding/modals/BondMixnodeModal.tsx +++ b/nym-wallet/src/components/Bonding/modals/BondMixnodeModal.tsx @@ -152,18 +152,16 @@ export const BondMixnodeModal = ({ subHeader={`Step ${step}/2`} okLabel="Next" > - - - + ); }; diff --git a/nym-wallet/src/components/Bonding/modals/NodeSettingsModal.tsx b/nym-wallet/src/components/Bonding/modals/NodeSettingsModal.tsx index 4bdc611f68..ac8cf7fc36 100644 --- a/nym-wallet/src/components/Bonding/modals/NodeSettingsModal.tsx +++ b/nym-wallet/src/components/Bonding/modals/NodeSettingsModal.tsx @@ -111,7 +111,7 @@ export const NodeSettings = ({ Set profit margin - setPm(e.target.value)} fullWidth /> + setPm(e.target.value)} fullWidth /> {error && ( Profit margin should be a number between 0 and 100 diff --git a/nym-wallet/src/components/ConfirmTX.stories.tsx b/nym-wallet/src/components/ConfirmTX.stories.tsx index 77bbf4fdcf..2eec07b7e3 100644 --- a/nym-wallet/src/components/ConfirmTX.stories.tsx +++ b/nym-wallet/src/components/ConfirmTX.stories.tsx @@ -10,9 +10,9 @@ export default { const Template: ComponentStory = (args) => ( - - - + + + ); diff --git a/nym-wallet/src/components/Delegation/DelegateModal.tsx b/nym-wallet/src/components/Delegation/DelegateModal.tsx index 50873055e4..a6c1bb0dbf 100644 --- a/nym-wallet/src/components/Delegation/DelegateModal.tsx +++ b/nym-wallet/src/components/Delegation/DelegateModal.tsx @@ -213,8 +213,8 @@ export const DelegateModal: React.FC<{ onPrev={resetFeeState} onConfirm={handleOk} > - - + + ); } @@ -267,7 +267,7 @@ export const DelegateModal: React.FC<{ > {errorIdentityKey} - + {hasVestingContract && setTokenPool(pool)} />} void; }> = ({ children, open, title, message, sx, backdropProps, onClose }) => ( - + `1px solid ${t.palette.nym.nymWallet.modal.border}`, ...modalStyle, ...sx }} + textAlign="center" + > theme.palette.error.main} mb={1}> {title || 'Oh no! Something went wrong...'} diff --git a/nym-wallet/src/components/Modals/LoadingModal.tsx b/nym-wallet/src/components/Modals/LoadingModal.tsx index a50bec77eb..eda3d407a4 100644 --- a/nym-wallet/src/components/Modals/LoadingModal.tsx +++ b/nym-wallet/src/components/Modals/LoadingModal.tsx @@ -18,7 +18,10 @@ export const LoadingModal: React.FC<{ backdropProps?: object; }> = ({ sx, backdropProps }) => ( - + `1px solid ${t.palette.nym.nymWallet.modal.border}`, ...modalStyle, ...sx }} + textAlign="center" + > Please wait... diff --git a/nym-wallet/src/components/Modals/ModalFee.tsx b/nym-wallet/src/components/Modals/ModalFee.tsx index f60f6690ac..752be087a7 100644 --- a/nym-wallet/src/components/Modals/ModalFee.tsx +++ b/nym-wallet/src/components/Modals/ModalFee.tsx @@ -5,17 +5,33 @@ import { ModalListItem } from './ModalListItem'; import { ModalDivider } from './ModalDivider'; type TFeeProps = { fee?: FeeDetails; isLoading: boolean; error?: string; divider?: boolean }; +type TTotalAmountProps = { fee?: FeeDetails; amount?: string; isLoading: boolean; error?: string; divider?: boolean }; -const getValue = ({ fee, isLoading, error }: TFeeProps) => { +const getValue = ({ fee, amount, isLoading, error }: TTotalAmountProps) => { if (isLoading) return ; if (error && !isLoading) return 'n/a'; - if (fee) return `${fee.amount?.amount} ${fee.amount?.denom.toUpperCase()}`; + if (fee) { + const numericFee = Number(fee.amount?.amount); + const numericAmountToTransfer = Number(amount); + return amount + ? `${numericFee + numericAmountToTransfer} ${fee.amount?.denom.toUpperCase()}` + : `${fee.amount?.amount} ${fee.amount?.denom.toUpperCase()}`; + } return '-'; }; export const ModalFee = ({ fee, isLoading, error, divider }: TFeeProps) => ( <> - + {divider && } ); + +export const ModalTotalAmount = ({ fee, amount, isLoading, error, divider }: TTotalAmountProps) => { + return ( + <> + + {divider && } + + ); +}; diff --git a/nym-wallet/src/components/Modals/ModalListItem.tsx b/nym-wallet/src/components/Modals/ModalListItem.tsx index 2c1524dec8..1bf70c2384 100644 --- a/nym-wallet/src/components/Modals/ModalListItem.tsx +++ b/nym-wallet/src/components/Modals/ModalListItem.tsx @@ -12,11 +12,11 @@ export const ModalListItem: React.FC<{ }> = ({ label, value, hidden, fontWeight, divider }) => (