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";
|
2021-05-13 07:23:16 +02:00
|
|
|
import CheckBox from "./CheckBox.svelte";
|
2021-04-12 06:18:30 +02:00
|
|
|
import EnumSelector from "./EnumSelector.svelte";
|
2021-04-25 10:40:02 +02:00
|
|
|
import type { DeckOptionsState } from "./lib";
|
2021-05-13 07:23:16 +02:00
|
|
|
import { reviewMixChoices } from "./strings";
|
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
|
|
|
|
2021-05-15 12:09:50 +02:00
|
|
|
const newInsertOrderChoices = [
|
2021-05-13 07:23:16 +02:00
|
|
|
tr.deckConfigNewInsertionOrderSequential(),
|
|
|
|
tr.deckConfigNewInsertionOrderRandom(),
|
|
|
|
];
|
2021-05-15 12:09:50 +02:00
|
|
|
const newGatherPriorityChoices = [
|
|
|
|
tr.deckConfigNewGatherPriorityDeck(),
|
|
|
|
tr.deckConfigNewGatherPriorityPosition(),
|
|
|
|
];
|
2021-05-13 07:23:16 +02:00
|
|
|
const newSortOrderChoices = [
|
|
|
|
tr.deckConfigSortOrderCardTemplateThenPosition(),
|
|
|
|
tr.deckConfigSortOrderCardTemplateThenRandom(),
|
|
|
|
tr.deckConfigSortOrderPosition(),
|
|
|
|
tr.deckConfigSortOrderRandom(),
|
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-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
|
|
|
<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-05-13 07:23:16 +02:00
|
|
|
{#if state.v3Scheduler}
|
|
|
|
<EnumSelector
|
|
|
|
label={tr.deckConfigNewInsertionOrder()}
|
|
|
|
tooltip={tr.deckConfigNewInsertionOrderTooltip()}
|
2021-05-15 12:09:50 +02:00
|
|
|
choices={newInsertOrderChoices}
|
|
|
|
defaultValue={defaults.newCardInsertOrder}
|
|
|
|
bind:value={$config.newCardInsertOrder} />
|
|
|
|
|
|
|
|
<EnumSelector
|
|
|
|
label={tr.deckConfigNewGatherPriority()}
|
|
|
|
tooltip={tr.deckConfigNewGatherPriorityTooltip()}
|
|
|
|
choices={newGatherPriorityChoices}
|
|
|
|
defaultValue={defaults.newCardGatherPriority}
|
|
|
|
bind:value={$config.newCardGatherPriority} />
|
2021-05-13 07:23:16 +02:00
|
|
|
|
|
|
|
<EnumSelector
|
|
|
|
label={tr.deckConfigSortOrder()}
|
|
|
|
tooltip={tr.deckConfigSortOrderTooltip()}
|
|
|
|
choices={newSortOrderChoices}
|
|
|
|
defaultValue={defaults.newCardSortOrder}
|
|
|
|
bind:value={$config.newCardSortOrder} />
|
|
|
|
|
|
|
|
<EnumSelector
|
2021-05-15 12:09:50 +02:00
|
|
|
label={tr.deckConfigReviewPriority()}
|
|
|
|
tooltip={tr.deckConfigReviewPriorityTooltip()}
|
2021-05-13 07:23:16 +02:00
|
|
|
choices={reviewMixChoices()}
|
|
|
|
defaultValue={defaults.newMix}
|
|
|
|
bind:value={$config.newMix} />
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
<CheckBox
|
|
|
|
label={tr.deckConfigBuryNewSiblings()}
|
|
|
|
tooltip={tr.deckConfigBuryTooltip()}
|
|
|
|
defaultValue={defaults.buryNew}
|
|
|
|
bind:value={$config.buryNew} />
|