Skip to content

Commit

Permalink
feat(Swap): tiers and limits rendering finished and tested
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-blockchain committed Dec 16, 2018
1 parent da246f5 commit 4e213e2
Show file tree
Hide file tree
Showing 14 changed files with 646 additions and 92 deletions.
2 changes: 2 additions & 0 deletions packages/blockchain-info-components/src/Images/Images.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import coinifyLogo from './img/coinify-logo.svg'
import emptySearch from './img/empty-search.svg'
import emptyTx from './img/empty-tx.svg'
import facebookWhite from './img/facebook-white.svg'
import failedKyc from './img/failed-kyc.png'
import googleAuthenticator from './img/google-authenticator.png'
import googlePlayBadge from './img/google-play-badge.png'
import halfBitcoin from './img/half-bitcoin.svg'
Expand Down Expand Up @@ -108,6 +109,7 @@ export default {
'empty-search': emptySearch,
'empty-tx': emptyTx,
'facebook-white': facebookWhite,
'failed-kyc': failedKyc,
'google-authenticator': googleAuthenticator,
'google-play-badge': googlePlayBadge,
'half-bitcoin': halfBitcoin,
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { complement, findLast, propEq } from 'ramda'
import PropTypes from 'prop-types'

export const USER_ACTIVATION_STATES = {
Expand Down Expand Up @@ -62,3 +63,15 @@ export const CountryPropType = PropTypes.shape({
regions: PropTypes.arrayOf(PropTypes.string),
scopes: PropTypes.arrayOf(PropTypes.string)
})

export const getLastAttemptedTier = findLast(
complement(propEq('state', TIERS_STATES.NONE))
)

export const getLastUnrejectedTier = findLast(
complement(propEq('state', TIERS_STATES.REJECTED))
)

export const getLastVerifiedTier = findLast(
propEq('state', TIERS_STATES.VERIFIED)
)
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,11 @@ describe('fetch user saga', () => {

describe('fetch tiers saga', () => {
it('should call fetchTiers api and update state', () => {
api.fetchTiers.mockReturnValueOnce(INITIAL_TIERS)
api.fetchTiers.mockReturnValueOnce({ tiers: INITIAL_TIERS })
return expectSaga(fetchTiers)
.put(A.fetchTiersLoading())
.call(api.fetchTiers)
.put(A.fetchTiersSuccess(INITIAL_TIERS.tiers))
.returns()
.put(A.fetchTiersSuccess(INITIAL_TIERS))
.run()
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ const LimitMessage = ({
</LimitText>
)

if (showPending)
return (
<LimitText color='btc'>
&nbsp;
<FormattedMessage
id='scenes.exchange.exchangeform.limit_info.in_review'
defaultMessage='In Review'
/>
</LimitText>
)

if (showLimit)
return (
<LimitText color='success'>
Expand All @@ -81,13 +70,24 @@ const LimitMessage = ({
</LimitText>
)

if (showPending)
return (
<LimitText color='btc'>
&nbsp;
<FormattedMessage
id='scenes.exchange.exchangeform.limit_info.in_review'
defaultMessage='In Review'
/>
</LimitText>
)

return null
}

export const LimitAction = ({
nextTier,
nextTierAvailable,
nextTierInReview,
lastTierInReview,
upgradeRequired,
upgradeTier
}) => {
Expand Down Expand Up @@ -116,7 +116,7 @@ export const LimitAction = ({
<TierIcon name='down-arrow-filled' color='brand-secondary' />
</TierLink>
)
if (nextTierInReview)
if (lastTierInReview)
return (
<LinkContainer to='/swap/profile'>
<TierLink>
Expand Down Expand Up @@ -150,7 +150,7 @@ export class LimitInfo extends React.PureComponent {
hideTier,
currencySymbol,
nextTierAvailable,
nextTierInReview,
lastTierInReview,
upgradeRequired
} = this.props

Expand Down Expand Up @@ -178,7 +178,7 @@ export class LimitInfo extends React.PureComponent {
<LimitAction
nextTier={nextTier}
nextTierAvailable={nextTierAvailable}
nextTierInReview={nextTierInReview}
lastTierInReview={lastTierInReview}
upgradeRequired={upgradeRequired}
upgradeTier={this.upgradeTier}
/>
Expand Down

0 comments on commit 4e213e2

Please sign in to comment.