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.
84 lines
2.0 KiB
84 lines
2.0 KiB
import { withRouter } from 'react-router'
|
|
import { connect } from 'react-redux'
|
|
|
|
import {
|
|
fetchChannels,
|
|
openChannel,
|
|
updateChannelSearchQuery,
|
|
setViewType,
|
|
|
|
channelsSelectors
|
|
} from 'reducers/channels'
|
|
|
|
import {
|
|
openChannelForm,
|
|
changeStep,
|
|
setNodeKey,
|
|
setLocalAmount,
|
|
setPushAmount,
|
|
closeChannelForm,
|
|
channelFormSelectors
|
|
} from 'reducers/channelform'
|
|
|
|
import { fetchPeers } from 'reducers/peers'
|
|
|
|
import { tickerSelectors } from 'reducers/ticker'
|
|
|
|
import Channels from '../components/Channels'
|
|
|
|
const mapDispatchToProps = {
|
|
fetchChannels,
|
|
openChannel,
|
|
updateChannelSearchQuery,
|
|
setViewType,
|
|
|
|
openChannelForm,
|
|
closeChannelForm,
|
|
setNodeKey,
|
|
setLocalAmount,
|
|
setPushAmount,
|
|
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),
|
|
stepTwoIsValid: channelFormSelectors.stepTwoIsValid(state)
|
|
})
|
|
|
|
const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
|
const channelFormProps = {
|
|
openChannel: dispatchProps.openChannel,
|
|
closeChannelForm: dispatchProps.closeChannelForm,
|
|
changeStep: dispatchProps.changeStep,
|
|
setNodeKey: dispatchProps.setNodeKey,
|
|
setLocalAmount: dispatchProps.setLocalAmount,
|
|
setPushAmount: dispatchProps.setPushAmount,
|
|
|
|
channelform: stateProps.channelform,
|
|
channelFormHeader: stateProps.channelFormHeader,
|
|
channelFormProgress: stateProps.channelFormProgress,
|
|
stepTwoIsValid: stateProps.stepTwoIsValid,
|
|
peers: stateProps.peers.peers
|
|
}
|
|
|
|
return {
|
|
...stateProps,
|
|
...dispatchProps,
|
|
...ownProps,
|
|
|
|
channelFormProps
|
|
}
|
|
}
|
|
|
|
export default withRouter(connect(mapStateToProps, mapDispatchToProps, mergeProps)(Channels))
|
|
|