refactor: Remove lookedAt

This commit is contained in:
Alexander Polynomdivision 2018-10-18 17:33:23 +02:00
parent 30a2b11ab7
commit 4fd1c6724b
4 changed files with 1 additions and 22 deletions

View File

@ -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 const LEVEL_SET_CUR_VOCAB = "LEVEL_SET_CUR_VOCAB";
export function setLevelCurrentVocab(vocab: IVocab) { export function setLevelCurrentVocab(vocab: IVocab) {
return { return {

View File

@ -11,13 +11,12 @@ import LevelPage from "../pages/level";
const mapStateToProps = state => { const mapStateToProps = state => {
const { const {
currentVocab, lookedAt, vocab, loading, stepper, currentVocab, vocab, loading, stepper,
reviewDialog, leaveDialog reviewDialog, leaveDialog
} = state.level; } = state.level;
return { return {
currentVocab, currentVocab,
lookedAt,
vocab, vocab,
loading, loading,
stepperIndex: stepper, stepperIndex: stepper,
@ -29,7 +28,6 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => { const mapDispatchToProps = dispatch => {
return { return {
drawerButtonState: (state: boolean) => dispatch(setDrawerButton(state)), drawerButtonState: (state: boolean) => dispatch(setDrawerButton(state)),
setLookedAt: (ids: number[]) => dispatch(setLevelLookedAt(ids)),
setCurrentVocab: (vocab: IVocab) => dispatch(setLevelCurrentVocab(vocab)), setCurrentVocab: (vocab: IVocab) => dispatch(setLevelCurrentVocab(vocab)),
setVocab: (vocab: IVocab[]) => dispatch(setLevelVocab(vocab)), setVocab: (vocab: IVocab[]) => dispatch(setLevelVocab(vocab)),
setLoading: (state: boolean) => dispatch(setLevelLoading(state)), setLoading: (state: boolean) => dispatch(setLevelLoading(state)),

View File

@ -35,12 +35,10 @@ interface IProps {
stepperIndex: number; stepperIndex: number;
loading: boolean; loading: boolean;
vocab: IVocab[]; vocab: IVocab[];
lookedAt: number[];
currentVocab: IVocab; currentVocab: IVocab;
leaveDialog: boolean; leaveDialog: boolean;
reviewDialog: boolean; reviewDialog: boolean;
setVocab: (vocab: IVocab[]) => void; setVocab: (vocab: IVocab[]) => void;
setLookedAt: (ids: number[]) => void;
setCurrentVocab: (vocab: IVocab) => void; setCurrentVocab: (vocab: IVocab) => void;
drawerButtonState: (state: boolean) => void; drawerButtonState: (state: boolean) => void;
setLoading: (state: boolean) => void; setLoading: (state: boolean) => void;
@ -68,7 +66,6 @@ const LevelPageWithRouter = withRouter(
const { vocab } = data; const { vocab } = data;
this.props.setVocab(vocab); this.props.setVocab(vocab);
this.props.setCurrentVocab(vocab[0]); this.props.setCurrentVocab(vocab[0]);
this.props.setLookedAt([vocab[0].id]);
this.props.setStepper(0); this.props.setStepper(0);
this.props.setLoading(false); this.props.setLoading(false);
}); });

View File

@ -27,7 +27,6 @@ interface IState {
level: { level: {
currentVocab: IVocab; currentVocab: IVocab;
lookedAt: number[];
vocab: IVocab[]; vocab: IVocab[];
loading: boolean; loading: boolean;
stepper: number; stepper: number;
@ -104,7 +103,6 @@ const initialState: IState = {
level: { level: {
currentVocab: {} as IVocab, currentVocab: {} as IVocab,
lookedAt: [0],
vocab: [], vocab: [],
loading: true, loading: true,
stepper: 0, stepper: 0,
@ -194,12 +192,6 @@ export function LateinicusApp(state: IState = initialState, action: any) {
return Object.assign({}, state, { return Object.assign({}, state, {
user: action.user, 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: case Actions.LEVEL_SET_CUR_VOCAB:
return Object.assign({}, state, { return Object.assign({}, state, {
level: Object.assign({}, state.level, { level: Object.assign({}, state.level, {