From 587be11eead5921d6d4f05622413e935789aa56c Mon Sep 17 00:00:00 2001 From: Tristen Tomczak <78294042+ttomczak3@users.noreply.github.com> Date: Sun, 30 Apr 2023 02:22:56 -0500 Subject: [PATCH] Puzzle replay: redirect to dashboard only after voting --- ui/puzzle/src/ctrl.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/puzzle/src/ctrl.ts b/ui/puzzle/src/ctrl.ts index d701c60ce7eab..74aa01f5dd900 100644 --- a/ui/puzzle/src/ctrl.ts +++ b/ui/puzzle/src/ctrl.ts @@ -347,9 +347,7 @@ export default function (opts: PuzzleOpts, redraw: Redraw): Controller { } redraw(); if (!next) { - if (data.replay) { - lichess.redirect(`/training/dashboard/${data.replay.days}`); - } else { + if (!data.replay) { alert('No more puzzles available! Try another theme.'); lichess.redirect('/training/themes'); } @@ -367,9 +365,13 @@ export default function (opts: PuzzleOpts, redraw: Redraw): Controller { if (isPuzzleData(n)) { initiate(n); redraw(); - } else lichess.redirect(`/training/dashboard/${n.days}`); + } }); + if (data.replay && vm.round === undefined) { + lichess.redirect(`/training/dashboard/${data.replay.days}`); + } + if (!streak && !data.replay) { const path = router.withLang(`/training/${data.angle.key}`); if (location.pathname != path) history.replaceState(null, '', path);