feat: Rework the Level UI

This commit is contained in:
Alexander Polynomdivision
2018-10-10 13:44:45 +02:00
parent ede271f604
commit d9ec095d5c
7 changed files with 225 additions and 53 deletions

View File

@@ -30,6 +30,9 @@ interface IState {
lookedAt: number[];
vocab: IVocab[];
loading: boolean;
stepper: number;
leaveDialog: boolean;
reviewDialog: boolean;
};
levelList: {
@@ -95,6 +98,9 @@ const initialState: IState = {
lookedAt: [0],
vocab: [],
loading: true,
stepper: 0,
leaveDialog: false,
reviewDialog: false,
},
levelList: {
@@ -289,6 +295,24 @@ export function LateinicusApp(state: IState = initialState, action: any) {
loading: action.state,
}),
});
case Actions.LEVEL_SET_STEPPER:
return Object.assign({}, state, {
level: Object.assign({}, state.level, {
stepper: action.index,
}),
});
case Actions.LEVEL_SET_REVIEW_DIAG:
return Object.assign({}, state, {
level: Object.assign({}, state.level, {
reviewDialog: action.state
}),
});
case Actions.LEVEL_SET_LEAVE_DIAG:
return Object.assign({}, state, {
level: Object.assign({}, state.level, {
leaveDialog: action.state,
}),
});
default:
// Ignore the initialization call to the reducer. By that we can
// catch all actions that are not implemented