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
|
|
|
|
-->
|
|
|
|
<script lang="ts">
|
2021-04-22 19:55:26 +02:00
|
|
|
import * as tr from "lib/i18n";
|
2021-04-12 06:18:30 +02:00
|
|
|
import SpinBox from "./SpinBox.svelte";
|
|
|
|
import StepsInput from "./StepsInput.svelte";
|
|
|
|
import EnumSelector from "./EnumSelector.svelte";
|
2021-04-25 10:40:02 +02:00
|
|
|
import type { DeckOptionsState } from "./lib";
|
2021-04-12 06:18:30 +02:00
|
|
|
|
2021-04-25 10:40:02 +02:00
|
|
|
export let state: DeckOptionsState;
|
2021-04-16 15:29:21 +02:00
|
|
|
let config = state.currentConfig;
|
|
|
|
let defaults = state.defaults;
|
2021-04-12 06:18:30 +02:00
|
|
|
|
|
|
|
const newOrderChoices = [
|
|
|
|
tr.schedulingShowNewCardsInOrderAdded(),
|
|
|
|
tr.schedulingShowNewCardsInRandomOrder(),
|
|
|
|
];
|
|
|
|
|
2021-04-17 14:53:47 +02:00
|
|
|
let stepsExceedGraduatingInterval: string;
|
2021-04-12 06:18:30 +02:00
|
|
|
$: {
|
2021-04-16 15:29:21 +02:00
|
|
|
const lastLearnStepInDays = $config.learnSteps.length
|
|
|
|
? $config.learnSteps[$config.learnSteps.length - 1] / 60 / 24
|
2021-04-12 06:18:30 +02:00
|
|
|
: 0;
|
|
|
|
stepsExceedGraduatingInterval =
|
2021-04-17 14:53:47 +02:00
|
|
|
lastLearnStepInDays > $config.graduatingIntervalGood
|
2021-04-25 15:03:23 +02:00
|
|
|
? tr.deckConfigLearningStepAboveGraduatingInterval()
|
2021-04-17 14:53:47 +02:00
|
|
|
: "";
|
2021-04-12 06:18:30 +02:00
|
|
|
}
|
|
|
|
|
2021-04-16 15:29:21 +02:00
|
|
|
$: goodExceedsEasy =
|
2021-04-17 14:53:47 +02:00
|
|
|
$config.graduatingIntervalGood > $config.graduatingIntervalEasy
|
2021-04-25 15:03:23 +02:00
|
|
|
? tr.deckConfigGoodAboveEasy()
|
2021-04-17 14:53:47 +02:00
|
|
|
: "";
|
2021-04-12 06:18:30 +02:00
|
|
|
</script>
|
|
|
|
|
2021-04-26 15:34:33 +02:00
|
|
|
<h2>{tr.schedulingNewCards()}</h2>
|
2021-04-12 06:18:30 +02:00
|
|
|
|
2021-04-26 15:34:33 +02:00
|
|
|
<StepsInput
|
|
|
|
label={tr.deckConfigLearningSteps()}
|
|
|
|
tooltip={tr.deckConfigLearningStepsTooltip()}
|
|
|
|
defaultValue={defaults.learnSteps}
|
|
|
|
value={$config.learnSteps}
|
|
|
|
on:changed={(evt) => ($config.learnSteps = evt.detail.value)} />
|
2021-04-12 06:18:30 +02:00
|
|
|
|
2021-04-26 15:34:33 +02:00
|
|
|
<SpinBox
|
|
|
|
label={tr.schedulingGraduatingInterval()}
|
|
|
|
tooltip={tr.deckConfigGraduatingIntervalTooltip()}
|
|
|
|
warnings={[stepsExceedGraduatingInterval]}
|
|
|
|
defaultValue={defaults.graduatingIntervalGood}
|
|
|
|
bind:value={$config.graduatingIntervalGood} />
|
2021-04-12 06:18:30 +02:00
|
|
|
|
2021-04-26 15:34:33 +02:00
|
|
|
<SpinBox
|
|
|
|
label={tr.schedulingEasyInterval()}
|
|
|
|
tooltip={tr.deckConfigEasyIntervalTooltip()}
|
|
|
|
warnings={[goodExceedsEasy]}
|
|
|
|
defaultValue={defaults.graduatingIntervalEasy}
|
|
|
|
bind:value={$config.graduatingIntervalEasy} />
|
2021-04-12 06:18:30 +02:00
|
|
|
|
2021-04-26 15:34:33 +02:00
|
|
|
<EnumSelector
|
|
|
|
label={tr.schedulingOrder()}
|
|
|
|
choices={newOrderChoices}
|
|
|
|
defaultValue={defaults.newCardOrder}
|
|
|
|
bind:value={$config.newCardOrder} />
|