diff --git a/ui/component/walletSwap/index.js b/ui/component/walletSwap/index.js index 02c16935f..cefc62a3e 100644 --- a/ui/component/walletSwap/index.js +++ b/ui/component/walletSwap/index.js @@ -5,11 +5,13 @@ import { doOpenModal } from 'redux/actions/app'; import { doAddCoinSwap } from 'redux/actions/coinSwap'; import { doToast } from 'redux/actions/notifications'; import { selectCoinSwaps } from 'redux/selectors/coinSwap'; +import { selectUserVerifiedEmail } from 'redux/selectors/user'; import { selectReceiveAddress, doGetNewAddress, doCheckAddressIsMine } from 'lbry-redux'; const select = (state, props) => ({ receiveAddress: selectReceiveAddress(state), coinSwaps: selectCoinSwaps(state), + isAuthenticated: selectUserVerifiedEmail(state), }); const perform = (dispatch) => ({ diff --git a/ui/component/walletSwap/view.jsx b/ui/component/walletSwap/view.jsx index 8b01bf6d4..f6343d169 100644 --- a/ui/component/walletSwap/view.jsx +++ b/ui/component/walletSwap/view.jsx @@ -12,8 +12,10 @@ import QRCode from 'component/common/qr-code'; import usePersistedState from 'effects/use-persisted-state'; import * as ICONS from 'constants/icons'; import * as MODALS from 'constants/modal_types'; +import * as PAGES from 'constants/pages'; import { clipboard } from 'electron'; import I18nMessage from 'component/i18nMessage'; +import { Redirect, useHistory } from 'react-router'; const BTC_SATOSHIS = 100000000; const BTC_MAX = 21000000; @@ -48,6 +50,7 @@ const NAG_RATE_CALL_FAILED = 'Unable to obtain exchange rate. Try again later.'; type Props = { receiveAddress: string, coinSwaps: Array, + isAuthenticated: boolean, doToast: ({ message: string }) => void, addCoinSwap: (CoinSwapInfo) => void, getNewAddress: () => void, @@ -56,7 +59,16 @@ type Props = { }; function WalletSwap(props: Props) { - const { receiveAddress, doToast, coinSwaps, addCoinSwap, getNewAddress, checkAddressIsMine, openModal } = props; + const { + receiveAddress, + doToast, + coinSwaps, + isAuthenticated, + addCoinSwap, + getNewAddress, + checkAddressIsMine, + openModal, + } = props; const [btc, setBtc] = usePersistedState('swap-btc-amount', 0.001); const [btcError, setBtcError] = React.useState(); @@ -69,6 +81,7 @@ function WalletSwap(props: Props) { const [isSwapping, setIsSwapping] = React.useState(false); const [statusMap, setStatusMap] = React.useState({}); const [isRefreshingStatus, setIsRefreshingStatus] = React.useState(false); + const { location } = useHistory(); const status = btcAddress ? statusMap[btcAddress] : null; const btcTxId = status && status.receipt_txid ? status.receipt_txid : null; @@ -469,6 +482,10 @@ function WalletSwap(props: Props) { ); + if (!isAuthenticated) { + return ; + } + return (