2021-10-14 11:22:47 +02:00
|
|
|
// Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
|
2022-02-04 09:36:34 +01:00
|
|
|
import "./card-info-base.css";
|
2021-10-14 11:22:47 +02:00
|
|
|
|
2022-02-04 09:36:34 +01:00
|
|
|
import { ModuleName, setupI18n } from "../lib/i18n";
|
|
|
|
import { checkNightMode } from "../lib/nightmode";
|
2021-10-14 11:22:47 +02:00
|
|
|
import CardInfo from "./CardInfo.svelte";
|
|
|
|
|
2022-01-16 06:05:35 +01:00
|
|
|
const i18n = setupI18n({
|
|
|
|
modules: [ModuleName.CARD_STATS, ModuleName.SCHEDULING, ModuleName.STATISTICS],
|
|
|
|
});
|
|
|
|
|
|
|
|
export async function setupCardInfo(): Promise<CardInfo> {
|
2021-10-14 11:22:47 +02:00
|
|
|
checkNightMode();
|
2022-01-16 06:05:35 +01:00
|
|
|
await i18n;
|
|
|
|
|
|
|
|
return new CardInfo({ target: document.body, props: { includeRevlog: true } });
|
|
|
|
}
|
|
|
|
|
|
|
|
export const cardInfoPromise = setupCardInfo();
|
|
|
|
|
|
|
|
if (window.location.hash.startsWith("#test")) {
|
|
|
|
// use #testXXXX where XXXX is card ID to test
|
|
|
|
const cardId = parseInt(window.location.hash.substr("#test".length), 10);
|
|
|
|
cardInfoPromise.then((cardInfo: CardInfo): void => cardInfo.$set({ cardId }));
|
2021-10-16 23:32:00 +02:00
|
|
|
}
|