Skip to content

Commit

Permalink
feat(welcome-modal): new welcome modal
Browse files Browse the repository at this point in the history
  • Loading branch information
jjBlockchain committed Feb 20, 2020
1 parent 3e820f9 commit a9f4804
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
// export type E2EType = 'borrowModal' | 'xyzModal'
export type E2EType = 'borrowModal' | 'faqModal' | 'whatsNewModal'
export type E2EType =
| 'borrowModal'
| 'faqModal'
| 'welcomeModal'
| 'whatsNewModal'
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default ({ api, coreSagas }) => {
}

const saveGoals = function * (firstLogin) {
yield put(actions.goals.saveGoal('walletTour', { firstLogin }))
yield put(actions.goals.saveGoal('welcomeModal', { firstLogin }))
yield put(actions.goals.saveGoal('coinifyUpgrade'))
yield put(actions.goals.saveGoal('coinifyBuyViaCard'))
// yield put(actions.goals.saveGoal('upgradeForAirdrop'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ export default () => {
AT.COINIFY_UPGRADE_SUBMIT_CLICKED,
onboardingSagas.coinifyUpgradeSubmitClicked
)
yield takeLatest(
AT.SKIP_WALLET_TOUR_CLICKED,
onboardingSagas.skipWalletTourClicked
)
yield takeLatest(
AT.SWAP_GET_STARTED_SUBMIT_CLICKED,
onboardingSagas.swapGetStartedSubmitClicked
Expand Down
18 changes: 9 additions & 9 deletions packages/blockchain-wallet-v4-frontend/src/data/goals/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,18 +473,18 @@ export default ({ api }) => {
}
}

