From 83f369f5d528dd579ac5c586fc6cad5bd184a036 Mon Sep 17 00:00:00 2001 From: Philip London Date: Sat, 25 Jul 2020 15:29:37 +0200 Subject: [PATCH] fix(sell): say deposit instead of buy for fiat --- .../src/assets/locales/index.d.ts | 1 + .../Transactions/CoinIntroduction/index.tsx | 16 +++----- .../CoinIntroduction/template.tsx | 38 +++++++++++++++---- 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/packages/blockchain-wallet-v4-frontend/src/assets/locales/index.d.ts b/packages/blockchain-wallet-v4-frontend/src/assets/locales/index.d.ts index 7a9fd28cd00..979821100eb 100644 --- a/packages/blockchain-wallet-v4-frontend/src/assets/locales/index.d.ts +++ b/packages/blockchain-wallet-v4-frontend/src/assets/locales/index.d.ts @@ -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.' diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/CoinIntroduction/index.tsx b/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/CoinIntroduction/index.tsx index 8bfbd902301..fe1cc77db30 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/CoinIntroduction/index.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/CoinIntroduction/index.tsx @@ -10,26 +10,24 @@ import Welcome from './template' class CoinIntroductionContainer extends React.PureComponent { render () { - const { coin, modalActions, supportedCoins, simpleBuyActions } = this.props - const currentCoin = supportedCoins[coin] + const { coin, modalActions, supportedCoins } = this.props return ( 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) @@ -49,9 +47,7 @@ const connector = connect(mapStateToProps, mapDispatchToProps) type OwnProps = { coin: CoinType } -type LinkStatePropsType = { - supportedCoins: SupportedWalletCurrenciesType | Error -} -type Props = OwnProps & ConnectedProps + +export type Props = OwnProps & ConnectedProps export default connector(CoinIntroductionContainer) diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/CoinIntroduction/template.tsx b/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/CoinIntroduction/template.tsx index b6ae56db7d6..06ab448f87d 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/CoinIntroduction/template.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/CoinIntroduction/template.tsx @@ -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; @@ -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 ( @@ -75,13 +78,32 @@ const Welcome = props => { { + 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) + } + }} > - + {props.coin in WalletFiatEnum ? ( + + ) : ( + + )}