dbg: Stub all 'API-Calls'
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as React from "react";
|
||||
|
||||
import { Redirect } from "react-router";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
@@ -17,22 +17,10 @@ import { IReviewMetadata } from "../models/review";
|
||||
interface IProps {
|
||||
nextLevel: () => ILevel;
|
||||
lastReview: () => IReviewMetadata;
|
||||
learners: ILearner[];
|
||||
getTopTen: () => ILearner[];
|
||||
}
|
||||
|
||||
interface IState {
|
||||
toLevel: number;
|
||||
}
|
||||
|
||||
export default class Dashboard extends React.Component<IProps, IState> {
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
toLevel: -1;
|
||||
};
|
||||
}
|
||||
|
||||
export default class Dashboard extends React.Component<IProps> {
|
||||
render() {
|
||||
const small = window.matchMedia("(max-width: 700px)").matches;
|
||||
const direction = small ? "column" : "row";
|
||||
@@ -40,11 +28,6 @@ export default class Dashboard extends React.Component<IProps, IState> {
|
||||
const level = this.props.nextLevel();
|
||||
|
||||
return <div>
|
||||
{
|
||||
this.state.toLevel !== -1 ? (
|
||||
<Redirect to={`/level/${this.state.toLevel}`} />
|
||||
) : undefined
|
||||
}
|
||||
<Grid container direction={direction} spacing={16}>
|
||||
<Grid item lg={4}>
|
||||
<Paper className="paper">
|
||||
@@ -54,12 +37,10 @@ export default class Dashboard extends React.Component<IProps, IState> {
|
||||
<Typography component="p">
|
||||
{level.desc}
|
||||
</Typography>
|
||||
<Button className="lesson-card-btn"
|
||||
onClick={() => {
|
||||
this.setState({
|
||||
toLevel: level.level,
|
||||
});
|
||||
}}>
|
||||
<Button
|
||||
component={Link}
|
||||
to={`/level/${level.level}`}
|
||||
className="lesson-card-btn">
|
||||
Zum Level
|
||||
</Button>
|
||||
</Paper>
|
||||
@@ -70,7 +51,7 @@ export default class Dashboard extends React.Component<IProps, IState> {
|
||||
Rangliste: Top 10
|
||||
</Typography>
|
||||
|
||||
<Scoreboard learners={this.props.learners.slice(0, 10)} />
|
||||
<Scoreboard topTen={this.props.getTopTen()} />
|
||||
</Paper>
|
||||
</Grid>
|
||||
<Grid item lg={4}>
|
||||
|
||||
Reference in New Issue
Block a user