feat: Implement getNextLevel and getTopTenLearners
This commit is contained in:
28
frontend/src/containers/Dashboard.ts
Normal file
28
frontend/src/containers/Dashboard.ts
Normal 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;
|
||||
@@ -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)),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user