Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
218 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/blockchain-wallet-v4-frontend/src/data/components/ethTransactions/actionTypes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
export const ETH_TRANSACTIONS_INITIALIZED = '@EVENT.ETH_TRANSACTIONS_INITIALIZED' |
4 changes: 4 additions & 0 deletions
4
packages/blockchain-wallet-v4-frontend/src/data/components/ethTransactions/actions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
import * as AT from './actionTypes' | ||
|
||
export const initialized = () => ({ type: AT.ETH_TRANSACTIONS_INITIALIZED }) |
14 changes: 14 additions & 0 deletions
14
packages/blockchain-wallet-v4-frontend/src/data/components/ethTransactions/sagaRegister.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { takeEvery } from 'redux-saga/effects' | ||
import * as AT from './actionTypes' | ||
import * as actionTypes from '../../actionTypes' | ||
import sagas from './sagas' | ||
|
||
export default ({ coreSagas }) => { | ||
const ethTransactionsSagas = sagas({ coreSagas }) | ||
|
||
return function * () { | ||
yield takeEvery(AT.ETH_TRANSACTIONS_INITIALIZED, ethTransactionsSagas.initialized) | ||
yield takeEvery(actionTypes.form.CHANGE, ethTransactionsSagas.formChanged) | ||
yield takeEvery(actionTypes.scroll.UPDATE_SCROLL, ethTransactionsSagas.scrollUpdated) | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
packages/blockchain-wallet-v4-frontend/src/data/components/ethTransactions/sagas.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { select, put } from 'redux-saga/effects' | ||
import { equals, path, prop } from 'ramda' | ||
import { Remote } from 'blockchain-wallet-v4/src' | ||
import { actions, selectors } from 'data' | ||
|
||
export default ({ coreSagas }) => { | ||
const initialized = function * () { | ||
try { | ||
const initialValues = { | ||
status: '', | ||
search: '' | ||
} | ||
yield put(actions.form.initialize('ethTransactions', initialValues)) | ||
const ethTransactionsR = yield select(selectors.core.data.eth.getTransactions) | ||
if (!Remote.Success.is(ethTransactionsR)) yield put(actions.core.data.eth.fetchTransactions()) | ||
} catch (e) { | ||
console.log(e) | ||
} | ||
} | ||
|
||
const scrollUpdated = function * (action) { | ||
try { | ||
const threshold = 250 | ||
const { yMax, yOffset } = action.payload | ||
if (yMax - yOffset < threshold) { | ||
yield put(actions.core.data.eth.fetchTransactions(false)) | ||
} | ||
} catch (e) { | ||
console.log(e) | ||
} | ||
} | ||
|
||
const formChanged = function * (action) { | ||
try { | ||
const form = path(['meta', 'form'], action) | ||
const field = path(['meta', 'field'], action) | ||
if (!equals('ethTransactions', form)) return | ||
switch (field) { | ||
case 'source': | ||
yield put(actions.core.data.eth.fetchTransactions()) | ||
} | ||
} catch (e) { | ||
console.log(e) | ||
} | ||
} | ||
|
||
return { | ||
initialized, | ||
formChanged, | ||
scrollUpdated | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 0 additions & 38 deletions
38
...lockchain-wallet-v4-frontend/src/scenes/Transactions/Ether/Content/List/ListItem/index.js
This file was deleted.
Oops, something went wrong.
35 changes: 14 additions & 21 deletions
35
packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Ether/Content/List/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,20 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import styled from 'styled-components' | ||
|
||
import TransactionListItem from 'components/TransactionListItem' | ||
import Error from './template.error' | ||
import Loading from './template.loading' | ||
import Success from './template.success' | ||
|
||
const Wrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-start; | ||
align-items: flex-start; | ||
width: 100%; | ||
` | ||
class List extends React.PureComponent { | ||
render () { | ||
const { data } = this.props | ||
|
||
const TransactionList = (props) => { | ||
return ( | ||
<Wrapper> | ||
{ props.transactions.map((transaction, index) => <TransactionListItem key={index} transaction={transaction} coin='ETH' minConfirmations={12} />)} | ||
</Wrapper> | ||
) | ||
return data.cata({ | ||
Success: (value) => <Success transactions={value} />, | ||
Failure: (message) => <Error>{message}</Error>, | ||
Loading: () => <Loading />, | ||
NotAsked: () => <Loading /> | ||
}) | ||
} | ||
} | ||
|
||
TransactionList.propTypes = { | ||
transactions: PropTypes.array.isRequired | ||
} | ||
|
||
export default TransactionList | ||
export default List |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...ckchain-wallet-v4-frontend/src/scenes/Transactions/Ether/Content/List/template.success.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
import PropTypes from 'prop-types' | ||
|
||
import TransactionListItem from 'components/TransactionListItem' | ||
|
||
const Wrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-start; | ||
align-items: flex-start; | ||
width: 100%; | ||
` | ||
|
||
const Success = props => { | ||
return ( | ||
<Wrapper> | ||
{props.transactions.map((transaction, index) => <TransactionListItem key={index} transaction={transaction} coin='ETH' minConfirmations={12} />)} | ||
</Wrapper> | ||
) | ||
} | ||
|
||
Success.propTypes = { | ||
transactions: PropTypes.array.isRequired | ||
} | ||
|
||
export default Success |
39 changes: 9 additions & 30 deletions
39
packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/Ether/Content/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,28 @@ | ||
import React from 'react' | ||
import { connect } from 'react-redux' | ||
import { bindActionCreators } from 'redux' | ||
import { equals } from 'ramda' | ||
|
||
import { Remote } from 'blockchain-wallet-v4/src' | ||
import { getData } from './selectors' | ||
import { actions } from 'data' | ||
import { getContext, getData } from './selectors' | ||
import Error from './template.error' | ||
import Loading from './template.loading' | ||
import Success from './template.success' | ||
import Content from './template' | ||
|
||
class ContentContainer extends React.PureComponent { | ||
componentWillMount () { | ||
const { context, data } = this.props | ||
if (Remote.Success.is(context) && Remote.NotAsked.is(data)) { | ||
context.map(x => this.props.dataEthereumActions.fetchData(x)) | ||
} | ||
} | ||
|
||
componentWillReceiveProps (nextProps) { | ||
if (!equals(this.props.context, nextProps.context)) { | ||
nextProps.context.map(x => this.props.dataEthereumActions.fetchData(x)) | ||
} | ||
componentDidMount () { | ||
this.props.actions.initialized() | ||
} | ||
|
||
render () { | ||
const { data } = this.props | ||
|
||
return data.cata({ | ||
Success: (value) => <Success isEmpty={equals(value.total, 0)} search={value.search} transactions={value.transactions} />, | ||
Failure: (message) => <Error>{message}</Error>, | ||
Loading: () => <Loading />, | ||
NotAsked: () => <Loading /> | ||
}) | ||
const { empty, list, search } = this.props | ||
return <Content empty={empty} search={search} list={list} /> | ||
} | ||
} | ||
|
||
const mapStateToProps = (state) => ({ | ||
data: getData(state), | ||
context: getContext(state) | ||
const mapStateToProps = state => ({ | ||
...getData(state) | ||
}) | ||
|
||
const mapDispatchToProps = (dispatch) => ({ | ||
dataEthereumActions: bindActionCreators(actions.core.data.ethereum, dispatch), | ||
kvStoreEthereumActions: bindActionCreators(actions.core.kvStore.ethereum, dispatch) | ||
actions: bindActionCreators(actions.components.btcTransactions, dispatch) | ||
}) | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(ContentContainer) |
Oops, something went wrong.