Skip to content

Commit

Permalink
fix(sell): say deposit instead of buy for fiat
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed Jul 25, 2020
1 parent 4309236 commit 83f369f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 18 deletions.
Expand Up @@ -2036,6 +2036,7 @@ type MessagesType = {
'scenes.swap.subheader': 'Exchange any cryptocurrency for another crypto.'
'scenes.swap.title': 'Swap'
'scenes.transaction.content.empty.buycoinnow': 'Buy {coin} Now'
'scenes.transaction.content.empty.depositnow': 'Deposit {coin} Now'
'scenes.transaction.content.empty.cointxs': 'All your {coinName} transactions will show up here.'
'scenes.transaction.content.empty.transactions': 'Transactions'
'scenes.transaction.headertext.explainer.algo': 'Algorand (ALGO) is a public blockchain based on a pure proof-of-stake consensus protocol.'
Expand Down
Expand Up @@ -10,26 +10,24 @@ import Welcome from './template'

class CoinIntroductionContainer extends React.PureComponent<Props> {
render () {
const { coin, modalActions, supportedCoins, simpleBuyActions } = this.props
const currentCoin = supportedCoins[coin]
const { coin, modalActions, supportedCoins } = this.props
return (
<Welcome
currentCoin={currentCoin}
handleRequest={() =>
modalActions.showModal(
`@MODAL.REQUEST.${currentCoin.coinCode}` as ModalNamesType,
`@MODAL.REQUEST.${supportedCoins[coin].coinCode}` as ModalNamesType,
{
origin: 'EmptyFeed'
}
)
}
handleBuy={() => simpleBuyActions.showModal('EmptyFeed', coin)}
{...this.props}
/>
)
}
}

const mapStateToProps = (state): LinkStatePropsType => ({
const mapStateToProps = state => ({
supportedCoins: selectors.core.walletOptions
.getSupportedCoins(state)
.getOrElse({} as SupportedWalletCurrenciesType)
Expand All @@ -49,9 +47,7 @@ const connector = connect(mapStateToProps, mapDispatchToProps)
type OwnProps = {
coin: CoinType
}
type LinkStatePropsType = {
supportedCoins: SupportedWalletCurrenciesType | Error
}
type Props = OwnProps & ConnectedProps<typeof connector>

export type Props = OwnProps & ConnectedProps<typeof connector>

export default connector(CoinIntroductionContainer)
Expand Up @@ -4,6 +4,9 @@ import media from 'services/ResponsiveService'
import React from 'react'
import styled from 'styled-components'

import { Props as OwnProps } from '.'
import { WalletFiatEnum, WalletFiatType } from 'core/types'

const Container = styled.div`
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -45,8 +48,8 @@ const BuyButton = styled(Button)`
}
`

const Welcome = props => {
const { currentCoin, handleBuy } = props
const Welcome = (props: OwnProps & { handleRequest: () => void }) => {
const currentCoin = props.supportedCoins[props.coin]

return (
<Container>
Expand Down Expand Up @@ -75,13 +78,32 @@ const Welcome = props => {
<BuyButton
data-e2e='buyCoinFromTxList'
nature='empty-blue'
onClick={handleBuy}
onClick={() => {
if (props.coin in WalletFiatEnum) {
props.simpleBuyActions.showModal('EmptyFeed')
props.simpleBuyActions.setStep({
step: 'TRANSFER_DETAILS',
displayBack: false,
fiatCurrency: props.coin as WalletFiatType
})
} else {
props.simpleBuyActions.showModal('EmptyFeed', props.coin)
}
}}
>
<FormattedMessage
id='scenes.transaction.content.empty.buycoinnow'
defaultMessage='Buy {coin} Now'
values={{ coin: currentCoin.displayName }}
/>
{props.coin in WalletFiatEnum ? (
<FormattedMessage
id='scenes.transaction.content.empty.depositnow'
defaultMessage='Deposit {coin} Now'
values={{ coin: currentCoin.displayName }}
/>
) : (
<FormattedMessage
id='scenes.transaction.content.empty.buycoinnow'
defaultMessage='Buy {coin} Now'
values={{ coin: currentCoin.displayName }}
/>
)}
</BuyButton>
</Column>
</Container>
Expand Down

0 comments on commit 83f369f

Please sign in to comment.