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-05-27 23:19:05 +02:00
|
|
|
import TitledContainer from "./TitledContainer.svelte";
|
2021-05-29 17:44:08 +02:00
|
|
|
import Item from "components/Item.svelte";
|
2021-05-29 13:06:17 +02:00
|
|
|
import StepsInputRow from "./StepsInputRow.svelte";
|
|
|
|
import SpinBoxRow from "./SpinBoxRow.svelte";
|
|
|
|
import EnumSelectorRow from "./EnumSelectorRow.svelte";
|
2021-05-29 12:29:22 +02:00
|
|
|
import Warning from "./Warning.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-05-29 17:32:12 +02:00
|
|
|
export let api = {};
|
|
|
|
|
2021-04-16 15:29:21 +02:00
|
|
|
let config = state.currentConfig;
|
|
|
|
let defaults = state.defaults;
|
2021-04-12 06:18:30 +02:00
|
|
|
|
2021-05-15 12:09:50 +02:00
|
|
|
const newInsertOrderChoices = [
|
2021-05-13 07:23:16 +02:00
|
|
|
tr.deckConfigNewInsertionOrderSequential(),
|
|
|
|
tr.deckConfigNewInsertionOrderRandom(),
|
|
|
|
];
|
2021-04-12 06:18:30 +02:00
|
|
|
|
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-05-29 17:32:12 +02:00
|
|
|
<TitledContainer title={tr.schedulingNewCards()} {api}>
|
2021-05-29 17:44:08 +02:00
|
|
|
<Item>
|
|
|
|
<StepsInputRow
|
|
|
|
bind:value={$config.learnSteps}
|
|
|
|
defaultValue={defaults.learnSteps}
|
|
|
|
markdownTooltip={tr.deckConfigLearningStepsTooltip()}
|
|
|
|
>
|
|
|
|
{tr.deckConfigLearningSteps()}
|
|
|
|
</StepsInputRow>
|
|
|
|
</Item>
|
2021-04-12 06:18:30 +02:00
|
|
|
|
2021-05-29 17:44:08 +02:00
|
|
|
<Item>
|
|
|
|
<SpinBoxRow
|
|
|
|
bind:value={$config.graduatingIntervalGood}
|
|
|
|
defaultValue={defaults.graduatingIntervalGood}
|
|
|
|
markdownTooltip={tr.deckConfigGraduatingIntervalTooltip()}
|
|
|
|
>
|
|
|
|
{tr.schedulingGraduatingInterval()}
|
|
|
|
</SpinBoxRow>
|
2021-05-24 10:25:17 +02:00
|
|
|
|
2021-05-29 17:44:08 +02:00
|
|
|
<Warning warning={stepsExceedGraduatingInterval} />
|
|
|
|
</Item>
|
2021-04-12 06:18:30 +02:00
|
|
|
|
2021-05-29 17:44:08 +02:00
|
|
|
<Item>
|
|
|
|
<SpinBoxRow
|
|
|
|
bind:value={$config.graduatingIntervalEasy}
|
|
|
|
defaultValue={defaults.graduatingIntervalEasy}
|
|
|
|
markdownTooltip={tr.deckConfigEasyIntervalTooltip()}
|
|
|
|
>
|
|
|
|
{tr.schedulingEasyInterval()}
|
|
|
|
</SpinBoxRow>
|
2021-05-28 00:52:49 +02:00
|
|
|
|
2021-05-29 17:44:08 +02:00
|
|
|
<Warning warning={goodExceedsEasy} />
|
|
|
|
</Item>
|
2021-05-28 00:52:49 +02:00
|
|
|
|
2021-05-29 17:44:08 +02:00
|
|
|
<Item>
|
|
|
|
<EnumSelectorRow
|
|
|
|
bind:value={$config.newCardInsertOrder}
|
|
|
|
defaultValue={defaults.newCardInsertOrder}
|
|
|
|
choices={newInsertOrderChoices}
|
|
|
|
breakpoint={"md"}
|
|
|
|
markdownTooltip={tr.deckConfigNewInsertionOrderTooltip()}
|
|
|
|
>
|
|
|
|
{tr.deckConfigNewInsertionOrder()}
|
|
|
|
</EnumSelectorRow>
|
|
|
|
</Item>
|
2021-05-27 23:19:05 +02:00
|
|
|
</TitledContainer>
|