fix displayed denom

This commit is contained in:
fmtabbara
2022-07-20 12:22:36 +01:00
parent df4385ab71
commit 641b8179ba
8 changed files with 18 additions and 8 deletions
@@ -219,6 +219,7 @@ export const DelegateModal: React.FC<{
initialValue={amount}
autoFocus={Boolean(initialIdentityKey)}
onChanged={handleAmountChanged}
denom={currency}
/>
</Box>
<Typography
@@ -30,6 +30,7 @@ export const SendInput = () => {
<SendInputModal
toAddress=""
fromAddress="nymt1w8qp7zsxggvtxhpqpt6e329j42wtv07dm5ts8u"
denom="NYM"
onNext={() => {}}
onClose={() => {}}
onAddressChange={() => {}}
@@ -13,6 +13,7 @@ export const SendInputModal = ({
amount,
balance,
error,
denom,
onNext,
onClose,
onAmountChange,
@@ -25,6 +26,7 @@ export const SendInputModal = ({
amount?: DecCoin;
balance?: string;
error?: string;
denom: string;
onNext: () => void;
onClose: () => void;
onAmountChange: (value: DecCoin) => void;
@@ -69,6 +71,7 @@ export const SendInputModal = ({
validate(value);
}}
initialValue={amount?.amount}
denom={denom}
/>
<Typography fontSize="smaller" sx={{ color: 'error.main' }}>
{error}
@@ -89,6 +89,7 @@ export const SendModal = ({ onClose, hasStorybookStyles }: { onClose: () => void
error={error}
onAmountChange={(value) => setAmount(value)}
onAddressChange={(value) => setToAddress(value)}
denom={denom}
{...hasStorybookStyles}
/>
);
@@ -32,7 +32,7 @@ const AmountModal = ({ open, onClose, onSubmit, nodeType }: Props) => {
},
});
const { userBalance, clientDetails } = useContext(AppContext);
const { userBalance, denom } = useContext(AppContext);
const onSubmitForm = async (data: AmountData) => {
if (data.tokenPool === 'balance' && !(await checkHasEnoughFunds(data.amount.amount || ''))) {
@@ -80,14 +80,16 @@ const AmountModal = ({ open, onClose, onSubmit, nodeType }: Props) => {
fullWidth
label="Amount"
name="amount"
currencyDenom={clientDetails?.display_mix_denom}
currencyDenom={denom}
errorMessage={errors.amount?.amount?.message}
/>
</Stack>
</form>
<Stack direction="row" justifyContent="space-between" mt={3}>
<Typography fontWeight={600}>Account balance</Typography>
<Typography fontWeight={600}>{userBalance.balance?.printable_balance || 0}</Typography>
<Typography fontWeight={600} textTransform="uppercase">
{userBalance.balance?.printable_balance || 0}
</Typography>
</Stack>
<Divider sx={{ my: 1 }} />
<Typography fontWeight={400}>Est. fee for this transaction will be cauculated in the next page</Typography>
@@ -1,7 +1,6 @@
import * as React from 'react';
import { Control, useController } from 'react-hook-form';
import { CurrencyFormField } from '@nymproject/react/currency/CurrencyFormField';
import { CurrencyDenom } from '@nymproject/types';
interface Props {
name: string;
@@ -10,7 +9,7 @@ interface Props {
required?: boolean;
fullWidth?: boolean;
errorMessage?: string;
currencyDenom?: CurrencyDenom;
currencyDenom?: string;
}
const CurrencyInput = ({ name, label, control, errorMessage, currencyDenom, required, fullWidth }: Props) => {
@@ -20,6 +19,7 @@ const CurrencyInput = ({ name, label, control, errorMessage, currencyDenom, requ
name,
control,
});
return (
<CurrencyFormField
showCoinMark
@@ -80,7 +80,9 @@ const BondModal = ({ open, onClose, onConfirm, currentBond }: Props) => {
</form>
<Stack direction="row" justifyContent="space-between" mt={3}>
<Typography fontWeight={600}>Account balance</Typography>
<Typography fontWeight={600}>{userBalance.balance?.printable_balance || 0}</Typography>
<Typography fontWeight={600} textTransform="uppercase">
{userBalance.balance?.printable_balance || 0}
</Typography>
</Stack>
<Divider sx={{ my: 1 }} />
<Stack direction="row" justifyContent="space-between">
@@ -132,8 +132,8 @@ export const CurrencyFormField: React.FC<{
required,
endAdornment: showCoinMark && (
<InputAdornment position="end">
{denom === 'unym' && <CoinMark height="20px" />}
{denom !== 'unym' && <span>NYMT</span>}
{denom === 'NYM' && <CoinMark height="20px" />}
{denom !== 'NYM' && <span>NYMT</span>}
</InputAdornment>
),
...{