Skip to content

Commit

Permalink
chore(swap): adding designs and actions for swap with no holdings
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroapfilho committed Feb 22, 2021
1 parent de39ffa commit bd2bc07
Show file tree
Hide file tree
Showing 7 changed files with 241 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// Update MessagesType w/ new messages
// en.json is updated ✨automatically ✨when releases are built

import { FormattedMessage } from 'react-intl'
import React from 'react'

type MessagesType = {
'bitpaycta.nowsupporting': 'Your {coin} wallet now supports'
'borrow.amount.tooltip.description': 'This amount does not include the required collateral network fee.'
Expand Down Expand Up @@ -368,6 +365,7 @@ type MessagesType = {
'copy.max': 'Max'
'copy.in_review': 'In Review'
'copy.min': 'Min'
'copy.most_popular': 'Most Popular'
'copy.negative_incoming_swap': 'Amount is below withdrawal fee.'
'copy.new': 'New'
'copy.new_swap': 'New Swap'
Expand Down Expand Up @@ -1371,7 +1369,6 @@ type MessagesType = {
'modals.simplebuy.interest_banner.title': 'Earn {interestRate}% on this {displayName} Purchase'
'modals.simplebuy.interest_banner.description': 'Send your {amount}{currency} to your {displayName} Interest Account.'
'modals.simplebuy.interest_banner.earn_now': 'Earn Now ->'
'modals.simplebuy.most_popular': 'Most Popular'
'modals.simplebuy.select_crypto': 'Easily buy and sell Crypto straight from your Wallet.'
'modals.simplebuy.selectcrypto.sell_banner_title': 'Want to sell from your other Wallets?'
'modals.simplebuy.selectcrypto.sell_banner_description': 'Send crypto from your Wallets to your <b>Trading Wallet</b>s. Once that send completes, sell that crypto for cash.'
Expand Down Expand Up @@ -2427,7 +2424,15 @@ type MessagesType = {
'swap.carousel.title.page4': 'You Control Your Key'
'swap.carousel.title.page5': 'Manage Risk Better'
'swap.getstarted.readytoswap.body': 'Complete your profile and start exchanging cryptocurrencies today.'
'swap.getstarted.readytoswap.title': 'Ready to Swap? '
'swap.getstarted.readytoswap.title': 'Ready to Swap?'
'swap.no_holdings.get_started': 'You’re all set to Swap but we don’t see any crypto in this Wallet. Below are 3 ways to get started.'
'swap.no_holdings.own_some_first': 'But you’ll need to own some first...'
'swap.no_holdings.buy_with_card.title': 'Buy with a Card'
'swap.no_holdings.buy_with_card.description': 'Instantly buy crypto with any Visa or Mastercard. You will need to verify your identiy to link a card'
'swap.no_holdings.buy_with_bank.title': 'Buy with a Bank Deposit'
'swap.no_holdings.buy_with_bank.description': 'Send cash directly from your bank. Once received, we’ll use use that balance to buy the crypto of your choice.'
'swap.no_holdings.receive_another_wallet.title': 'Receive from Another Wallet'
'swap.no_holdings.receive_another_wallet.description': 'Are you holding crypto on a different wallet? Does a friend want to send you some Bitcoin? Copy & paste or share your unique wallet addresses QR codes.'
'tooltip.comingsoon': 'Coming soon.'
'tooltip.copied': 'Copied!'
'tooltip.transaction.pending.eth': 'Your transaction is currently pending. You can attempt to resend it with a higher fee.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export type SBShowModalOriginType =
| 'TransactionList'
| 'WelcomeModal'
| 'WithdrawModal'
| 'SwapNoHoldings'

export enum SBCardStateEnum {
PENDING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export type ModalOriginType =
| 'SwapGetStarted'
| 'SwapPrompt'
| 'SwapLimitPrompt'
| 'SwapNoHoldings'
| 'TheExchangePage'
| 'TradingLimits'
| 'TransactionList'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const PaymentCard: React.FC<Props> = ({ value, onClick, icon, text }) => (
<CartridgeContainer>
<SuccessCartridge>
<FormattedMessage
id='modals.simplebuy.most_popular'
id='copy.most_popular'
defaultMessage='Most Popular'
/>
</SuccessCartridge>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import { SwapAccountType } from 'data/types'
import CryptoAccountOption from './CryptoAccountOption'

class CoinSelection extends PureComponent<Props> {
state = {}

componentDidMount () {
this.props.swapActions.fetchPairs()
this.props.swapActions.fetchCustodialEligibility()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
import { Props as BaseProps } from '../index'
import { Border, IconBackground, TopText } from '../components'
import { FormattedMessage } from 'react-intl'
import { Icon, Text } from 'blockchain-info-components'
import React from 'react'

import { bindActionCreators, compose } from 'redux'
import { connect, ConnectedProps } from 'react-redux'

import { actions } from 'data'
import { FlyoutWrapper } from 'components/Flyout'
import { SuccessCartridge } from 'components/Cartridge'
import styled, { css } from 'styled-components'

const FlexTopRow = styled.div`
display: flex;
justify-content: flex-start;
`

const CartridgeContainer = styled.div`
display: flex;
margin-top: 8px;
align-items: center;
`

const DisplayContainer = styled(FlyoutWrapper)`
display: flex;
width: 100%;
align-items: center;
box-sizing: border-box;
padding: 16px 40px;
flex-direction: row;
border-bottom: 1px solid ${props => props.theme.grey000};
transition: background-color 0.3s;
${props =>
props.onClick &&
css`
cursor: pointer;
* {
cursor: pointer;
}
&:hover {
background-color: ${props => props.theme.blue000};
}
`}
`

const NoHoldings: React.FC<Props> = ({
handleClose,
simpleBuyActions,
modalActions
}) => {
return (
<>
<FlyoutWrapper>
<TopText spaceBetween marginBottom>
<Icon name='arrow-switch-thick' color='blue600' size='24px' />
<Icon
name='close'
color='grey600'
role='button'
cursor
onClick={handleClose}
/>
</TopText>
<Text size='24px' color='grey900' weight={600}>
<FormattedMessage
id='copy.swap_your_crypto'
defaultMessage='Swap Your Crypto'
/>
</Text>
<Text
size='16px'
color='grey600'
weight={500}
style={{ marginTop: '10px' }}
>
<FormattedMessage
id='copy.instantly_exchange'
defaultMessage='Instantly exchange your crypto into any currency we offer in your wallet.'
/>
</Text>

<Text
size='16px'
color='grey800'
weight={600}
style={{ marginTop: '24px' }}
>
<FormattedMessage
id='swap.no_holdings.own_some_first'
defaultMessage='But you’ll need to own some first...'
/>
</Text>
<Text size='14px' color='grey500' weight={500}>
<FormattedMessage
id='swap.no_holdings.get_started'
defaultMessage='You’re all set to Swap but we don’t see any crypto in this Wallet. Below are 3 ways to get started.'
/>
</Text>
</FlyoutWrapper>

<Border />

<DisplayContainer
onClick={() => {
simpleBuyActions.showModal('SwapNoHoldings')
}}
>
<FlexTopRow>
<IconBackground size='32px' style={{ marginRight: '16px' }}>
<Icon size='16px' color='blue600' name='credit-card-sb' />
</IconBackground>
<div>
<Text color='grey900' size='14px' weight={600} lineHeight='150%'>
<FormattedMessage
id='swap.no_holdings.buy_with_card.title'
defaultMessage='Buy with a Card'
/>
</Text>
<Text size='12px' lineHeight='150%' weight={500}>
<FormattedMessage
id='swap.no_holdings.buy_with_card.description'
defaultMessage='Instantly buy crypto with any Visa or Mastercard. You will need to verify your identiy to link a card'
/>
</Text>
<CartridgeContainer>
<SuccessCartridge>
<FormattedMessage
id='copy.most_popular'
defaultMessage='Most Popular'
/>
</SuccessCartridge>
</CartridgeContainer>
</div>
</FlexTopRow>
</DisplayContainer>

<Border />

<DisplayContainer
onClick={() => {
simpleBuyActions.showModal('SwapNoHoldings')
}}
>
<FlexTopRow>
<IconBackground size='32px' style={{ marginRight: '16px' }}>
<Text color='blue600' size='20px' weight={600}>
<Icon size='16px' color='blue600' name='bank-filled' />
</Text>
</IconBackground>
<div>
<Text color='grey900' size='14px' weight={600} lineHeight='150%'>
<FormattedMessage
id='swap.no_holdings.buy_with_bank.title'
defaultMessage='Buy with a Bank Deposit'
/>
</Text>
<Text size='12px' lineHeight='150%' weight={500}>
<FormattedMessage
id='swap.no_holdings.buy_with_bank.description'
defaultMessage='Send cash directly from your bank. Once received, we’ll use use that balance to buy the crypto of your choice.'
/>
</Text>
</div>
</FlexTopRow>
</DisplayContainer>

<Border />

<DisplayContainer
onClick={() => {
modalActions.showModal('@MODAL.REQUEST.BTC', {
lockboxIndex: null,
origin: 'SwapNoHoldings'
})
}}
>
<FlexTopRow>
<IconBackground size='32px' style={{ marginRight: '16px' }}>
<Text color='blue600' size='20px' weight={600}>
<Icon size='16px' color='blue600' name='qr-code' />
</Text>
</IconBackground>
<div>
<Text color='grey900' size='14px' weight={600} lineHeight='150%'>
<FormattedMessage
id='swap.no_holdings.receive_another_wallet.title'
defaultMessage='Receive from Another Wallet'
/>
</Text>
<Text size='12px' lineHeight='150%' weight={500}>
<FormattedMessage
id='swap.no_holdings.receive_another_wallet.description'
defaultMessage='Are you holding crypto on a different wallet? Does a friend want to send you some Bitcoin? Copy & paste or share your unique wallet addresses QR codes.'
/>
</Text>
</div>
</FlexTopRow>
</DisplayContainer>
</>
)
}

const mapDispatchToProps = dispatch => ({
simpleBuyActions: bindActionCreators(actions.components.simpleBuy, dispatch),
modalActions: bindActionCreators(actions.modals, dispatch)
})

const connector = connect(undefined, mapDispatchToProps)

const enhance = compose(connector)

type OwnProps = BaseProps & { handleClose: () => void }

export type Props = OwnProps & ConnectedProps<typeof connector>

export default enhance(NoHoldings)
11 changes: 10 additions & 1 deletion packages/blockchain-wallet-v4-frontend/src/modals/Swap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import ModalEnhancer from 'providers/ModalEnhancer'
import CoinSelection from './CoinSelection'
import EnterAmount from './EnterAmount'
import InitSwapForm from './InitSwapForm'
import NoHoldings from './NoHoldings'
import OrderDetails from './OrderDetails'
import PreviewSwap from './PreviewSwap'
import SuccessfulSwap from './SuccessfulSwap'
Expand Down Expand Up @@ -77,7 +78,15 @@ class Swap extends PureComponent<Props, State> {
/>
</FlyoutChild>
)}
{this.props.step === 'NO_HOLDINGS' && <FlyoutChild>aaa</FlyoutChild>}
{this.props.step === 'NO_HOLDINGS' && (
<FlyoutChild>
<NoHoldings
{...this.props}
handleClose={this.handleClose}
{...val}
/>
</FlyoutChild>
)}
{this.props.step === 'ENTER_AMOUNT' && (
<FlyoutChild>
<EnterAmount
Expand Down

0 comments on commit bd2bc07

Please sign in to comment.