feat: Implement getNextLevel and getTopTenLearners

This commit is contained in:
Alexander Polynomdivision
2018-09-23 16:14:14 +02:00
parent db4b46b5aa
commit 08cd51c2a3
11 changed files with 280 additions and 77 deletions

View File

@@ -0,0 +1,28 @@
import { connect } from "react-redux";
import { setNextLevel, setDashboardNLLoading, setTopTen, setDashboardTTLoading } from "../actions";
import { ILevel } from "../models/level";
import DashboardPage from "../pages/dashboard";
const mapStateToProps = state => {
return {
nextLevel: state.nextLevel,
loadingNextLevel: state.dashboard.loadingNL,
loadingTopTen: state.dashboard.loadingTT,
topTen: state.topTen,
};
};
const mapDispatchToProps = dispatch => {
return {
setLoadingNL: (state: boolean) => dispatch(setDashboardNLLoading(state)),
setNextLevel: (level: ILevel) => dispatch(setNextLevel(level)),
setTopTen: (topTen: ILearner[]) => dispatch(setTopTen(topTen)),
setLoadingTT: (state: boolean) => dispatch(setDashboardTTLoading(state)),
}
};
const DashboardContainer = connect(mapStateToProps,
mapDispatchToProps)(DashboardPage);
export default DashboardContainer;

View File

@@ -1,6 +1,6 @@
import { connect } from "react-redux";
import { setDrawer } from "../actions";
import { setDrawer, setScorePopover } from "../actions";
import Drawer from "../components/Drawer";
@@ -10,11 +10,13 @@ const mapStateToProps = state => {
open: state.drawer,
authenticated: state.authenticated,
showButton: state.drawerButton,
scorePopoverOpen: state.scorePopoverOpen,
};
};
const mapDispatchToProps = dispatch => {
return {
setDrawer: (show: boolean) => dispatch(setDrawer(show)),
setScorePopover: (state: boolean) => dispatch(setScorePopover(state)),
};
};