You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.6 KiB

import { withRouter } from 'react-router'
import { connect } from 'react-redux'
import {
fetchChannels,
channelsSelectors
} from 'reducers/channels'
import {
openChannelForm,
changeStep,
setNodeKey,
setLocalAmount,
closeChannelForm,
channelFormSelectors
} from 'reducers/channelform'
import { fetchPeers } from 'reducers/peers'
import { tickerSelectors } from 'reducers/ticker'
import Channels from '../components/Channels'
const mapDispatchToProps = {
fetchChannels,
openChannelForm,
closeChannelForm,
setNodeKey,
setLocalAmount,
changeStep,
fetchPeers
}
const mapStateToProps = state => ({
channels: state.channels,
channelform: state.channelform,
peers: state.peers,
ticker: state.ticker,
allChannels: channelsSelectors.allChannels(state),
currentTicker: tickerSelectors.currentTicker(state),
channelFormHeader: channelFormSelectors.channelFormHeader(state),
channelFormProgress: channelFormSelectors.channelFormProgress(state)
})
const mergeProps = (stateProps, dispatchProps, ownProps) => {
const channelFormProps = {
closeChannelForm: dispatchProps.closeChannelForm,
changeStep: dispatchProps.changeStep,
setNodeKey: dispatchProps.setNodeKey,
setLocalAmount: dispatchProps.setLocalAmount,
channelform: stateProps.channelform,
channelFormHeader: stateProps.channelFormHeader,
channelFormProgress: stateProps.channelFormProgress,
peers: stateProps.peers.peers
}
return {
...stateProps,
...dispatchProps,
...ownProps,
channelFormProps
}
}
export default withRouter(connect(mapStateToProps, mapDispatchToProps, mergeProps)(Channels))