feat: Implement updating the done levels
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user