feat: Implement the new /dashboard API

This commit is contained in:
Alexander Polynomdivision
2018-09-24 18:29:29 +02:00
parent 7339e1ccac
commit 24f35be058
7 changed files with 127 additions and 143 deletions

View File

@@ -1,8 +1,7 @@
import { connect } from "react-redux";
import {
setNextLevel, setDashboardNLLoading, setTopTen, setDashboardTTLoading,
setDashboardLRLoading, setLastReview,
setNextLevel, setTopTen, setLastReview, setDashboardLoading
} from "../actions";
import { ILevel } from "../models/level";
@@ -13,22 +12,18 @@ import DashboardPage from "../pages/dashboard";
const mapStateToProps = state => {
return {
loading: state.review.loading,
nextLevel: state.nextLevel,
loadingNextLevel: state.dashboard.loadingNL,
loadingTopTen: state.dashboard.loadingTT,
topTen: state.topTen,
loadingLastReview: state.dashboard.loadingLR,
lastReview: state.lastReview,
};
};
const mapDispatchToProps = dispatch => {
return {
setLoadingNL: (state: boolean) => dispatch(setDashboardNLLoading(state)),
setLoading: (state: boolean) => dispatch(setDashboardLoading(state)),
setNextLevel: (level: ILevel) => dispatch(setNextLevel(level)),
setTopTen: (topTen: ILearner[]) => dispatch(setTopTen(topTen)),
setLoadingTT: (state: boolean) => dispatch(setDashboardTTLoading(state)),
setLastReview: (review: IReviewMetadata) => dispatch(setLastReview(review)),
setLoadingLR: (state: boolean) => dispatch(setDashboardLRLoading(state)),
}
};