-
Notifications
You must be signed in to change notification settings - Fork 503
/
index.js
55 lines (48 loc) · 1.67 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { actions } from 'data'
import TransactionListItem from './template.js'
class ListItemContainer extends React.PureComponent {
constructor (props) {
super(props)
this.handleCoinToggle = this.handleCoinToggle.bind(this)
this.handleEditDescription = this.handleEditDescription.bind(this)
}
handleCoinToggle () {
this.props.preferencesActions.toggleCoinDisplayed()
}
handleEditDescription (value) {
switch (this.props.coin) {
case 'ETH': {
this.props.ethereumActions.setTxNotesEthereum(this.props.transaction.hash, value)
break
}
case 'BTC': {
this.props.walletActions.setTransactionNote(this.props.transaction.hash, value)
break
}
case 'BCH': {
this.props.bchActions.setTxNotesBch(this.props.transaction.hash, value)
break
}
}
}
render () {
return <TransactionListItem
coin={this.props.coin}
minConfirmations={this.props.minConfirmations}
transaction={this.props.transaction}
handleCoinToggle={this.handleCoinToggle}
handleEditDescription={this.handleEditDescription}
shiftTrades={this.props.shiftTrades}
/>
}
}
const mapDispatchToProps = (dispatch) => ({
preferencesActions: bindActionCreators(actions.preferences, dispatch),
walletActions: bindActionCreators(actions.core.wallet, dispatch),
ethereumActions: bindActionCreators(actions.core.kvStore.ethereum, dispatch),
bchActions: bindActionCreators(actions.core.kvStore.bch, dispatch)
})
export default connect(undefined, mapDispatchToProps)(ListItemContainer)