Skip to content

Commit

Permalink
fix(Txs): empty state
Browse files Browse the repository at this point in the history
  • Loading branch information
plondon committed May 8, 2018
1 parent 8185414 commit aa7ba2e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Expand Up @@ -12,7 +12,8 @@ class ContentContainer extends React.PureComponent {
}

render () {
return <Content pages={this.props.pages} />
const { empty, pages, search } = this.props
return <Content empty={empty} search={search} pages={pages} />
}
}

Expand Down
@@ -1,6 +1,6 @@
import { createSelector } from 'reselect'
import { selectors } from 'data'
import { curry, isEmpty, propSatisfies, toUpper, prop, allPass, anyPass, compose, contains, map, filter } from 'ramda'
import { all, curry, isEmpty, propSatisfies, toUpper, prop, allPass, anyPass, compose, contains, map, filter } from 'ramda'

const filterTransactions = curry((status, criteria, transactions) => {
const isOfType = curry((filter, tx) => propSatisfies(x => filter === '' || toUpper(x) === toUpper(filter), 'type', tx))
Expand All @@ -16,14 +16,17 @@ export const getData = createSelector(
selectors.core.common.bch.getWalletTransactions
],
(formValues, pages) => {
const empty = (page) => isEmpty(page.data)
const search = prop('search', formValues) || ''
const status = prop('status', formValues) || ''
const filteredPages = !isEmpty(pages)
? pages.map(map(filterTransactions(status, search)))
: []

return {
pages: filteredPages
pages: filteredPages,
search: search.length > 0,
empty: all(empty)(filteredPages)
}
}
)
@@ -1,8 +1,5 @@
import React from 'react'
import styled from 'styled-components'
import { equals, isEmpty, length } from 'ramda'

import { Remote } from 'blockchain-wallet-v4/src'
import EmptyTx from 'components/EmptyTx'
import Empty from './Empty'
import Pages from './Pages'
Expand All @@ -16,11 +13,9 @@ const Wrapper = styled.div`
`

const Success = props => {
const hasNoTransactions = equals(length(props.pages), 1) && Remote.Success.is(props.pages[0]) && isEmpty(props.pages[0].getOrElse([]))

return (
<Wrapper>
{hasNoTransactions
{props.empty
? props.search ? <EmptyTx /> : <Empty />
: props.pages.map((value, index) => <Pages key={index} data={value} />)
}
Expand Down

0 comments on commit aa7ba2e

Please sign in to comment.