diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/index.tsx b/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/index.tsx index b376e2da449..3fb64d26616 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/index.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/index.tsx @@ -1,28 +1,20 @@ import React from 'react' -import { connect } from 'react-redux' -import { selectors } from 'data' +import { getAuthorizeVerifyDevice } from 'data/auth/selectors' +import { useRemote } from 'hooks' import { Props } from '..' import Error from './template.error' import Loading from './template.loading' import Success from './template.success' -class VerifyMagicLink extends React.PureComponent { - render() { - return this.props.data.cata({ - Failure: (val) => , - Loading: () => , - NotAsked: () => , - Success: (val) => - }) - } -} +const VerifyMagicLink = (props: Props) => { + const { data, error, isLoading, isNotAsked } = useRemote(getAuthorizeVerifyDevice) -const mapStateToProps = (state) => ({ - data: selectors.auth.getAuthorizeVerifyDevice(state) -}) + if (isLoading || isNotAsked) return -const connector = connect(mapStateToProps) + if (error) return + return +} -export default connector(VerifyMagicLink) +export default VerifyMagicLink diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/template.error.tsx b/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/template.error.tsx index 725ab7b1dbc..ceddecac459 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/template.error.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/template.error.tsx @@ -12,8 +12,7 @@ const ErrorWrapper = styled(Wrapper)` flex-direction: column; ` -const Error = (props) => { - const { error } = props +const Error = ({ error }) => { return ( diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/template.loading.tsx b/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/template.loading.tsx index 77afbabc293..4c1694ea237 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/template.loading.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/template.loading.tsx @@ -12,18 +12,16 @@ const LoadingWrapper = styled(Wrapper)` flex-direction: column; ` -const Loading = () => { - return ( - - - - - - - ) -} +const Loading = () => ( + + + + + + +) export default Loading diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/template.success.tsx b/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/template.success.tsx index 3666d7cffa3..4b0bc7aa62e 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/template.success.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/template.success.tsx @@ -3,18 +3,10 @@ import { FormattedMessage } from 'react-intl' import styled from 'styled-components' import { Banner, Button, Icon, Image, Text } from 'blockchain-info-components' -import { Wrapper } from 'components/Public' import { media } from 'services/styles' -import { Props } from '..' import { LoginWrapper } from '../model' -const InfoWrapper = styled.div` - width: 100%; - text-align: left; - ${media.mobile` - text-align: center;`} -` const DeviceInfoWrapper = styled.div` margin-top: 20px; ` @@ -86,29 +78,32 @@ const SuccessWrapper = styled.div` flex-direction: column; ` -const Success = (props) => { - const { approver, requester } = props - return props.deviceAuthorized ? ( - - - +const Success = ({ approver, authActions, deviceAuthorized, requester }) => { + if (deviceAuthorized) { + return ( + + + - - - + + + - - - - - - ) : ( + + + + + + ) + } + + return ( @@ -236,7 +231,7 @@ const Success = (props) => { props.authActions.authorizeVerifyDevice(true)} + onClick={() => authActions.authorizeVerifyDevice(true)} > @@ -246,7 +241,7 @@ const Success = (props) => { props.authActions.authorizeVerifyDevice(false)} + onClick={() => authActions.authorizeVerifyDevice(false)} >