Skip to content

Commit

Permalink
feat(sell): empty state if no accounts have balance
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLeoB committed Dec 7, 2020
1 parent 3af479e commit 84ef4a6
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ type MessagesType = {
'copy.confirm_withdrawal': 'Confirm Withdrawal'
'copy.confirm_swap': 'Confirm Swap'
'copy.complete': 'Complete'
'copy.crypto_selection_empty.buybank': "Send cash directly from your bank. Once received, we'll use that balance to buy the crypto of your choice"
'copy.crypto_selection_empty.buybanktitle': 'Buy with a Bank Deposit'
'copy.crypto_selection_empty.buycard': 'Link any Visa or Mastercard and buy crypto. You will need to verify your identity to link a card.'
'copy.crypto_selection_empty.buycardtitle': 'Buy with a Card'
'copy.crypto_selection_empty.getstarted': "You're all set to Sell, but we don't see any crypto in this Wallet. Below are 3 ways to get started."
'copy.crypto_selection_empty.needtoown': "You'll need to own crypto first..."
'copy.crypto_selection_empty.receive': 'Are you holding crypto on a different wallet? Does a friend want to send you some Bitcoin? Copy and paste or share your unique wallet addresses QR codes.'
'copy.crypto_selection_empty.receivetitle': 'Receive from Another Wallet'
'copy.date': 'Date'
'copy.error.locked_withdraw_error': 'Your crypto will be available to be withdrawn within {days} days.'
'copy.failed': 'Failed'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export type SBShowModalOriginType =
| 'PendingOrder'
| 'PriceChart'
| 'InterestPage'
| 'SellEmpty'
| 'SettingsGeneral'
| 'SettingsProfile'
| 'SideNav'
Expand Down Expand Up @@ -336,8 +337,8 @@ export type StepActionsPayload =
}
| {
cryptoCurrency?: CoinType
fiatCurrency: FiatType,
orderType?: SBOrderActionType,
fiatCurrency: FiatType
orderType?: SBOrderActionType
step: 'CRYPTO_SELECTION'
}
| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export type ModalOriginType =
| 'RunKycGoal'
| 'SBEnterAmountCheckout'
| 'SBPaymentMethodSelection'
| 'SellEmpty'
| 'Send'
| 'SendBch'
| 'SendBtc'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import { actions } from 'data'

import { bindActionCreators } from 'redux'
import { Button, Icon, Text } from 'blockchain-info-components'
import { connect, ConnectedProps } from 'react-redux'
import { FormattedMessage } from 'react-intl'
import React from 'react'
import styled from 'styled-components'

import { FlyoutWrapper } from 'components/Flyout'

export const IconBackground = styled.div`
margin-right: 16px;
display: flex;
justify-content: center;
align-items: center;
width: 32px;
height: 32px;
min-width: 32px;
background-color: ${props => props.theme.blue000};
border-radius: 40px;
`

export const FlexStartRow = styled.div`
display: flex;
align-items: center;
justify-content: flex-start;
`

const SellEmptyState: React.FC<Props> = props => {
return (
<>
<FlyoutWrapper>
<Text
size='20px'
color='grey800'
weight={600}
style={{ marginBottom: '8px' }}
>
<FormattedMessage
id='copy.crypto_selection_empty.needtoown'
defaultMessage="You'll need to own crypto first..."
/>
</Text>
<Text
size='14px'
color='grey600'
weight={500}
style={{ marginBottom: '30px' }}
>
<FormattedMessage
id='copy.crypto_selection_empty.getstarted'
defaultMessage="You're all set to Sell, but we don't see any crypto in this Wallet. Below are 3 ways to get started."
/>
</Text>
<FlexStartRow style={{ marginBottom: '28px' }}>
<IconBackground>
<Icon size='16px' color='blue600' name='credit-card-sb' />
</IconBackground>
<div>
<Text color='grey900' size='14px' weight={600} lineHeight='150%'>
<FormattedMessage
id='copy.crypto_selection_empty.buycardtitle'
defaultMessage='Buy with a Card'
/>
</Text>
<Text size='12px' lineHeight='150%' weight={500}>
<FormattedMessage
id='copy.crypto_selection_empty.buycard'
defaultMessage='Link any Visa or Mastercard and buy crypto. You will need to verify your identity to link a card.'
/>
</Text>
</div>
</FlexStartRow>
<FlexStartRow style={{ marginBottom: '28px' }}>
<IconBackground>
<Icon name='bank-filled' color='blue600' size='20px' />
</IconBackground>
<div>
<Text color='grey900' size='14px' weight={600} lineHeight='150%'>
<FormattedMessage
id='copy.crypto_selection_empty.buybanktitle'
defaultMessage='Buy with a Bank Deposit'
/>
</Text>
<Text size='12px' lineHeight='150%' weight={500}>
<FormattedMessage
id='copy.crypto_selection_empty.buybank'
defaultMessage="Send cash directly from your bank. Once received, we'll use that balance to buy the crypto of your choice"
/>
</Text>
</div>
</FlexStartRow>
<FlexStartRow style={{ marginBottom: '62px' }}>
<IconBackground>
<Icon name='send' color='blue600' size='20px' />
</IconBackground>
<div>
<Text color='grey900' size='14px' weight={600} lineHeight='150%'>
<FormattedMessage
id='copy.crypto_selection_empty.receivetitle'
defaultMessage='Receive from Another Wallet'
/>
</Text>
<Text size='12px' lineHeight='150%' weight={500}>
<FormattedMessage
id='copy.crypto_selection_empty.receive'
defaultMessage='Are you holding crypto on a different wallet? Does a friend want to send you some Bitcoin? Copy and paste or share your unique wallet addresses QR codes.'
/>
</Text>
</div>
</FlexStartRow>
<Button
nature='primary'
data-e2e='sellEmptyBuyCta'
height='48px'
onClick={() =>
props.simpleBuyActions.showModal('SellEmpty', 'BTC', 'BUY')
}
fullwidth
>
<FormattedMessage
id='modals.wallet.welcome.sb.button'
defaultMessage='Buy Crypto Now'
/>
</Button>
</FlyoutWrapper>
</>
)
}

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

const connector = connect(null, mapDispatchToProps)

type Props = ConnectedProps<typeof connector> & { handleClose: () => void }

export default connector(SellEmptyState)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { SBPairType } from 'core/types'
import { SwapAccountType } from 'data/types'
import CryptoAccountOption from 'blockchain-wallet-v4-frontend/src/modals/Swap/CoinSelection/CryptoAccountOption'
import CryptoItem from './CryptoItem'
// import SellEmptyState from './SellEmptyState'

const Wrapper = styled.div`
display: flex;
Expand Down Expand Up @@ -159,6 +160,10 @@ const CryptoSelector: React.FC<InjectedFormProps<{}, Props> &
/>
)
)
// this should only show once if account.balance is 0 for all accounts
// if I make this a ternary, this SellEmpty component will show
// for every coin in coinOrder.map
// <SellEmptyState handleClose={props.handleClose} />
})
: props.pairs.map((value, index) => (
<CryptoItem
Expand Down

0 comments on commit 84ef4a6

Please sign in to comment.