diff --git a/src/routes/safe/components/Balances/SendModal/index.jsx b/src/routes/safe/components/Balances/SendModal/index.jsx index b20bb25f..cca7b405 100644 --- a/src/routes/safe/components/Balances/SendModal/index.jsx +++ b/src/routes/safe/components/Balances/SendModal/index.jsx @@ -8,6 +8,7 @@ import Modal from '~/components/Modal' import ChooseTxType from './screens/ChooseTxType' import SendFunds from './screens/SendFunds' import ReviewTx from './screens/ReviewTx' +import SendCustomTx from './screens/SendCustomTx' type Props = { onClose: () => void, @@ -20,14 +21,17 @@ type Props = { tokens: List, selectedToken: string, createTransaction: Function, + activeScreenType: string } -type ActiveScreen = 'chooseTxType' | 'sendFunds' | 'reviewTx' + +type ActiveScreen = 'chooseTxType' | 'sendFunds' | 'reviewTx' | 'sendCustomTx' | 'reviewCustomTx' type TxStateType = | { token: Token, recipientAddress: string, amount: string, + data: string, } | Object @@ -49,23 +53,24 @@ const Send = ({ tokens, selectedToken, createTransaction, + activeScreenType, }: Props) => { - const [activeScreen, setActiveScreen] = useState('sendFunds') + const [activeScreen, setActiveScreen] = useState(activeScreenType || 'chooseTxType') const [tx, setTx] = useState({}) const smallerModalSize = activeScreen === 'chooseTxType' const handleTxCreation = (txInfo) => { setActiveScreen('reviewTx') setTx(txInfo) } - const onClickBack = () => setActiveScreen('sendFunds') + const handleCustomTxCreation = (customTxInfo) => { + setActiveScreen('reviewCustomTx') + setTx(customTxInfo) + } - useEffect( - () => () => { - setActiveScreen('sendFunds') - setTx({}) - }, - [isOpen], - ) + useEffect(() => { + setActiveScreen(activeScreenType || 'chooseTxType') + setTx({}) + }, [isOpen]) return ( )} + {activeScreen === 'sendCustomTx' && ( + + )} ) diff --git a/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx b/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx index a41c1c02..b330156d 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx @@ -27,11 +27,11 @@ import { styles } from './style' type Props = { onClose: () => void, + setActiveScreen: Function, classes: Object, safeAddress: string, etherScanLink: string, safeName: string, - onClickBack: Function, ethBalance: string, tx: Object, createTransaction: Function, @@ -44,13 +44,13 @@ const openIconStyle = { const ReviewTx = ({ onClose, + setActiveScreen, classes, safeAddress, etherScanLink, safeName, ethBalance, tx, - onClickBack, createTransaction, }: Props) => ( @@ -138,7 +138,7 @@ const ReviewTx = ({ -