From c8a7991d77ccf7cc51157451fa7a810342e0201d Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Mon, 9 Sep 2024 14:28:11 +0200 Subject: [PATCH] remove unused reducer --- .../DashboardSideMenu/DashboardSideMenu.tsx | 8 +--- frontend/app/duck/dashboard.js | 41 ------------------- frontend/app/duck/filters.js | 3 +- frontend/app/duck/index.ts | 3 -- frontend/app/layout/TopRight.tsx | 2 - 5 files changed, 3 insertions(+), 54 deletions(-) delete mode 100644 frontend/app/duck/dashboard.js diff --git a/frontend/app/components/Dashboard/components/DashboardSideMenu/DashboardSideMenu.tsx b/frontend/app/components/Dashboard/components/DashboardSideMenu/DashboardSideMenu.tsx index d2451b68e..af8ecf16e 100644 --- a/frontend/app/components/Dashboard/components/DashboardSideMenu/DashboardSideMenu.tsx +++ b/frontend/app/components/Dashboard/components/DashboardSideMenu/DashboardSideMenu.tsx @@ -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); diff --git a/frontend/app/duck/dashboard.js b/frontend/app/duck/dashboard.js deleted file mode 100644 index 740766309..000000000 --- a/frontend/app/duck/dashboard.js +++ /dev/null @@ -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, - } -} diff --git a/frontend/app/duck/filters.js b/frontend/app/duck/filters.js index 544fcb93c..34b5f9db9 100644 --- a/frontend/app/duck/filters.js +++ b/frontend/app/duck/filters.js @@ -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'; diff --git a/frontend/app/duck/index.ts b/frontend/app/duck/index.ts index 3911c452a..7c9b15eb5 100644 --- a/frontend/app/duck/index.ts +++ b/frontend/app/duck/index.ts @@ -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, diff --git a/frontend/app/layout/TopRight.tsx b/frontend/app/layout/TopRight.tsx index 2a398eddc..9beab1bb5 100644 --- a/frontend/app/layout/TopRight.tsx +++ b/frontend/app/layout/TopRight.tsx @@ -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']), }; }