Anki/ts/congrats/index.ts
Henrik Giesel 51af6b2544 Rename i18n and i18n_helpers to i18n-generated and i18n
- This way, we can restrict the awkwardness of importing files outside
  the ts directory within lib
2021-10-02 23:34:03 +02:00

23 lines
731 B
TypeScript

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { getCongratsInfo } from "./lib";
import { setupI18n, tr } from "../lib/i18n";
import { checkNightMode } from "../lib/nightmode";
import CongratsPage from "./CongratsPage.svelte";
export async function congrats(target: HTMLDivElement): Promise<void> {
checkNightMode();
await setupI18n({ modules: [tr.ModuleName.SCHEDULING] });
const info = await getCongratsInfo();
const page = new CongratsPage({
target,
props: { info },
});
setInterval(() => {
getCongratsInfo().then((info) => {
page.$set({ info });
});
}, 60000);
}