Commit 9327fb53 authored by tom's avatar tom

hide add token in modal for non-token addresses

parent c4991442
...@@ -11,6 +11,8 @@ import AddressVerificationStepAddress from './steps/AddressVerificationStepAddre ...@@ -11,6 +11,8 @@ import AddressVerificationStepAddress from './steps/AddressVerificationStepAddre
import AddressVerificationStepSignature from './steps/AddressVerificationStepSignature'; import AddressVerificationStepSignature from './steps/AddressVerificationStepSignature';
import AddressVerificationStepSuccess from './steps/AddressVerificationStepSuccess'; import AddressVerificationStepSuccess from './steps/AddressVerificationStepSuccess';
type StateData = AddressVerificationFormFirstStepFields & AddressCheckStatusSuccess & { isToken?: boolean };
interface Props { interface Props {
isOpen: boolean; isOpen: boolean;
onClose: () => void; onClose: () => void;
...@@ -20,7 +22,7 @@ interface Props { ...@@ -20,7 +22,7 @@ interface Props {
const AddressVerificationModal = ({ isOpen, onClose, onSubmit, onAddTokenInfoClick }: Props) => { const AddressVerificationModal = ({ isOpen, onClose, onSubmit, onAddTokenInfoClick }: Props) => {
const [ stepIndex, setStepIndex ] = React.useState(0); const [ stepIndex, setStepIndex ] = React.useState(0);
const [ data, setData ] = React.useState<AddressVerificationFormFirstStepFields & AddressCheckStatusSuccess>({ address: '', signingMessage: '' }); const [ data, setData ] = React.useState<StateData>({ address: '', signingMessage: '' });
const handleGoToSecondStep = React.useCallback((firstStepResult: typeof data) => { const handleGoToSecondStep = React.useCallback((firstStepResult: typeof data) => {
setData(firstStepResult); setData(firstStepResult);
...@@ -30,6 +32,7 @@ const AddressVerificationModal = ({ isOpen, onClose, onSubmit, onAddTokenInfoCli ...@@ -30,6 +32,7 @@ const AddressVerificationModal = ({ isOpen, onClose, onSubmit, onAddTokenInfoCli
const handleGoToThirdStep = React.useCallback((address: VerifiedAddress) => { const handleGoToThirdStep = React.useCallback((address: VerifiedAddress) => {
onSubmit(address); onSubmit(address);
setStepIndex((prev) => prev + 1); setStepIndex((prev) => prev + 1);
setData((prev) => ({ ...prev, isToken: Boolean(address.metadata.tokenName) }));
}, [ onSubmit ]); }, [ onSubmit ]);
const handleGoToPrevStep = React.useCallback(() => { const handleGoToPrevStep = React.useCallback(() => {
...@@ -58,7 +61,14 @@ const AddressVerificationModal = ({ isOpen, onClose, onSubmit, onAddTokenInfoCli ...@@ -58,7 +61,14 @@ const AddressVerificationModal = ({ isOpen, onClose, onSubmit, onAddTokenInfoCli
}, },
{ {
title: 'Congrats! Address is verified.', title: 'Congrats! Address is verified.',
content: <AddressVerificationStepSuccess onShowListClick={ handleClose } onAddTokenInfoClick={ handleAddTokenInfoClick }/>, content: (
<AddressVerificationStepSuccess
onShowListClick={ handleClose }
onAddTokenInfoClick={ handleAddTokenInfoClick }
isToken={ data.isToken }
address={ data.address }
/>
),
}, },
]; ];
const step = steps[stepIndex]; const step = steps[stepIndex];
......
...@@ -4,24 +4,28 @@ import React from 'react'; ...@@ -4,24 +4,28 @@ import React from 'react';
interface Props { interface Props {
onShowListClick: () => void; onShowListClick: () => void;
onAddTokenInfoClick: () => void; onAddTokenInfoClick: () => void;
isToken?: boolean;
address: string;
} }
const AddressVerificationStepSuccess = ({ onAddTokenInfoClick, onShowListClick }: Props) => { const AddressVerificationStepSuccess = ({ onAddTokenInfoClick, onShowListClick, isToken, address }: Props) => {
return ( return (
<Box> <Box>
<Alert status="success" flexWrap="wrap" whiteSpace="pre-wrap" wordBreak="break-word" mb={ 3 } display="inline-block"> <Alert status="success" flexWrap="wrap" whiteSpace="pre-wrap" wordBreak="break-word" mb={ 3 } display="inline-block">
<span>The address ownership for </span> <span>The address ownership for </span>
<chakra.span fontWeight={ 700 }>0xaba7161a7fb69c88e16ed9f455ce62b791ee4d03</chakra.span> <chakra.span fontWeight={ 700 }>{ address }</chakra.span>
<span> is verified.</span> <span> is verified.</span>
</Alert> </Alert>
<p>You may now submit the “Add token information” request</p> <p>You may now submit the “Add token information” request</p>
<Flex alignItems="center" mt={ 8 } columnGap={ 5 } flexWrap="wrap" rowGap={ 5 }> <Flex alignItems="center" mt={ 8 } columnGap={ 5 } flexWrap="wrap" rowGap={ 5 }>
<Button size="lg" variant="outline" onClick={ onShowListClick }> <Button size="lg" variant={ isToken ? 'outline' : 'solid' } onClick={ onShowListClick }>
View my verified addresses View my verified addresses
</Button> </Button>
<Button size="lg" onClick={ onAddTokenInfoClick }> { isToken && (
Add token information <Button size="lg" onClick={ onAddTokenInfoClick }>
</Button> Add token information
</Button>
) }
</Flex> </Flex>
</Box> </Box>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment