Skip to content

Commit

Permalink
feat(sb): show back button
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed Jul 24, 2020
1 parent 71052d7 commit 5a6fcf0
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 18 deletions.
Expand Up @@ -434,7 +434,6 @@ const getPayloadObjectForStep = (payload: StepActionsPayload) => {
return {
step: payload.step,
fiatCurrency: payload.fiatCurrency,
pair: payload.pair,
displayBack: payload.displayBack
}
case 'CHECKOUT_CONFIRM':
Expand Down
Expand Up @@ -8,7 +8,7 @@ const INITIAL_STATE: SimpleBuyState = {
card: Remote.NotAsked,
cardId: undefined,
cards: Remote.NotAsked,
displayBack: undefined,
displayBack: false,
cryptoCurrency: undefined,
everypay3DS: Remote.NotAsked,
fiatCurrency: undefined,
Expand Down Expand Up @@ -244,25 +244,22 @@ export function simpleBuyReducer (
step: action.payload.step,
pair: action.payload.pair,
method: action.payload.method,
order: undefined,
displayBack: undefined
order: undefined
}
case 'CRYPTO_SELECTION':
return {
...state,
cryptoCurrency: action.payload.cryptoCurrency,
fiatCurrency: action.payload.fiatCurrency,
step: action.payload.step,
order: undefined
step: action.payload.step
}
case 'PAYMENT_METHODS':
return {
...state,
cryptoCurrency: action.payload.cryptoCurrency,
fiatCurrency: action.payload.fiatCurrency,
step: action.payload.step,
order: action.payload.order,
displayBack: undefined
order: action.payload.order
}
case '3DS_HANDLER':
case 'CHECKOUT_CONFIRM':
Expand All @@ -278,14 +275,12 @@ export function simpleBuyReducer (
...state,
step: action.payload.step,
fiatCurrency: action.payload.fiatCurrency,
pair: action.payload.pair,
displayBack: action.payload.displayBack
}
default: {
return {
...state,
step: action.payload.step,
displayBack: undefined
step: action.payload.step
}
}
}
Expand Down
Expand Up @@ -71,7 +71,7 @@ export type SimpleBuyState = {
cardId: undefined | string
cards: RemoteDataType<string, Array<SBCardType>>
cryptoCurrency: undefined | CoinType
displayBack: undefined | boolean
displayBack: boolean
everypay3DS: RemoteDataType<string, Everypay3DSResponseType>
fiatCurrency: undefined | FiatType
fiatEligible: RemoteDataType<string, FiatEligibleType>
Expand Down Expand Up @@ -303,9 +303,8 @@ export type StepActionsPayload =
step: 'CRYPTO_SELECTION'
}
| {
displayBack?: boolean
displayBack: boolean
fiatCurrency: FiatType
pair: SBPairType
step: 'TRANSFER_DETAILS'
}
| {
Expand Down
Expand Up @@ -21,6 +21,7 @@ class EnterAmount extends PureComponent<Props> {
if (this.props.fiatCurrency && !this.props.method) {
this.props.simpleBuyActions.fetchSBPaymentMethods(this.props.fiatCurrency)
this.props.simpleBuyActions.fetchSBOrders()
this.props.simpleBuyActions.fetchSBCards()
}
}

Expand Down
Expand Up @@ -228,7 +228,6 @@ class Payments extends PureComponent<InjectedFormProps<{}, Props> & Props> {
this.props.simpleBuyActions.setStep({
step: 'TRANSFER_DETAILS',
fiatCurrency,
pair: this.props.pair,
displayBack: true
})
}
Expand Down
@@ -1,16 +1,17 @@
import { actions, model } from 'data'
import { bindActionCreators, compose, Dispatch } from 'redux'
import { Button, Icon, Text } from 'blockchain-info-components'
import {
CoinType,
CoinTypeEnum,
FiatType,
FiatTypeEnum,
SupportedCoinType
SupportedCoinType,
WalletFiatType
} from 'core/types'
import { connect, ConnectedProps } from 'react-redux'
import { getData } from './selectors'
import { getHeaderExplainer } from './template.headerexplainer'
import { Icon, Text } from 'blockchain-info-components'
import { path, toLower } from 'ramda'
import { reduxForm } from 'redux-form'
import { SceneWrapper } from 'components/Layout'
Expand Down Expand Up @@ -123,6 +124,22 @@ class TransactionsContainer extends React.PureComponent<Props> {
<Text color='grey800' size='32px' weight={600}>
{displayName}
</Text>
{coin in FiatTypeEnum && (
<Button
data-e2e='depositFiat'
onClick={() => {
if (!this.props.simpleBuyActions) return
this.props.simpleBuyActions.showModal('EmptyFeed')
this.props.simpleBuyActions.setStep({
step: 'TRANSFER_DETAILS',
displayBack: false,
fiatCurrency: coin as WalletFiatType
})
}}
>
Deposit
</Button>
)}
</PageTitle>
<ExplainerWrapper>{getHeaderExplainer(coinModel)}</ExplainerWrapper>
<StatsContainer>
Expand Down Expand Up @@ -194,7 +211,11 @@ const mapDispatchToProps = (dispatch: Dispatch, ownProps) => {
dispatch(actions.components.fiatTransactions.loadMore(coin)),
initTxs: () =>
dispatch(actions.components.fiatTransactions.initialized(coin)),
miscActions: bindActionCreators(actions.core.data.misc, dispatch)
miscActions: bindActionCreators(actions.core.data.misc, dispatch),
simpleBuyActions: bindActionCreators(
actions.components.simpleBuy,
dispatch
)
}
}
return {
Expand Down

0 comments on commit 5a6fcf0

Please sign in to comment.