fix: Implement more APIs
This commit is contained in:
@@ -17,7 +17,7 @@ import { IReviewMetadata } from "../models/review";
|
||||
|
||||
interface IProps {
|
||||
getNextLevel: () => Promise<ILevel>;
|
||||
getLastReview: () => IReviewMetadata;
|
||||
getLastReview: () => Promise<IReviewMetadata>;
|
||||
getTopTen: () => Promise<ILearner[]>;
|
||||
|
||||
nextLevel: ILevel;
|
||||
@@ -28,6 +28,10 @@ interface IProps {
|
||||
loadingTopTen: boolean;
|
||||
setLoadingTT: (state: boolean) => void;
|
||||
setTopTen: (topten: TopTen[]) => void;
|
||||
lastReview: IReviewMetadata;
|
||||
loadingLastReview: boolean;
|
||||
setLoadingLR: (state: boolean) => void;
|
||||
setLastReview: (review: IReviewMetadata) => void;
|
||||
}
|
||||
|
||||
export default class Dashboard extends React.Component<IProps> {
|
||||
@@ -47,6 +51,13 @@ export default class Dashboard extends React.Component<IProps> {
|
||||
}, err => {
|
||||
console.log("Failed to fetch Top Ten");
|
||||
});
|
||||
|
||||
this.props.getLastReview().then(res => {
|
||||
this.props.setLoadingLR(false);
|
||||
this.props.setLastReview(res);
|
||||
}, err => {
|
||||
console.log("Failed to fetch Last Review");
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -97,16 +108,24 @@ export default class Dashboard extends React.Component<IProps> {
|
||||
</Grid>
|
||||
<Grid item lg={4}>
|
||||
<Paper className="paper">
|
||||
<Typography variant="title">
|
||||
Letzte Wiederholung
|
||||
</Typography>
|
||||
<SummaryTable reviewMeta={this.props.getLastReview} />
|
||||
{
|
||||
this.props.loadingLastReview ? (
|
||||
<CircularProgress />
|
||||
) : (
|
||||
<div>
|
||||
<Typography variant="title">
|
||||
Letzte Wiederholung
|
||||
</Typography>
|
||||
<SummaryTable reviewMeta={this.props.lastReview} />
|
||||
|
||||
<Button
|
||||
component={Link}
|
||||
to="/review/queue">
|
||||
Vokabeln üben
|
||||
</Button>
|
||||
<Button
|
||||
component={Link}
|
||||
to="/review/queue">
|
||||
Vokabeln üben
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</Paper>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -41,7 +41,7 @@ const SummaryPageWithRouter = withRouter(
|
||||
<Paper className="paper">
|
||||
<Typography variant="title">Zusammenfassung</Typography>
|
||||
<Grid container direction="column">
|
||||
<SummaryTable reviewMeta={() => this.props.reviewMeta} />
|
||||
<SummaryTable reviewMeta={this.props.reviewMeta} />
|
||||
<Button onClick={this.toDashboard}>
|
||||
Zum Dashboard
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user