const runWalletTour = function * (goal) {
const runWelcomeModal = function * (goal) {
const { id, data } = goal
yield put(actions.goals.deleteGoal(id))

const { firstLogin } = data
if (firstLogin) {
yield put(actions.goals.addInitialModal('walletTour', 'WalletTour'))
yield put(actions.goals.addInitialModal('welcomeModal', 'WELCOME_MODAL'))
} else {
yield put(
actions.logs.logInfoMessage(
logLocation,
'runWalletTour',
'runWelcomeModal',
'login success'
)
)
Expand Down Expand Up @@ -522,7 +522,7 @@ export default ({ api }) => {
swapGetStarted,
swapUpgrade,
upgradeForAirdrop,
walletTour
welcomeModal
} = initialModals
// Order matters here
if (linkAccount) {
Expand Down Expand Up @@ -567,8 +567,8 @@ export default ({ api }) => {
if (airdropClaim) {
return yield put(actions.modals.showModal(airdropClaim.name))
}
if (walletTour) {
yield put(actions.modals.showModal(walletTour.name, walletTour.data))
if (welcomeModal) {
yield put(actions.modals.showModal(welcomeModal.name))
return yield put(
actions.analytics.logEvent(GENERAL_EVENTS.WALLET_INTRO_OFFERED)
)
Expand Down Expand Up @@ -615,8 +615,8 @@ export default ({ api }) => {
case 'airdropClaim':
yield call(runAirdropClaimGoal, goal)
break
case 'walletTour':
yield call(runWalletTour, goal)
case 'welcomeModal':
yield call(runWelcomeModal, goal)
break
}
yield put(actions.goals.initialModalDisplayed)
Expand Down Expand Up @@ -646,7 +646,7 @@ export default ({ api }) => {
runSwapGetStartedGoal,
runSwapUpgradeGoal,
runKycDocResubmitGoal,
runWalletTour,
runWelcomeModal,
runReferralGoal,
runSendBtcGoal,
runUpgradeForAirdropGoal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('goals sagas', () => {
runKycGoal,
runReferralGoal,
runSwapUpgradeGoal,
runWalletTour,
runWelcomeModal,
waitForUserData,
showInitialModal
} = goalsSagas({ api })
Expand Down Expand Up @@ -279,9 +279,9 @@ describe('goals sagas', () => {
})
})

describe('runWalletTour saga', () => {
describe('should not show wallet tour modal if not first login', () => {
const saga = testSaga(runWalletTour, {
describe('runWelcomeModal saga', () => {
describe('should not show wallet welcome modal if not first login', () => {
const saga = testSaga(runWelcomeModal, {
id: mockGoalId,
data: { firstLogin: false }
})
Expand All @@ -294,7 +294,7 @@ describe('goals sagas', () => {
.put(
actions.logs.logInfoMessage(
mockLogLocation,
'runWalletTour',
'runWelcomeModal',
'login success'
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type ModalNamesType =
| 'FAQ_MODAL'
| 'ShowEthPrivateKey'
| 'ShowXlmPrivateKey'
| 'WELCOME_MODAL'
| 'WHATS_NEW_MODAL'

export type ModalType = {
Expand Down
185 changes: 185 additions & 0 deletions packages/blockchain-wallet-v4-frontend/src/modals/Welcome/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
import { actions } from 'data'
import { bindActionCreators, compose } from 'redux'
import { Button, Icon, Image, Text } from 'blockchain-info-components'
import { connect } from 'react-redux'
import { FormattedMessage } from 'react-intl'
import Flyout, { duration, FlyoutWrapper } from 'components/Flyout'
import modalEnhancer from 'providers/ModalEnhancer'
import React from 'react'
import styled from 'styled-components'

type OwnPropsType = {
close: () => void
position: number
total: number
userClickedOutside: boolean
}

type LinkDispatchPropsType = {
onboardingActions: typeof actions.components.onboarding
}

type Props = OwnPropsType & LinkDispatchPropsType

const Column = styled.div`
display: flex;
flex-direction: column;
`

const Header = styled.div`
display: flex;
align-items: center;
margin-bottom: 22px;
span {
margin-left: 8px;
}
`

const HeaderDesc = styled(Text)`
margin-bottom: 56px;
`

const Card = styled(Column)`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
margin-bottom: 40px;
padding: 40px;
box-sizing: border-box;
border: 1px solid ${({ theme }) => theme.grey100};
border-radius: 16px;
`

const Title = styled(Text)`
margin: 26px 0 13px;
`

const Content = styled(Text)`
margin-bottom: 24px;
width: 240px;
text-align: center;
`

class WelcomeContainer extends React.PureComponent<Props> {
state = { show: false }

componentDidMount () {
this.setState({ show: true }) //eslint-disable-line
}

handleSBClick = () => {
// replace this with opening the simple buy modal
this.props.close()
}

handleTourClick = () => {
const { takeWalletTourClicked } = this.props.onboardingActions
takeWalletTourClicked()
}

render () {
const { show } = this.state
const { ...rest } = this.props
return (
<Flyout
{...rest}
onClose={this.props.close}
in={show}
data-e2e='welcomeModal'
>
<FlyoutWrapper>
<Header>
<Image name='intro-hand' width='28px' height='28px' />
<Text color='grey800' size='20px' weight={600}>
<FormattedMessage
id='modals.wallet.tour.wallet.tour'
defaultMessage='Welcome to Blockchain!'
/>
</Text>
</Header>
<HeaderDesc weight={500}>
<FormattedMessage
id='modals.wallet.welcome.desc'
defaultMessage='Let’s get your wallet set up. You can quickly buy crypto now or do this later.'
/>
</HeaderDesc>
<Card>
<Icon color='blue600' name='cart-filled' size='32px' />
<Title lineHeight='30px' size='20px' weight={600}>
<FormattedMessage
id='modals.wallet.welcome.sb.title'
defaultMessage='Buy Crypto'
/>
</Title>
<Content lineHeight='24px' weight={500}>
<FormattedMessage
id='modals.wallet.welcome.sb.content'
defaultMessage='We can help you buy in just a few simple steps'
/>
</Content>
<Button
capitalize
data-e2e='toSimpleBuyModal'
fullwidth
height='48px'
nature='primary'
onClick={this.handleSBClick}
size='16px'
>
<FormattedMessage
id='modals.wallet.welcome.sb.button'
defaultMessage='Buy Crypto Now'
/>
</Button>
</Card>
<Card>
<Icon color='blue600' name='wallet-filled' size='32px' />
<Title lineHeight='30px' size='20px' weight={600}>
<FormattedMessage
id='modals.wallet.welcome.tour.title'
defaultMessage='Tour the Wallet'
/>
</Title>
<Content lineHeight='24px' weight={500}>
<FormattedMessage
id='modals.wallet.welcome.tour.content'
defaultMessage='Explore your new Blockchain Wallet.'
/>
</Content>
<Button
capitalize
data-e2e='toWalletTour'
fullwidth
height='48px'
nature='grey800'
onClick={this.handleTourClick}
size='16px'
>
<FormattedMessage
id='modals.wallet.welcome.tour.button'
defaultMessage='Get Started'
/>
</Button>
</Card>
</FlyoutWrapper>
</Flyout>
)
}
}

const mapDispatchToProps = dispatch => ({
onboardingActions: bindActionCreators(actions.components.onboarding, dispatch)
})

const enhance = compose<any>(
modalEnhancer('WELCOME_MODAL', { transition: duration }),
connect(
null,
mapDispatchToProps
)
)

export default enhance(WelcomeContainer)
2 changes: 2 additions & 0 deletions packages/blockchain-wallet-v4-frontend/src/modals/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import Faq from './Faq'
import Onfido from './Onfido'
import QRCode from './QRCode'
import SignMessage from './SignMessage'
import Welcome from './Welcome'
import WhatsNew from './WhatsNew'

const Modals = () => (
Expand Down Expand Up @@ -157,6 +158,7 @@ const Modals = () => (
<XlmReserveLearn />
<SunRiverWelcome disableOutsideClose />
<VerifyMessage />
<Welcome />
<WhatsNew />
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type SupportedCoinType = {
}
coinCode: string
coinTicker: string
colorCode: string
colorCode: 'btc' | 'bch' | 'eth' | 'xlm' | 'pax' | 'stx'
config: {
network: string
}
Expand Down

0 comments on commit a9f4804

Please sign in to comment.