Skip to content

Commit

Permalink
feat: small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
milan-bc committed Jul 16, 2020
1 parent 57baff7 commit b02d382
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 30 deletions.
Expand Up @@ -107,22 +107,14 @@ class Payments extends PureComponent<InjectedFormProps<{}, Props> & Props> {
text: this.getType(value),
value
}))
// TODO: remove when adding FUNDS type
const defaultMethodsNoFunds = defaultMethods.filter(
method => method.value.type !== 'FUNDS'
)

const itemsss = {
group: '',
items: [...cardMethods, ...defaultMethodsNoFunds]
}
// eslint-disable-next-line
console.log('itemsss', itemsss)
console.log('cardMethods', cardMethods)

// eslint-disable-next-line
console.log('availableCards', availableCards)
// eslint-disable-next-line
console.log('defaultMethodsNoFunds', defaultMethodsNoFunds)
console.log('defaultMethodsNoFunds', defaultMethods)

// return [
// {
Expand Down
@@ -1,24 +1,19 @@
import { actions, selectors } from 'data'
import { bindActionCreators, Dispatch } from 'redux'
import { connect, ConnectedProps } from 'react-redux'
import {
FiatEligibleType,
FiatType,
RemoteDataType,
SBCardType,
SBPairType,
SBPaymentMethodsType
} from 'core/types'
import { FiatType, RemoteDataType, SBPairType } from 'core/types'
import { getData } from './selectors'
import { RootState } from 'data/rootReducer'
import Failure from './template.failure'
import Loading from './template.loading'
import React, { PureComponent } from 'react'
import Success from './template.success'

class EnterAmount extends PureComponent<Props> {
class PaymentMethods extends PureComponent<Props> {
componentDidMount () {
if (this.props.fiatCurrency) {
this.props.simpleBuyActions.fetchSBPairs(this.props.fiatCurrency)
this.props.simpleBuyActions.fetchSBFiatEligible(this.props.fiatCurrency)
this.props.simpleBuyActions.fetchSBPaymentMethods(this.props.fiatCurrency)
this.props.simpleBuyActions.fetchSBCards()
}
Expand Down Expand Up @@ -51,16 +46,14 @@ export type OwnProps = {
handleClose: () => void
pair: SBPairType
}
export type SuccessStateType = {
cards: Array<SBCardType>
eligibility: FiatEligibleType
paymentMethods: SBPaymentMethodsType
}

export type SuccessStateType = ReturnType<typeof getData>['data']

export type LinkStatePropsType = {
data: RemoteDataType<string, SuccessStateType>
fiatCurrency: undefined | FiatType
}
export type LinkDispatchPropsType = ReturnType<typeof mapDispatchToProps>
export type Props = OwnProps & ConnectedProps<typeof connector>

export default connector(EnterAmount)
export default connector(PaymentMethods)
@@ -1,3 +1,4 @@
import { ExtractSuccess } from 'core/types'
import { lift } from 'ramda'
import { selectors } from 'data'

Expand All @@ -8,9 +9,15 @@ export const getData = state => {
state
)

return lift((cards, eligibility, paymentMethods) => ({
cards,
eligibility,
paymentMethods
}))(cardsR, eligibilityR, paymentMethodsR)
return lift(
(
cards: ExtractSuccess<typeof cardsR>,
eligibility: ExtractSuccess<typeof eligibilityR>,
paymentMethods: ExtractSuccess<typeof paymentMethodsR>
) => ({
cards,
eligibility,
paymentMethods
})
)(cardsR, eligibilityR, paymentMethodsR)
}

0 comments on commit b02d382

Please sign in to comment.