2021-04-12 06:18:30 +02:00
|
|
|
// Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
|
2021-04-25 10:40:02 +02:00
|
|
|
import { getDeckOptionsInfo, DeckOptionsState } from "./lib";
|
2021-04-22 19:55:26 +02:00
|
|
|
import { setupI18n, ModuleName } from "lib/i18n";
|
|
|
|
import { checkNightMode } from "lib/nightmode";
|
2021-04-25 10:40:02 +02:00
|
|
|
import DeckOptionsPage from "./DeckOptionsPage.svelte";
|
2021-04-25 11:24:19 +02:00
|
|
|
import SpinBox from "./SpinBox.svelte";
|
|
|
|
import SpinBoxFloat from "./SpinBoxFloat.svelte";
|
|
|
|
import EnumSelector from "./EnumSelector.svelte";
|
|
|
|
import CheckBox from "./CheckBox.svelte";
|
2021-04-12 06:18:30 +02:00
|
|
|
|
2021-04-25 10:40:02 +02:00
|
|
|
export async function deckOptions(
|
2021-04-12 06:18:30 +02:00
|
|
|
target: HTMLDivElement,
|
|
|
|
deckId: number
|
2021-04-25 10:40:02 +02:00
|
|
|
): Promise<DeckOptionsPage> {
|
2021-04-12 06:18:30 +02:00
|
|
|
checkNightMode();
|
|
|
|
await setupI18n({
|
|
|
|
modules: [ModuleName.SCHEDULING, ModuleName.ACTIONS, ModuleName.DECK_CONFIG],
|
|
|
|
});
|
2021-04-25 10:40:02 +02:00
|
|
|
const info = await getDeckOptionsInfo(deckId);
|
|
|
|
const state = new DeckOptionsState(deckId, info);
|
|
|
|
return new DeckOptionsPage({
|
2021-04-12 06:18:30 +02:00
|
|
|
target,
|
|
|
|
props: { state },
|
|
|
|
});
|
|
|
|
}
|
2021-04-25 11:24:19 +02:00
|
|
|
|
|
|
|
export const deckConfigComponents = {
|
|
|
|
SpinBox,
|
|
|
|
SpinBoxFloat,
|
|
|
|
EnumSelector,
|
|
|
|
CheckBox,
|
|
|
|
};
|