Skip to content

Commit

Permalink
feat(trading currency): reverted back changes for trading currency
Browse files Browse the repository at this point in the history
  • Loading branch information
milan-bc committed Dec 14, 2021
1 parent c8528c4 commit 45858cb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ class CryptoSelector extends React.Component<InjectedFormProps<{}, Props> & Prop
})
}

// in case of not directly supported fiat currency lend user to select trading currency from list
if (props.originalFiatCurrency) {
return props.buySellActions.setStep({
step: 'TRADING_CURRENCY_SELECTOR'
})
}

// default continue to enter amount step
return this.props.buySellActions.setStep({
cryptoCurrency: getCoinFromPair(pair.pair),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { equals } from 'ramda'
import { bindActionCreators, Dispatch } from 'redux'

import { Remote } from '@core'
import { ExtractSuccess } from '@core/types'
import { ExtractSuccess, WalletFiatEnum } from '@core/types'
import { FlyoutOopsError } from 'components/Flyout'
import { actions, selectors } from 'data'
import { RootState } from 'data/rootReducer'
Expand All @@ -18,7 +18,10 @@ class CryptoSelection extends React.Component<Props> {
if (this.props.fiatCurrency && !Remote.Success.is(this.props.data)) {
this.props.priceActions.fetchCoinPrices()
this.props.priceActions.fetchCoinPricesPreviousDay()
this.props.buySellActions.fetchPairs({ currency: this.props.fiatCurrency })
const currentCurrencyIsInSupportedFiat = this.props.fiatCurrency in WalletFiatEnum
// for other currencies use as pre fill USD
const currency = currentCurrencyIsInSupportedFiat ? this.props.fiatCurrency : 'USD'
this.props.buySellActions.fetchPairs({ currency })
this.props.buySellActions.fetchFiatEligible(this.props.fiatCurrency)
this.props.buySellActions.fetchSDDEligibility()
this.props.buySellActions.fetchBSOrders()
Expand Down Expand Up @@ -54,6 +57,7 @@ const mapStateToProps = (state: RootState) => ({
data: getData(state),
fiatCurrency: selectors.components.buySell.getFiatCurrency(state) || 'USD',
isFirstLogin: selectors.auth.getFirstLogin(state),
originalFiatCurrency: selectors.components.buySell.getOriginalFiatCurrency(state),
sddTransactionFinished: selectors.components.buySell.getSddTransactionFinished(state)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@ import { BuySellLimitReached } from 'components/Flyout'

import { Props as OwnProps, SuccessStateType } from '.'
import CryptoSelector from './CryptoSelector'
import Unsupported from './template.unsupported'

class Success extends React.Component<Props> {
shouldComponentUpdate = (nextProps) => !equals(this.props, nextProps)

render() {
const isUserEligible =
this.props.pairs.length && this.props.eligibility.eligible && this.props.fiatCurrency
const isUserSddEligible = this.props.sddEligible && this.props.sddEligible.eligible
const userHitMaxPendingDeposits =
this.props.eligibility.maxPendingDepositSimpleBuyTrades ===
this.props.eligibility.pendingDepositSimpleBuyTrades
if (isUserEligible || isUserSddEligible) {
return <CryptoSelector {...this.props} />
}

if (!isUserEligible && userHitMaxPendingDeposits) {
return (
<BuySellLimitReached
Expand All @@ -28,7 +24,8 @@ class Success extends React.Component<Props> {
/>
)
}
return <Unsupported {...this.props} />
// now we always return this list
return <CryptoSelector {...this.props} />
}
}

Expand Down

This file was deleted.

0 comments on commit 45858cb

Please sign in to comment.