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 SpinBoxFloat from "./SpinBoxFloat.svelte";
|
|
|
|
import CheckBox from "./CheckBox.svelte";
|
|
|
|
import StepsInput from "./StepsInput.svelte";
|
|
|
|
import EnumSelector from "./EnumSelector.svelte";
|
2021-04-16 15:29:21 +02:00
|
|
|
import type { DeckConfigState } from "./lib";
|
2021-04-12 06:18:30 +02:00
|
|
|
|
2021-04-16 15:29:21 +02:00
|
|
|
export let state: DeckConfigState;
|
|
|
|
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
|
|
|
|
? "Your last learning step is greater than the graduating interval."
|
|
|
|
: "";
|
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
|
|
|
|
? "The Good interval should not be larger than the Easy interval."
|
|
|
|
: "";
|
2021-04-12 06:18:30 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<h2>New Cards</h2>
|
|
|
|
|
|
|
|
<StepsInput
|
|
|
|
label="Learning steps"
|
|
|
|
subLabel="Learning steps, separated by spaces."
|
|
|
|
defaultValue={defaults.learnSteps}
|
2021-04-16 15:29:21 +02:00
|
|
|
value={$config.learnSteps}
|
|
|
|
on:changed={(evt) => ($config.learnSteps = evt.detail.value)} />
|
2021-04-12 06:18:30 +02:00
|
|
|
|
|
|
|
<EnumSelector
|
|
|
|
label={tr.schedulingOrder()}
|
|
|
|
subLabel=""
|
|
|
|
choices={newOrderChoices}
|
|
|
|
defaultValue={defaults.newCardOrder}
|
2021-04-16 15:29:21 +02:00
|
|
|
bind:value={$config.newCardOrder} />
|
2021-04-12 06:18:30 +02:00
|
|
|
|
|
|
|
<SpinBox
|
|
|
|
label={tr.schedulingGraduatingInterval()}
|
|
|
|
subLabel="Days to wait after answering Good on the last learning step."
|
2021-04-17 14:56:55 +02:00
|
|
|
warnings={[stepsExceedGraduatingInterval]}
|
2021-04-12 06:18:30 +02:00
|
|
|
defaultValue={defaults.graduatingIntervalGood}
|
2021-04-16 15:29:21 +02:00
|
|
|
bind:value={$config.graduatingIntervalGood} />
|
2021-04-12 06:18:30 +02:00
|
|
|
|
|
|
|
<SpinBox
|
|
|
|
label={tr.schedulingEasyInterval()}
|
|
|
|
subLabel="Days to wait after answering Easy on the first learning step."
|
2021-04-17 14:53:47 +02:00
|
|
|
warnings={[goodExceedsEasy]}
|
2021-04-12 06:18:30 +02:00
|
|
|
defaultValue={defaults.graduatingIntervalEasy}
|
2021-04-16 15:29:21 +02:00
|
|
|
bind:value={$config.graduatingIntervalEasy} />
|
2021-04-12 06:18:30 +02:00
|
|
|
|
|
|
|
<SpinBoxFloat
|
|
|
|
label={tr.schedulingStartingEase()}
|
|
|
|
subLabel="The default multiplier when a review is answered Good."
|
|
|
|
min={1.31}
|
|
|
|
max={5}
|
|
|
|
defaultValue={defaults.initialEase}
|
2021-04-16 15:29:21 +02:00
|
|
|
value={$config.initialEase}
|
|
|
|
on:changed={(evt) => ($config.initialEase = evt.detail.value)} />
|
2021-04-12 06:18:30 +02:00
|
|
|
|
|
|
|
<CheckBox
|
|
|
|
subLabel={tr.schedulingBuryRelatedNewCardsUntilThe()}
|
|
|
|
defaultValue={defaults.buryNew}
|
2021-04-16 15:29:21 +02:00
|
|
|
bind:value={$config.buryNew} />
|
2021-04-12 06:18:30 +02:00
|
|
|
</div>
|