From aa7ba2e3906a7c518f979971c947b05540173db8 Mon Sep 17 00:00:00 2001 From: plondon Date: Tue, 8 May 2018 13:26:54 -0400 Subject: [PATCH] fix(Txs): empty state --- .../src/scenes/Transactions/Bch/Content/index.js | 3 ++- .../src/scenes/Transactions/Bch/Content/selectors.js | 7 +++++-- .../src/scenes/Transactions/Bch/Content/template.js | 7 +------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Bch/Content/index.js b/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Bch/Content/index.js index 5520e637540..072e00c6d95 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Bch/Content/index.js +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Bch/Content/index.js @@ -12,7 +12,8 @@ class ContentContainer extends React.PureComponent { } render () { - return + const { empty, pages, search } = this.props + return } } diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Bch/Content/selectors.js b/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Bch/Content/selectors.js index 4c909ca61e5..58735a6f495 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Bch/Content/selectors.js +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Bch/Content/selectors.js @@ -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)) @@ -16,6 +16,7 @@ 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) @@ -23,7 +24,9 @@ export const getData = createSelector( : [] return { - pages: filteredPages + pages: filteredPages, + search: search.length > 0, + empty: all(empty)(filteredPages) } } ) diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Bch/Content/template.js b/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Bch/Content/template.js index 00f9e0ca7e4..4b460915023 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Bch/Content/template.js +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Bch/Content/template.js @@ -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' @@ -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 ( - {hasNoTransactions + {props.empty ? props.search ? : : props.pages.map((value, index) => ) }