feat: Implement updating the done levels

This commit is contained in:
Alexander Polynomdivision
2018-09-29 22:00:15 +02:00
parent e6e7505383
commit ab0c75331d
9 changed files with 146 additions and 18 deletions

View File

@@ -9,7 +9,11 @@ import CardContent from "@material-ui/core/CardContent";
import CardActions from "@material-ui/core/CardActions";
import Button from "@material-ui/core/Button";
export default class IntroPage extends React.Component<{}> {
interface IProps {
dontShowAgain: () => void;
};
export default class IntroPage extends React.Component<IProps> {
render() {
const small = window.matchMedia("(max-width: 700px)").matches;
const cName = small ? "intro-card-xs" : "intro-card-lg";
@@ -68,11 +72,11 @@ export default class IntroPage extends React.Component<{}> {
</Typography>
</CardContent>
<CardActions>
{/*TODO: Tell the server to not show this page again*/}
<Button
fullWidth={true}
component={Link}
to="/dashboard">
to="/dashboard"
onClick={this.props.dontShowAgain}>
Lass uns loslegen
</Button>
</CardActions>

View File

@@ -17,6 +17,7 @@ import { IVocab } from "../models/vocab";
interface IProps {
id: string;
levelVocab: (id: string) => Promise<IVocab[]>;
updateDoneLevels: (id: string) => void;
history: any;
@@ -88,6 +89,7 @@ const LevelPageWithRouter = withRouter(
const { vocab, lookedAt, id } = this.props;
// Only go to the review if all vocabulary item have been looked at
if (vocab.length === lookedAt.length) {
this.props.updateDoneLevels(id);
this.props.setLoading(true);
this.props.history.push(`/review/level/${id}`);
}