Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ui/puzzle/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,12 @@ export default function (opts: PuzzleOpts, redraw: Redraw): Controller {
}
redraw();
if (!next) {
alert('No more puzzles available! Try another theme.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This not only remove the alert when replaying from the puzzle dashboard, but also when playing a specific theme such as https://lichess.org/training/xRayAttack and no more puzzles are found.
The proper fix would be to detected if the user is replaying a puzzle and do not display the alert only in this case.

If (!data.replay) {
 alert(...)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your feedback @kraktus I'll take care of it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the alert back within an if block as suggested @kraktus

lichess.redirect('/training/themes');
if (data.replay) {
lichess.redirect(`/training/dashboard/${data.replay.days}`);
} else {
alert('No more puzzles available! Try another theme.');
lichess.redirect('/training/themes');
}
}
}

Expand Down