diff --git a/packages/neuron-ui/src/components/SUDTMigrateToExistAccountDialog/index.tsx b/packages/neuron-ui/src/components/SUDTMigrateToExistAccountDialog/index.tsx index bf7707b576..63d430733f 100644 --- a/packages/neuron-ui/src/components/SUDTMigrateToExistAccountDialog/index.tsx +++ b/packages/neuron-ui/src/components/SUDTMigrateToExistAccountDialog/index.tsx @@ -17,7 +17,8 @@ const SUDTMigrateToExistAccountDialog = ({ isMainnet, walletID, isLightClient, - onCancel, + onCloseDialog, + onBack, onSuccess, }: { cell: SpecialAssetCell @@ -26,7 +27,8 @@ const SUDTMigrateToExistAccountDialog = ({ isMainnet: boolean walletID: string isLightClient: boolean - onCancel: () => void + onCloseDialog: () => void + onBack: () => void onSuccess: (text: string) => void }) => { const [t] = useTranslation() @@ -56,7 +58,7 @@ const SUDTMigrateToExistAccountDialog = ({ outPoint: cell.outPoint, acpAddress: address, }).then(res => { - onCancel() + onCloseDialog() if (isSuccessResponse(res)) { if (res.result) { dispatch({ @@ -87,14 +89,14 @@ const SUDTMigrateToExistAccountDialog = ({ }) } }) - }, [cell.outPoint, address, t, onCancel, dispatch, walletID]) + }, [cell.outPoint, address, t, onCloseDialog, dispatch, walletID]) return ( void + onCloseDialog: () => void + onBack: () => void onSuccess: (text: string) => void }) => { const [t] = useTranslation() @@ -51,7 +53,7 @@ const SUDTMigrateToNewAccountDialog = ({ generateSudtMigrateAcpTx({ outPoint: cell.outPoint, }).then(res => { - onCancel() + onCloseDialog() if (isSuccessResponse(res)) { if (res.result) { dispatch({ @@ -91,7 +93,7 @@ const SUDTMigrateToNewAccountDialog = ({ }) } }) - }, [cell, t, onCancel, walletID, tokenInfo, dispatch, sudtAmount]) + }, [cell, t, onCloseDialog, walletID, tokenInfo, dispatch, sudtAmount]) const renderList = fields.map(field => { return field.key === 'balance' ? ( @@ -123,7 +125,7 @@ const SUDTMigrateToNewAccountDialog = ({ className={styles.container} show title={t('migrate-sudt.turn-into-new-account.title')} - onCancel={onCancel} + onCancel={onBack} cancelText={t('migrate-sudt.cancel')} confirmText={t('migrate-sudt.confirm')} onConfirm={onSubmit} diff --git a/packages/neuron-ui/src/components/SpecialAssetList/index.tsx b/packages/neuron-ui/src/components/SpecialAssetList/index.tsx index beef7382d8..9b4c804427 100644 --- a/packages/neuron-ui/src/components/SpecialAssetList/index.tsx +++ b/packages/neuron-ui/src/components/SpecialAssetList/index.tsx @@ -121,6 +121,12 @@ const SpecialAssetList = () => { ) const onCloseDialog = useCallback(() => { + setIsExistAccountDialogOpen(false) + setIsNewAccountDialogOpen(false) + setIsMigrateDialogOpen(false) + }, [setIsNewAccountDialogOpen, setIsExistAccountDialogOpen, setIsMigrateDialogOpen]) + + const onBack = useCallback(() => { setIsExistAccountDialogOpen(false) setIsNewAccountDialogOpen(false) setIsMigrateDialogOpen(true) @@ -522,7 +528,8 @@ const SpecialAssetList = () => { sUDTAccounts={sUDTAccounts} walletID={id} tokenInfo={migrateTokenInfo} - onCancel={onCloseDialog} + onCloseDialog={onCloseDialog} + onBack={onBack} onSuccess={handleActionSuccess} /> ) : null} @@ -534,7 +541,8 @@ const SpecialAssetList = () => { sUDTAccounts={sUDTAccounts} isMainnet={isMainnet} walletID={id} - onCancel={onCloseDialog} + onCloseDialog={onCloseDialog} + onBack={onBack} isLightClient={isLightClient} onSuccess={handleActionSuccess} />