Skip to content

Commit

Permalink
Handle no cards to repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
kubk committed Nov 27, 2023
1 parent 1d3b9d5 commit e4747f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/screens/deck-review/repeat-all-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { deckListStore } from "../../store/deck-list-store.ts";
import { DeckFinished } from "./deck-finished.tsx";
import { Review } from "./review.tsx";
import React from "react";
import { Hint } from "../../ui/hint.tsx";

export const RepeatAllScreen = observer(() => {
const reviewStore = useReviewStore();
Expand All @@ -19,5 +20,12 @@ export const RepeatAllScreen = observer(() => {
return <Review />;
}

return null;
return (
<div>
<Hint>
Amazing work! 🌟 You've repeated all the cards for today. Come back
later for more.
</Hint>
</div>
);
});
4 changes: 4 additions & 0 deletions src/store/review-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export class ReviewStore {
});
});

if (!this.cardsToReview.length) {
return;
}

this.initialCardCount = this.cardsToReview.length;
this.currentCardId = this.cardsToReview[0].id;
if (this.cardsToReview.length > 1) {
Expand Down

0 comments on commit e4747f7

Please sign in to comment.