Anki/ts/routes/deck-options/EasyDays.svelte
Luc Mcgrady 79b6f658c3
Feat: Simulator suspend after lapse count (#3837)
* Added: Leech suspend to simulator

* Added: leech threshold spin box

* Update git rev

* Added: Save to preset options

* ./check

* Added: "Advanced settings" dropdown

* Removed: Indent

* Added: Easy days

* Added: Sticky header

* Removed: Easy Day updating without saving

* un-nest disclosure

* bump fsrs

* Update a VSCode setting to match recent releases

* Move Easy Days above the Advanced settings

I think it's a bit more logical to have Advanced come last.

* Ensure graph fits inside screen height

* Bump fsrs version
2025-03-15 17:28:15 +07:00

55 lines
1.8 KiB
Svelte

<!--
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 "@generated/ftl";
import DynamicallySlottable from "$lib/components/DynamicallySlottable.svelte";
import Item from "$lib/components/Item.svelte";
import TitledContainer from "$lib/components/TitledContainer.svelte";
import type { DeckOptionsState } from "./lib";
import Warning from "./Warning.svelte";
import EasyDaysInput from "./EasyDaysInput.svelte";
export let state: DeckOptionsState;
export let api: Record<string, never>;
const fsrsEnabled = state.fsrs;
const reschedule = state.fsrsReschedule;
const config = state.currentConfig;
const defaults = state.defaults;
const prevEasyDaysPercentages = $config.easyDaysPercentages.slice();
$: if ($config.easyDaysPercentages.length !== 7) {
$config.easyDaysPercentages = defaults.easyDaysPercentages.slice();
}
$: easyDaysChanged = $config.easyDaysPercentages.some(
(value, index) => value !== prevEasyDaysPercentages[index],
);
$: noNormalDay = $config.easyDaysPercentages.some((p) => p === 1.0)
? ""
: tr.deckConfigEasyDaysNoNormalDays();
$: rescheduleWarning =
easyDaysChanged && !($fsrsEnabled && $reschedule)
? tr.deckConfigEasyDaysChange()
: "";
</script>
<datalist id="easy_day_steplist">
<option>0.5</option>
</datalist>
<TitledContainer title={tr.deckConfigEasyDaysTitle()}>
<DynamicallySlottable slotHost={Item} {api}>
<EasyDaysInput bind:values={$config.easyDaysPercentages} />
<Item>
<Warning warning={noNormalDay} />
</Item>
<Item>
<Warning warning={rescheduleWarning} />
</Item>
</DynamicallySlottable>
</TitledContainer>