remove unused reducer
This commit is contained in:
parent
aecf3ecd96
commit
c8a7991d77
5 changed files with 3 additions and 54 deletions
|
|
@ -2,17 +2,13 @@ import React from 'react';
|
|||
import { SideMenuitem } from 'UI';
|
||||
import { withRouter, RouteComponentProps } from 'react-router-dom';
|
||||
import { withSiteId, metrics, dashboard, alerts } from 'App/routes';
|
||||
import { connect } from 'react-redux';
|
||||
import { compose } from 'redux';
|
||||
import { setShowAlerts } from 'Duck/dashboard';
|
||||
|
||||
interface Props extends RouteComponentProps {
|
||||
siteId: string;
|
||||
history: any;
|
||||
setShowAlerts: (show: boolean) => void;
|
||||
}
|
||||
function DashboardSideMenu(props: Props) {
|
||||
const { history, siteId, setShowAlerts } = props;
|
||||
const { history, siteId } = props;
|
||||
const isMetric = history.location.pathname.includes('metrics');
|
||||
const isDashboards = history.location.pathname.includes('dashboard');
|
||||
const isAlerts = history.location.pathname.includes('alerts');
|
||||
|
|
@ -57,4 +53,4 @@ function DashboardSideMenu(props: Props) {
|
|||
);
|
||||
}
|
||||
|
||||
export default compose(withRouter, connect(null, { setShowAlerts }))(DashboardSideMenu);
|
||||
export default withRouter(DashboardSideMenu);
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
import { List, Map } from 'immutable';
|
||||
import { createRequestReducer } from './funcTools/request';
|
||||
import { mergeReducers, } from './funcTools/tools';
|
||||
import { RequestTypes } from 'Duck/requestStateCreator';
|
||||
|
||||
const SET_SHOW_ALERTS = 'dashboard/SET_SHOW_ALERTS';
|
||||
const FETCH_PERFORMANCE_SEARCH = 'dashboard/FETCH_PERFORMANCE_SEARCH';
|
||||
const ON_BOARD = new RequestTypes('plan/ON_BOARD');
|
||||
|
||||
const initialState = Map({
|
||||
showAlerts: false,
|
||||
boarding: undefined,
|
||||
boardingCompletion: undefined,
|
||||
});
|
||||
|
||||
const reducer = (state = initialState, action = {}) => {
|
||||
switch (action.type) {
|
||||
case SET_SHOW_ALERTS:
|
||||
return state.set('showAlerts', action.state);
|
||||
case ON_BOARD.SUCCESS:
|
||||
const tasks = List(action.data);
|
||||
const completion = tasks.filter(task => task.done).size * 100 / tasks.size;
|
||||
return state.set('boarding', tasks).set('boardingCompletion', Math.trunc(completion));
|
||||
}
|
||||
return state;
|
||||
};
|
||||
|
||||
export default mergeReducers(
|
||||
reducer,
|
||||
createRequestReducer({
|
||||
performanceSearchRequest: FETCH_PERFORMANCE_SEARCH,
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
export function setShowAlerts(state) {
|
||||
return {
|
||||
type: SET_SHOW_ALERTS,
|
||||
state,
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,6 @@ import CustomFilter, { KEYS } from 'Types/filter/customFilter';
|
|||
import withRequestState, { RequestTypes } from './requestStateCreator';
|
||||
import { fetchList as fetchSessionList } from './sessions';
|
||||
import { fetchList as fetchErrorsList } from './errors';
|
||||
import { editType } from './funcTools/crud/types';
|
||||
|
||||
const ERRORS_ROUTE = errorsRoute();
|
||||
|
||||
|
|
@ -16,7 +15,7 @@ const FETCH_FILTER_OPTIONS = new RequestTypes('filters/FETCH_FILTER_OPTIONS');
|
|||
const SET_FILTER_OPTIONS = 'filters/SET_FILTER_OPTIONS';
|
||||
const SAVE = new RequestTypes('filters/SAVE');
|
||||
const REMOVE = new RequestTypes('filters/REMOVE');
|
||||
const EDIT = editType('funnel/EDIT');
|
||||
const EDIT = 'funnel/EDIT'
|
||||
|
||||
const SET_SEARCH_QUERY = 'filters/SET_SEARCH_QUERY';
|
||||
const SET_ACTIVE = 'filters/SET_ACTIVE';
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import sessions from './sessions';
|
|||
import assignments from './assignments';
|
||||
import filters from './filters';
|
||||
import funnelFilters from './funnelFilters';
|
||||
import dashboard from './dashboard';
|
||||
import player from './components/player'
|
||||
import sources from './sources';
|
||||
import members from './member';
|
||||
|
|
@ -26,8 +25,6 @@ const rootReducer = combineReducers({
|
|||
assignments,
|
||||
filters,
|
||||
funnelFilters,
|
||||
|
||||
dashboard,
|
||||
player,
|
||||
members,
|
||||
site,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ interface Props {
|
|||
account: any;
|
||||
siteId: any;
|
||||
sites: any;
|
||||
boardingCompletion: any;
|
||||
spotOnly?: boolean;
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +54,6 @@ function mapStateToProps(state: any) {
|
|||
spotOnly: getScope(state) === 1,
|
||||
siteId: state.getIn(['site', 'siteId']),
|
||||
sites: state.getIn(['site', 'list']),
|
||||
boardingCompletion: state.getIn(['dashboard', 'boardingCompletion']),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue