Skip to content

Commit 8625167

Browse files
committed
chore(login): more refactor
1 parent 919276b commit 8625167

File tree

13 files changed

+87
-108
lines changed

13 files changed

+87
-108
lines changed

packages/blockchain-wallet-v4-frontend/src/data/auth/selectors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function getMobileLoginStarted(state: RootState): AuthStateType['mobileLo
4646
return state.auth.mobileLoginStarted
4747
}
4848

49-
export function getMagicLinkData(state: RootState) {
49+
export function getMagicLinkData(state: RootState): AuthStateType['magicLinkData'] {
5050
return state.auth.magicLinkData
5151
}
5252

packages/blockchain-wallet-v4-frontend/src/data/cache/selectors.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { path, prop } from 'ramda'
1+
import { path } from 'ramda'
22

33
import { crypto as wCrypto } from '@core'
4+
import { RootState } from 'data/rootReducer'
45

56
export const getLastAnnouncementState = (state): object | undefined =>
67
path(['cache', 'announcements'], state)
7-
export const getCache = (state) => prop('cache', state)
8+
export const getCache = (state: RootState) => state.cache
89
export const getEmail = (state): string | undefined => path(['cache', 'lastEmail'], state)
910
export const getExchangeEmail = (state): string | undefined =>
1011
path(['cache', 'exchangeEmail'], state)

packages/blockchain-wallet-v4-frontend/src/scenes/Login/Exchange/EnterEmail/index.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,11 @@ const LoginWrapper = styled(Wrapper)`
2626
`
2727

2828
const EnterEmail = (props: Props) => {
29-
const { busy, formValues, invalid, isMobilePlatform, submitting, walletTabClicked } = props
29+
const { busy, formValues, invalid, isMobilePlatform, submitting } = props
3030

3131
return (
3232
<LoginWrapper>
33-
<ProductTabMenu
34-
active={ProductAuthOptions.EXCHANGE}
35-
onWalletTabClick={walletTabClicked}
36-
isMobilePlatform={isMobilePlatform}
37-
product={ProductAuthOptions.EXCHANGE}
38-
/>
33+
<ProductTabMenu isMobilePlatform={isMobilePlatform} product={ProductAuthOptions.EXCHANGE} />
3934
<WrapperWithPadding>
4035
<FormGroup>
4136
<FormItem style={{ marginTop: '40px' }}>

packages/blockchain-wallet-v4-frontend/src/scenes/Login/Exchange/EnterPassword/index.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ const EnterPasswordExchange = (props: Props) => {
3838
invalid,
3939
isMobilePlatform,
4040
productAuthMetadata,
41-
submitting,
42-
walletTabClicked
41+
submitting
4342
} = props
4443

4544
const dispatch = useDispatch()
@@ -61,20 +60,14 @@ const EnterPasswordExchange = (props: Props) => {
6160

6261
return (
6362
<LoginWrapper>
64-
<ProductTabMenu
65-
active={ProductAuthOptions.EXCHANGE}
66-
onWalletTabClick={walletTabClicked}
67-
isMobilePlatform={isMobilePlatform}
68-
product={ProductAuthOptions.EXCHANGE}
69-
/>
63+
<ProductTabMenu isMobilePlatform={isMobilePlatform} product={ProductAuthOptions.EXCHANGE} />
7064
<WrapperWithPadding>
7165
<BackArrowHeader
7266
formValues={formValues}
7367
handleBackArrowClick={handleBackArrowClickExchange}
7468
hideGuid
7569
marginTop='28px'
7670
hideBackArrow={isMobilePlatform}
77-
product={ProductAuthOptions.EXCHANGE}
7871
/>
7972
<FormGroup>
8073
<FormItem>

packages/blockchain-wallet-v4-frontend/src/scenes/Login/Sofi/Success/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react'
22
import { FormattedMessage } from 'react-intl'
33
import { useDispatch } from 'react-redux'
4+
import { push } from 'connected-react-router'
45
import styled from 'styled-components'
56

67
import { Button, Image, Text } from 'blockchain-info-components'
78
import { Wrapper } from 'components/Public'
8-
import { actions } from 'data'
99
import { isBrowserAndroid, isBrowserIOS } from 'services/browser'
1010
import { isMobile } from 'services/styles'
1111

@@ -21,7 +21,7 @@ const SofiSuccess = () => {
2121
// Add check here to make sure that there is wallet data
2222
// route should navigate to login if there's no wallet data
2323
const sofiWalletRedirect = () => {
24-
dispatch(actions.router.push('/home'))
24+
dispatch(push('/home'))
2525
}
2626
const APP_URL = 'https://blockchainwallet.page.link/dashboard'
2727

packages/blockchain-wallet-v4-frontend/src/scenes/Login/VerifyMagicLink/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@ import React from 'react'
33
import { getAuthorizeVerifyDevice } from 'data/auth/selectors'
44
import { useRemote } from 'hooks'
55

6-
import { Props } from '..'
76
import Error from './template.error'
87
import Loading from './template.loading'
98
import Success from './template.success'
109

11-
const VerifyMagicLink = (props: Props) => {
10+
const VerifyMagicLink = () => {
1211
const { data, error, isLoading, isNotAsked } = useRemote(getAuthorizeVerifyDevice)
1312

1413
if (isLoading || isNotAsked) return <Loading />
1514

1615
if (error) return <Error error={error} />
17-
return <Success {...props} {...data} />
16+
return <Success {...data} />
1817
}
1918

2019
export default VerifyMagicLink

packages/blockchain-wallet-v4-frontend/src/scenes/Login/Wallet/CheckEmail/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,7 @@ const CheckEmail = (props: Props) => {
8585
return (
8686
<LoginWrapper>
8787
<WrapperWithPadding>
88-
<BackArrowHeader
89-
formValues={props.formValues}
90-
handleBackArrowClick={handleBackClick}
91-
product={props.productAuthMetadata.product}
92-
/>
88+
<BackArrowHeader formValues={props.formValues} handleBackArrowClick={handleBackClick} />
9389
<FormBody>
9490
<CircleBackground color='blue600'>
9591
<Icon name='computer' color='white' size='24px' />

packages/blockchain-wallet-v4-frontend/src/scenes/Login/Wallet/EnterEmailOrGuid/index.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import FormGroup from 'components/Form/FormGroup'
99
import FormItem from 'components/Form/FormItem'
1010
import TextBox from 'components/Form/TextBox'
1111
import { Wrapper } from 'components/Public'
12-
import { ProductAuthOptions } from 'data/types'
1312
import { required, validWalletIdOrEmail } from 'services/forms'
1413
import { removeWhitespace } from 'services/forms/normalizers'
1514
import { media } from 'services/styles'
@@ -29,20 +28,12 @@ const LoginWrapper = styled(Wrapper)`
2928
`
3029

3130
const EnterEmailOrGuid = (props: Props) => {
32-
const {
33-
busy,
34-
exchangeTabClicked,
35-
formValues,
36-
invalid,
37-
isMobilePlatform,
38-
submitting,
39-
walletError
40-
} = props
31+
const { busy, formValues, invalid, isMobilePlatform, submitting, walletError } = props
4132
const guidError = walletError?.toLowerCase().includes('unknown wallet id')
4233

4334
return (
4435
<LoginWrapper>
45-
<ProductTabMenu active={ProductAuthOptions.WALLET} onExchangeTabClick={exchangeTabClicked} />
36+
<ProductTabMenu />
4637
<WrapperWithPadding>
4738
<FormGroup>
4839
<FormItem style={{ marginTop: '40px' }}>

packages/blockchain-wallet-v4-frontend/src/scenes/Login/Wallet/EnterPassword/index.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ const SettingsGoalText = styled.div`
7676
const EnterPasswordWallet = (props: OwnProps) => {
7777
const {
7878
busy,
79-
exchangeTabClicked,
8079
formValues,
8180
handleBackArrowClickWallet,
8281
invalid,
@@ -103,12 +102,7 @@ const EnterPasswordWallet = (props: OwnProps) => {
103102
return (
104103
<OuterWrapper>
105104
<FormWrapper>
106-
{!settingsRedirect && !isSofi && (
107-
<ProductTabMenu
108-
active={ProductAuthOptions.WALLET}
109-
onExchangeTabClick={exchangeTabClicked}
110-
/>
111-
)}
105+
{!settingsRedirect && !isSofi && <ProductTabMenu />}
112106
<WrapperWithPadding>
113107
{!settingsRedirect && (
114108
<BackArrowHeader

packages/blockchain-wallet-v4-frontend/src/scenes/Login/Wallet/TwoFA/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ const TwoFAWallet = (props: Props) => {
9898
handleBackArrowClick={handleBackArrowClickWallet}
9999
marginTop='28px'
100100
hideBackArrow={isMobilePlatform}
101-
product={props.productAuthMetadata.product}
102101
/>
103102
{twoFAType && (
104103
<FormGroup>

0 commit comments

Comments
 (0)