Browse Source

fix(channel graph bug)

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
a632eab4d1
  1. 10
      app/reducers/channels.js
  2. 9
      app/routes/channels/components/Channels.js
  3. 1
      app/routes/channels/containers/ChannelsContainer.js

10
app/reducers/channels.js

@ -27,7 +27,7 @@ export const UPDATE_SEARCH_QUERY = 'UPDATE_SEARCH_QUERY'
export const SET_VIEW_TYPE = 'SET_VIEW_TYPE'
export const TOGGLE_PULLDOWN = 'TOGGLE_PULLDOWN'
export const TOGGLE_CHANNEL_PULLDOWN = 'TOGGLE_CHANNEL_PULLDOWN'
export const CHANGE_CHANNEL_FILTER = 'CHANGE_CHANNEL_FILTER'
// ------------------------------------
@ -223,7 +223,7 @@ export const channelGraphStatus = (event, data) => (dispatch) => {
export function toggleFilterPulldown() {
return {
type: TOGGLE_PULLDOWN
type: TOGGLE_CHANNEL_PULLDOWN
}
}
@ -258,7 +258,7 @@ const ACTION_HANDLERS = {
[SET_VIEW_TYPE]: (state, { viewType }) => ({ ...state, viewType }),
[TOGGLE_PULLDOWN]: state => ({ ...state, filterPulldown: !state.filterPulldown }),
[TOGGLE_CHANNEL_PULLDOWN]: state => ({ ...state, filterPulldown: !state.filterPulldown }),
[CHANGE_CHANNEL_FILTER]: (state, { filter }) => ({ ...state, filterPulldown: false, filter })
}
@ -277,7 +277,7 @@ channelsSelectors.channelModalOpen = createSelector(
channel => (!!channel)
)
const activeChannels = createSelector(
channelsSelectors.activeChannels = createSelector(
channelsSelector,
openChannels => openChannels.filter(channel => channel.active)
)
@ -318,7 +318,7 @@ channelsSelectors.nonActiveFilters = createSelector(
export const currentChannels = createSelector(
allChannels,
activeChannels,
channelsSelectors.activeChannels,
channelsSelector,
pendingOpenChannelsSelector,
closingPendingChannels,

9
app/routes/channels/components/Channels.js

@ -36,6 +36,7 @@ class Channels extends Component {
toggleFilterPulldown,
changeFilter,
activeChannels,
currentChannels,
openChannels,
updateChannelSearchQuery,
@ -67,6 +68,12 @@ class Channels extends Component {
icon.style.animation = 'spin 1000ms linear 1'
}
const networkClicked = () => {
if (!activeChannels.length) { return }
setViewType(1)
}
return (
<div className={`${styles.container} ${viewType === 1 && styles.graphview}`}>
<ChannelForm {...channelFormProps} />
@ -89,7 +96,7 @@ class Channels extends Component {
<span className={viewType === 0 && styles.active} onClick={() => setViewType(0)}>
<FaAlignJustify />
</span>
<span className={viewType === 1 && styles.active} onClick={() => setViewType(1)}>
<span className={viewType === 1 && styles.active} onClick={networkClicked}>
<FaGlobe />
</span>
</div>

1
app/routes/channels/containers/ChannelsContainer.js

@ -67,6 +67,7 @@ const mapStateToProps = state => ({
currentChannels: currentChannels(state),
activeChanIds: channelsSelectors.activeChanIds(state),
nonActiveFilters: channelsSelectors.nonActiveFilters(state),
activeChannels: channelsSelectors.activeChannels(state),
currentTicker: tickerSelectors.currentTicker(state),

Loading…
Cancel
Save