update congrats screen periodically; automatically move back to study

This commit is contained in:
Damien Elmes 2021-08-02 16:05:18 +10:00
parent 070f57fcc5
commit c6c9721c53
3 changed files with 10 additions and 2 deletions

View File

@ -274,6 +274,8 @@ def set_graph_preferences() -> None:
def congrats_info() -> bytes:
if not aqt.mw.col.sched._is_finished():
aqt.mw.taskman.run_on_main(lambda: aqt.mw.moveToState("review"))
return aqt.mw.col.congrats_info()

View File

@ -11,7 +11,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import * as tr from "lib/i18n";
const congrats = tr.schedulingCongratulationsFinished();
const nextLearnMsg = buildNextLearnMsg(info);
let nextLearnMsg: string;
$: nextLearnMsg = buildNextLearnMsg(info);
const today_reviews = tr.schedulingTodayReviewLimitReached();
const today_new = tr.schedulingTodayNewLimitReached();

View File

@ -11,8 +11,13 @@ export async function congrats(target: HTMLDivElement): Promise<void> {
checkNightMode();
await setupI18n({ modules: [ModuleName.SCHEDULING] });
const info = await getCongratsInfo();
new CongratsPage({
const page = new CongratsPage({
target,
props: { info },
});
setInterval(() => {
getCongratsInfo().then((info) => {
page.$set({ info });
});
}, 60000);
}