From 4fd1c6724b8b5b47a74be35cb9e341432ed32110 Mon Sep 17 00:00:00 2001 From: Alexander Polynomdivision Date: Thu, 18 Oct 2018 17:33:23 +0200 Subject: [PATCH] refactor: Remove lookedAt --- frontend/src/actions/index.ts | 8 -------- frontend/src/containers/LevelPage.ts | 4 +--- frontend/src/pages/level.tsx | 3 --- frontend/src/reducers/index.ts | 8 -------- 4 files changed, 1 insertion(+), 22 deletions(-) diff --git a/frontend/src/actions/index.ts b/frontend/src/actions/index.ts index dd35123..48566e8 100644 --- a/frontend/src/actions/index.ts +++ b/frontend/src/actions/index.ts @@ -53,14 +53,6 @@ export function setUser(user: IUser) { }; } -export const LEVEL_SET_LOOKEDAT = "LEVEL_SET_LOOKEDAT"; -export function setLevelLookedAt(ids: number[]) { - return { - type: LEVEL_SET_LOOKEDAT, - lookedAt: ids, - }; -}; - export const LEVEL_SET_CUR_VOCAB = "LEVEL_SET_CUR_VOCAB"; export function setLevelCurrentVocab(vocab: IVocab) { return { diff --git a/frontend/src/containers/LevelPage.ts b/frontend/src/containers/LevelPage.ts index cd8efa0..39f015c 100644 --- a/frontend/src/containers/LevelPage.ts +++ b/frontend/src/containers/LevelPage.ts @@ -11,13 +11,12 @@ import LevelPage from "../pages/level"; const mapStateToProps = state => { const { - currentVocab, lookedAt, vocab, loading, stepper, + currentVocab, vocab, loading, stepper, reviewDialog, leaveDialog } = state.level; return { currentVocab, - lookedAt, vocab, loading, stepperIndex: stepper, @@ -29,7 +28,6 @@ const mapStateToProps = state => { const mapDispatchToProps = dispatch => { return { drawerButtonState: (state: boolean) => dispatch(setDrawerButton(state)), - setLookedAt: (ids: number[]) => dispatch(setLevelLookedAt(ids)), setCurrentVocab: (vocab: IVocab) => dispatch(setLevelCurrentVocab(vocab)), setVocab: (vocab: IVocab[]) => dispatch(setLevelVocab(vocab)), setLoading: (state: boolean) => dispatch(setLevelLoading(state)), diff --git a/frontend/src/pages/level.tsx b/frontend/src/pages/level.tsx index ac3b4c8..cfbf9e5 100644 --- a/frontend/src/pages/level.tsx +++ b/frontend/src/pages/level.tsx @@ -35,12 +35,10 @@ interface IProps { stepperIndex: number; loading: boolean; vocab: IVocab[]; - lookedAt: number[]; currentVocab: IVocab; leaveDialog: boolean; reviewDialog: boolean; setVocab: (vocab: IVocab[]) => void; - setLookedAt: (ids: number[]) => void; setCurrentVocab: (vocab: IVocab) => void; drawerButtonState: (state: boolean) => void; setLoading: (state: boolean) => void; @@ -68,7 +66,6 @@ const LevelPageWithRouter = withRouter( const { vocab } = data; this.props.setVocab(vocab); this.props.setCurrentVocab(vocab[0]); - this.props.setLookedAt([vocab[0].id]); this.props.setStepper(0); this.props.setLoading(false); }); diff --git a/frontend/src/reducers/index.ts b/frontend/src/reducers/index.ts index 948784f..8075d87 100644 --- a/frontend/src/reducers/index.ts +++ b/frontend/src/reducers/index.ts @@ -27,7 +27,6 @@ interface IState { level: { currentVocab: IVocab; - lookedAt: number[]; vocab: IVocab[]; loading: boolean; stepper: number; @@ -104,7 +103,6 @@ const initialState: IState = { level: { currentVocab: {} as IVocab, - lookedAt: [0], vocab: [], loading: true, stepper: 0, @@ -194,12 +192,6 @@ export function LateinicusApp(state: IState = initialState, action: any) { return Object.assign({}, state, { user: action.user, }); - case Actions.LEVEL_SET_LOOKEDAT: - return Object.assign({}, state, { - level: Object.assign({}, state.level, { - lookedAt: action.lookedAt, - }), - }); case Actions.LEVEL_SET_CUR_VOCAB: return Object.assign({}, state, { level: Object.assign({}, state.level, {