anki/ts/deckoptions/NewOptions.svelte

85 lines
2.8 KiB
Svelte
Raw Normal View History

<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import * as tr from "lib/i18n";
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-25 10:40:02 +02:00
import type { DeckOptionsState } from "./lib";
2021-04-25 10:40:02 +02:00
export let state: DeckOptionsState;
let config = state.currentConfig;
let defaults = state.defaults;
const newOrderChoices = [
tr.schedulingShowNewCardsInOrderAdded(),
tr.schedulingShowNewCardsInRandomOrder(),
];
let stepsExceedGraduatingInterval: string;
$: {
const lastLearnStepInDays = $config.learnSteps.length
? $config.learnSteps[$config.learnSteps.length - 1] / 60 / 24
: 0;
stepsExceedGraduatingInterval =
lastLearnStepInDays > $config.graduatingIntervalGood
? tr.deckConfigLearningStepAboveGraduatingInterval()
: "";
}
$: goodExceedsEasy =
$config.graduatingIntervalGood > $config.graduatingIntervalEasy
? tr.deckConfigGoodAboveEasy()
: "";
</script>
<div>
<h2>New Cards</h2>
<StepsInput
label="Learning steps"
2021-04-25 13:37:21 +02:00
tooltip="Learning steps, separated by spaces."
defaultValue={defaults.learnSteps}
value={$config.learnSteps}
on:changed={(evt) => ($config.learnSteps = evt.detail.value)} />
<EnumSelector
label={tr.schedulingOrder()}
2021-04-25 13:37:21 +02:00
tooltip=""
choices={newOrderChoices}
defaultValue={defaults.newCardOrder}
bind:value={$config.newCardOrder} />
<SpinBox
label={tr.schedulingGraduatingInterval()}
2021-04-25 13:37:21 +02:00
tooltip="Days to wait after answering Good on the last learning step."
warnings={[stepsExceedGraduatingInterval]}
defaultValue={defaults.graduatingIntervalGood}
bind:value={$config.graduatingIntervalGood} />
<SpinBox
label={tr.schedulingEasyInterval()}
2021-04-25 13:37:21 +02:00
tooltip="Days to wait after answering Easy on the first learning step."
warnings={[goodExceedsEasy]}
defaultValue={defaults.graduatingIntervalEasy}
bind:value={$config.graduatingIntervalEasy} />
<SpinBoxFloat
label={tr.schedulingStartingEase()}
2021-04-25 13:37:21 +02:00
tooltip="The default multiplier when a review is answered Good."
min={1.31}
max={5}
defaultValue={defaults.initialEase}
value={$config.initialEase}
on:changed={(evt) => ($config.initialEase = evt.detail.value)} />
<CheckBox
2021-04-25 13:37:21 +02:00
label={tr.schedulingBuryRelatedNewCardsUntilThe()}
defaultValue={defaults.buryNew}
bind:value={$config.buryNew} />
</div>