mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Factor RevertButton out of components
This commit is contained in:
parent
c87123a9b1
commit
6e06f4afd4
14 changed files with 93 additions and 102 deletions
|
@ -10,6 +10,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import HelpPopup from "./HelpPopup.svelte";
|
import HelpPopup from "./HelpPopup.svelte";
|
||||||
import SpinBox from "./SpinBox.svelte";
|
import SpinBox from "./SpinBox.svelte";
|
||||||
import SpinBoxFloat from "./SpinBoxFloat.svelte";
|
import SpinBoxFloat from "./SpinBoxFloat.svelte";
|
||||||
|
import RevertButton from "./RevertButton.svelte";
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
|
@ -27,6 +28,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<SpinBox
|
<SpinBox
|
||||||
min={1}
|
min={1}
|
||||||
max={365 * 100}
|
max={365 * 100}
|
||||||
|
bind:value={$config.maximumReviewInterval}
|
||||||
|
/>
|
||||||
|
<RevertButton
|
||||||
defaultValue={defaults.maximumReviewInterval}
|
defaultValue={defaults.maximumReviewInterval}
|
||||||
bind:value={$config.maximumReviewInterval}
|
bind:value={$config.maximumReviewInterval}
|
||||||
/>
|
/>
|
||||||
|
@ -39,12 +43,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<HelpPopup html={marked(tr.deckConfigStartingEaseTooltip())} />
|
<HelpPopup html={marked(tr.deckConfigStartingEaseTooltip())} />
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<SpinBoxFloat
|
<SpinBoxFloat min={1.31} max={5} bind:value={$config.initialEase} />
|
||||||
min={1.31}
|
<RevertButton
|
||||||
max={5}
|
|
||||||
defaultValue={defaults.initialEase}
|
defaultValue={defaults.initialEase}
|
||||||
value={$config.initialEase}
|
bind:value={$config.initialEase}
|
||||||
on:changed={(evt) => ($config.initialEase = evt.detail.value)}
|
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ConfigEntry>
|
</ConfigEntry>
|
||||||
|
@ -55,12 +57,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<HelpPopup html={marked(tr.deckConfigEasyBonusTooltip())} />
|
<HelpPopup html={marked(tr.deckConfigEasyBonusTooltip())} />
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<SpinBoxFloat
|
<SpinBoxFloat min={1} max={3} bind:value={$config.easyMultiplier} />
|
||||||
min={1}
|
<RevertButton
|
||||||
max={3}
|
|
||||||
defaultValue={defaults.easyMultiplier}
|
defaultValue={defaults.easyMultiplier}
|
||||||
value={$config.easyMultiplier}
|
bind:value={$config.easyMultiplier}
|
||||||
on:changed={(evt) => ($config.easyMultiplier = evt.detail.value)}
|
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ConfigEntry>
|
</ConfigEntry>
|
||||||
|
@ -71,12 +71,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<HelpPopup html={marked(tr.deckConfigIntervalModifierTooltip())} />
|
<HelpPopup html={marked(tr.deckConfigIntervalModifierTooltip())} />
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<SpinBoxFloat
|
<SpinBoxFloat min={0.5} max={2} bind:value={$config.intervalMultiplier} />
|
||||||
min={0.5}
|
<RevertButton
|
||||||
max={2}
|
|
||||||
defaultValue={defaults.intervalMultiplier}
|
defaultValue={defaults.intervalMultiplier}
|
||||||
value={$config.intervalMultiplier}
|
bind:value={$config.intervalMultiplier}
|
||||||
on:changed={(evt) => ($config.intervalMultiplier = evt.detail.value)}
|
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ConfigEntry>
|
</ConfigEntry>
|
||||||
|
@ -87,12 +85,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<HelpPopup html={marked(tr.deckConfigHardIntervalTooltip())} />
|
<HelpPopup html={marked(tr.deckConfigHardIntervalTooltip())} />
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<SpinBoxFloat
|
<SpinBoxFloat min={0.5} max={1.3} bind:value={$config.hardMultiplier} />
|
||||||
min={0.5}
|
<RevertButton
|
||||||
max={1.3}
|
|
||||||
defaultValue={defaults.hardMultiplier}
|
defaultValue={defaults.hardMultiplier}
|
||||||
value={$config.hardMultiplier}
|
bind:value={$config.hardMultiplier}
|
||||||
on:changed={(evt) => ($config.hardMultiplier = evt.detail.value)}
|
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ConfigEntry>
|
</ConfigEntry>
|
||||||
|
@ -100,15 +96,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<ConfigEntry>
|
<ConfigEntry>
|
||||||
<span slot="left">
|
<span slot="left">
|
||||||
{tr.schedulingNewInterval()}
|
{tr.schedulingNewInterval()}
|
||||||
<HelpPopup html={tr.deckConfigNewIntervalTooltip()} />
|
<HelpPopup html={marked(tr.deckConfigNewIntervalTooltip())} />
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<SpinBoxFloat
|
<SpinBoxFloat min={0} max={1} bind:value={$config.lapseMultiplier} />
|
||||||
min={0}
|
<RevertButton
|
||||||
max={1}
|
|
||||||
defaultValue={defaults.lapseMultiplier}
|
defaultValue={defaults.lapseMultiplier}
|
||||||
value={$config.lapseMultiplier}
|
bind:value={$config.lapseMultiplier}
|
||||||
on:changed={(evt) => ($config.lapseMultiplier = evt.detail.value)}
|
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ConfigEntry>
|
</ConfigEntry>
|
||||||
|
|
|
@ -9,6 +9,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import ConfigEntryFull from "./ConfigEntryFull.svelte";
|
import ConfigEntryFull from "./ConfigEntryFull.svelte";
|
||||||
import HelpPopup from "./HelpPopup.svelte";
|
import HelpPopup from "./HelpPopup.svelte";
|
||||||
import CheckBox from "./CheckBox.svelte";
|
import CheckBox from "./CheckBox.svelte";
|
||||||
|
import RevertButton from "./RevertButton.svelte";
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
|
@ -18,23 +19,25 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
<TitledContainer title={tr.deckConfigAudioTitle()}>
|
<TitledContainer title={tr.deckConfigAudioTitle()}>
|
||||||
<ConfigEntryFull>
|
<ConfigEntryFull>
|
||||||
<CheckBox
|
<CheckBox bind:value={$config.disableAutoplay}>
|
||||||
defaultValue={defaults.disableAutoplay}
|
|
||||||
bind:value={$config.disableAutoplay}
|
|
||||||
>
|
|
||||||
{tr.deckConfigDisableAutoplay()}
|
{tr.deckConfigDisableAutoplay()}
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
<RevertButton
|
||||||
|
defaultValue={defaults.disableAutoplay}
|
||||||
|
bind:value={$config.disableAutoplay}
|
||||||
|
/>
|
||||||
</ConfigEntryFull>
|
</ConfigEntryFull>
|
||||||
|
|
||||||
<ConfigEntryFull>
|
<ConfigEntryFull>
|
||||||
<CheckBox
|
<CheckBox bind:value={$config.skipQuestionWhenReplayingAnswer}>
|
||||||
defaultValue={defaults.skipQuestionWhenReplayingAnswer}
|
|
||||||
bind:value={$config.skipQuestionWhenReplayingAnswer}
|
|
||||||
>
|
|
||||||
{tr.schedulingAlwaysIncludeQuestionSideWhenReplaying()}
|
{tr.schedulingAlwaysIncludeQuestionSideWhenReplaying()}
|
||||||
<HelpPopup
|
<HelpPopup
|
||||||
html={marked(tr.deckConfigAlwaysIncludeQuestionAudioTooltip())}
|
html={marked(tr.deckConfigAlwaysIncludeQuestionAudioTooltip())}
|
||||||
/>
|
/>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
<RevertButton
|
||||||
|
defaultValue={defaults.skipQuestionWhenReplayingAnswer}
|
||||||
|
bind:value={$config.skipQuestionWhenReplayingAnswer}
|
||||||
|
/>
|
||||||
</ConfigEntryFull>
|
</ConfigEntryFull>
|
||||||
</TitledContainer>
|
</TitledContainer>
|
||||||
|
|
|
@ -9,6 +9,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import ConfigEntryFull from "./ConfigEntryFull.svelte";
|
import ConfigEntryFull from "./ConfigEntryFull.svelte";
|
||||||
import HelpPopup from "./HelpPopup.svelte";
|
import HelpPopup from "./HelpPopup.svelte";
|
||||||
import CheckBox from "./CheckBox.svelte";
|
import CheckBox from "./CheckBox.svelte";
|
||||||
|
import RevertButton from "./RevertButton.svelte";
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
|
@ -18,16 +19,21 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
<TitledContainer title={tr.deckConfigBuryTitle()}>
|
<TitledContainer title={tr.deckConfigBuryTitle()}>
|
||||||
<ConfigEntryFull>
|
<ConfigEntryFull>
|
||||||
<CheckBox defaultValue={defaults.buryNew} bind:value={$config.buryNew}>
|
<CheckBox bind:value={$config.buryNew}>
|
||||||
{tr.deckConfigBuryNewSiblings()}
|
{tr.deckConfigBuryNewSiblings()}
|
||||||
<HelpPopup html={marked(tr.deckConfigBuryTooltip())} />
|
<HelpPopup html={marked(tr.deckConfigBuryTooltip())} />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
<RevertButton defaultValue={defaults.buryNew} bind:value={$config.buryNew} />
|
||||||
</ConfigEntryFull>
|
</ConfigEntryFull>
|
||||||
|
|
||||||
<ConfigEntryFull>
|
<ConfigEntryFull>
|
||||||
<CheckBox defaultValue={defaults.buryReviews} bind:value={$config.buryReviews}>
|
<CheckBox bind:value={$config.buryReviews}>
|
||||||
{tr.deckConfigBuryReviewSiblings()}
|
{tr.deckConfigBuryReviewSiblings()}
|
||||||
<HelpPopup html={marked(tr.deckConfigBuryTooltip())} />
|
<HelpPopup html={marked(tr.deckConfigBuryTooltip())} />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
<RevertButton
|
||||||
|
defaultValue={defaults.buryReviews}
|
||||||
|
bind:value={$config.buryReviews}
|
||||||
|
/>
|
||||||
</ConfigEntryFull>
|
</ConfigEntryFull>
|
||||||
</TitledContainer>
|
</TitledContainer>
|
||||||
|
|
|
@ -3,11 +3,7 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import RevertButton from "./RevertButton.svelte";
|
|
||||||
|
|
||||||
export let value: boolean;
|
export let value: boolean;
|
||||||
export let defaultValue: boolean;
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<label> <input type="checkbox" bind:checked={value} /> <slot /> </label>
|
<label> <input type="checkbox" bind:checked={value} /> <slot /> </label>
|
||||||
<RevertButton bind:value {defaultValue} />
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
import HelpPopup from "./HelpPopup.svelte";
|
import HelpPopup from "./HelpPopup.svelte";
|
||||||
import Warnings from "./Warnings.svelte";
|
import Warnings from "./Warnings.svelte";
|
||||||
import SpinBox from "./SpinBox.svelte";
|
import SpinBox from "./SpinBox.svelte";
|
||||||
|
import RevertButton from "./RevertButton.svelte";
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
|
@ -46,8 +47,8 @@
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<SpinBox
|
<SpinBox min={0} bind:value={$config.newPerDay} />
|
||||||
min={0}
|
<RevertButton
|
||||||
defaultValue={defaults.newPerDay}
|
defaultValue={defaults.newPerDay}
|
||||||
bind:value={$config.newPerDay}
|
bind:value={$config.newPerDay}
|
||||||
/>
|
/>
|
||||||
|
@ -63,8 +64,8 @@
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<SpinBox
|
<SpinBox min={0} bind:value={$config.reviewsPerDay} />
|
||||||
min={0}
|
<RevertButton
|
||||||
defaultValue={defaults.reviewsPerDay}
|
defaultValue={defaults.reviewsPerDay}
|
||||||
bind:value={$config.reviewsPerDay}
|
bind:value={$config.reviewsPerDay}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -9,6 +9,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import ConfigEntry from "./ConfigEntry.svelte";
|
import ConfigEntry from "./ConfigEntry.svelte";
|
||||||
import HelpPopup from "./HelpPopup.svelte";
|
import HelpPopup from "./HelpPopup.svelte";
|
||||||
import EnumSelector from "./EnumSelector.svelte";
|
import EnumSelector from "./EnumSelector.svelte";
|
||||||
|
import RevertButton from "./RevertButton.svelte";
|
||||||
|
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
import { reviewMixChoices } from "./strings";
|
import { reviewMixChoices } from "./strings";
|
||||||
|
@ -48,6 +49,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<EnumSelector
|
<EnumSelector
|
||||||
choices={newGatherPriorityChoices}
|
choices={newGatherPriorityChoices}
|
||||||
|
bind:value={$config.newCardGatherPriority}
|
||||||
|
/>
|
||||||
|
<RevertButton
|
||||||
defaultValue={defaults.newCardGatherPriority}
|
defaultValue={defaults.newCardGatherPriority}
|
||||||
bind:value={$config.newCardGatherPriority}
|
bind:value={$config.newCardGatherPriority}
|
||||||
/>
|
/>
|
||||||
|
@ -62,6 +66,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<EnumSelector
|
<EnumSelector
|
||||||
choices={newSortOrderChoices}
|
choices={newSortOrderChoices}
|
||||||
|
bind:value={$config.newCardSortOrder}
|
||||||
|
/>
|
||||||
|
<RevertButton
|
||||||
defaultValue={defaults.newCardSortOrder}
|
defaultValue={defaults.newCardSortOrder}
|
||||||
bind:value={$config.newCardSortOrder}
|
bind:value={$config.newCardSortOrder}
|
||||||
/>
|
/>
|
||||||
|
@ -74,11 +81,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<HelpPopup html={marked(tr.deckConfigNewReviewPriorityTooltip())} />
|
<HelpPopup html={marked(tr.deckConfigNewReviewPriorityTooltip())} />
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<EnumSelector
|
<EnumSelector choices={reviewMixChoices()} bind:value={$config.newMix} />
|
||||||
choices={reviewMixChoices()}
|
<RevertButton defaultValue={defaults.newMix} bind:value={$config.newMix} />
|
||||||
defaultValue={defaults.newMix}
|
|
||||||
bind:value={$config.newMix}
|
|
||||||
/>
|
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ConfigEntry>
|
</ConfigEntry>
|
||||||
|
|
||||||
|
@ -90,6 +94,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<EnumSelector
|
<EnumSelector
|
||||||
choices={reviewMixChoices()}
|
choices={reviewMixChoices()}
|
||||||
|
bind:value={$config.interdayLearningMix}
|
||||||
|
/>
|
||||||
|
<RevertButton
|
||||||
defaultValue={defaults.interdayLearningMix}
|
defaultValue={defaults.interdayLearningMix}
|
||||||
bind:value={$config.interdayLearningMix}
|
bind:value={$config.interdayLearningMix}
|
||||||
/>
|
/>
|
||||||
|
@ -104,6 +111,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<EnumSelector
|
<EnumSelector
|
||||||
choices={reviewOrderChoices}
|
choices={reviewOrderChoices}
|
||||||
|
bind:value={$config.reviewOrder}
|
||||||
|
/>
|
||||||
|
<RevertButton
|
||||||
defaultValue={defaults.reviewOrder}
|
defaultValue={defaults.reviewOrder}
|
||||||
bind:value={$config.reviewOrder}
|
bind:value={$config.reviewOrder}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -3,11 +3,8 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import RevertButton from "./RevertButton.svelte";
|
|
||||||
|
|
||||||
export let choices: string[];
|
export let choices: string[];
|
||||||
export let value: number = 0;
|
export let value: number = 0;
|
||||||
export let defaultValue: number;
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<select bind:value class="form-select">
|
<select bind:value class="form-select">
|
||||||
|
@ -15,4 +12,3 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<option value={idx}>{choice}</option>
|
<option value={idx}>{choice}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
<RevertButton bind:value {defaultValue} />
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import SpinBox from "./SpinBox.svelte";
|
import SpinBox from "./SpinBox.svelte";
|
||||||
import EnumSelector from "./EnumSelector.svelte";
|
import EnumSelector from "./EnumSelector.svelte";
|
||||||
import StepsInput from "./StepsInput.svelte";
|
import StepsInput from "./StepsInput.svelte";
|
||||||
|
import RevertButton from "./RevertButton.svelte";
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
|
@ -41,10 +42,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<StepsInput
|
<StepsInput
|
||||||
defaultValue={defaults.relearnSteps}
|
|
||||||
value={$config.relearnSteps}
|
value={$config.relearnSteps}
|
||||||
on:changed={(evt) => ($config.relearnSteps = evt.detail.value)}
|
on:changed={(evt) => ($config.relearnSteps = evt.detail.value)}
|
||||||
/>
|
/>
|
||||||
|
<RevertButton
|
||||||
|
defaultValue={defaults.relearnSteps}
|
||||||
|
value={$config.relearnSteps}
|
||||||
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ConfigEntry>
|
</ConfigEntry>
|
||||||
|
|
||||||
|
@ -55,8 +59,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<SpinBox
|
<SpinBox min={1} bind:value={$config.minimumLapseInterval} />
|
||||||
min={1}
|
<RevertButton
|
||||||
defaultValue={defaults.minimumLapseInterval}
|
defaultValue={defaults.minimumLapseInterval}
|
||||||
bind:value={$config.minimumLapseInterval}
|
bind:value={$config.minimumLapseInterval}
|
||||||
/>
|
/>
|
||||||
|
@ -72,8 +76,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<SpinBox
|
<SpinBox min={1} bind:value={$config.leechThreshold} />
|
||||||
min={1}
|
<RevertButton
|
||||||
defaultValue={defaults.leechThreshold}
|
defaultValue={defaults.leechThreshold}
|
||||||
bind:value={$config.leechThreshold}
|
bind:value={$config.leechThreshold}
|
||||||
/>
|
/>
|
||||||
|
@ -87,8 +91,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<EnumSelector
|
<EnumSelector choices={leechChoices} bind:value={$config.leechAction} />
|
||||||
choices={leechChoices}
|
<RevertButton
|
||||||
defaultValue={defaults.leechAction}
|
defaultValue={defaults.leechAction}
|
||||||
bind:value={$config.leechAction}
|
bind:value={$config.leechAction}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -12,6 +12,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import SpinBox from "./SpinBox.svelte";
|
import SpinBox from "./SpinBox.svelte";
|
||||||
import StepsInput from "./StepsInput.svelte";
|
import StepsInput from "./StepsInput.svelte";
|
||||||
import EnumSelector from "./EnumSelector.svelte";
|
import EnumSelector from "./EnumSelector.svelte";
|
||||||
|
import RevertButton from "./RevertButton.svelte";
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
|
@ -48,10 +49,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<StepsInput
|
<StepsInput bind:value={$config.learnSteps} />
|
||||||
|
<RevertButton
|
||||||
defaultValue={defaults.learnSteps}
|
defaultValue={defaults.learnSteps}
|
||||||
value={$config.learnSteps}
|
bind:value={$config.learnSteps}
|
||||||
on:changed={(evt) => ($config.learnSteps = evt.detail.value)}
|
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ConfigEntry>
|
</ConfigEntry>
|
||||||
|
@ -63,7 +64,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<SpinBox
|
<SpinBox bind:value={$config.graduatingIntervalGood} />
|
||||||
|
<RevertButton
|
||||||
defaultValue={defaults.graduatingIntervalGood}
|
defaultValue={defaults.graduatingIntervalGood}
|
||||||
bind:value={$config.graduatingIntervalGood}
|
bind:value={$config.graduatingIntervalGood}
|
||||||
/>
|
/>
|
||||||
|
@ -79,7 +81,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<SpinBox
|
<SpinBox bind:value={$config.graduatingIntervalEasy} />
|
||||||
|
<RevertButton
|
||||||
defaultValue={defaults.graduatingIntervalEasy}
|
defaultValue={defaults.graduatingIntervalEasy}
|
||||||
bind:value={$config.graduatingIntervalEasy}
|
bind:value={$config.graduatingIntervalEasy}
|
||||||
/>
|
/>
|
||||||
|
@ -97,6 +100,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<EnumSelector
|
<EnumSelector
|
||||||
choices={newInsertOrderChoices}
|
choices={newInsertOrderChoices}
|
||||||
|
bind:value={$config.newCardInsertOrder}
|
||||||
|
/>
|
||||||
|
<RevertButton
|
||||||
defaultValue={defaults.newCardInsertOrder}
|
defaultValue={defaults.newCardInsertOrder}
|
||||||
bind:value={$config.newCardInsertOrder}
|
bind:value={$config.newCardInsertOrder}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -3,12 +3,9 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import RevertButton from "./RevertButton.svelte";
|
|
||||||
|
|
||||||
export let value: number;
|
export let value: number;
|
||||||
export let min = 1;
|
export let min = 1;
|
||||||
export let max = 9999;
|
export let max = 9999;
|
||||||
export let defaultValue: number = 0;
|
|
||||||
|
|
||||||
function checkMinMax() {
|
function checkMinMax() {
|
||||||
if (value > max) {
|
if (value > max) {
|
||||||
|
@ -27,4 +24,3 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
class="form-control"
|
class="form-control"
|
||||||
on:blur={checkMinMax}
|
on:blur={checkMinMax}
|
||||||
/>
|
/>
|
||||||
<RevertButton bind:value {defaultValue} />
|
|
||||||
|
|
|
@ -3,28 +3,15 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from "svelte";
|
|
||||||
import RevertButton from "./RevertButton.svelte";
|
|
||||||
import type { NumberValueEvent } from "./events";
|
|
||||||
|
|
||||||
export let value: number;
|
export let value: number;
|
||||||
export let defaultValue: number;
|
|
||||||
export let min = 1;
|
export let min = 1;
|
||||||
export let max = 9999;
|
export let max = 9999;
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
let stringValue: string;
|
let stringValue: string;
|
||||||
$: stringValue = value.toFixed(2);
|
$: stringValue = value.toFixed(2);
|
||||||
|
|
||||||
function update(this: HTMLInputElement): void {
|
function update(this: HTMLInputElement): void {
|
||||||
dispatch("changed", {
|
value = Math.min(max, Math.max(min, parseFloat(this.value)));
|
||||||
value: Math.min(max, Math.max(min, parseFloat(this.value))),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function revert(evt: NumberValueEvent): void {
|
|
||||||
dispatch("changed", { value: evt.detail.value });
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -37,4 +24,3 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
value={stringValue}
|
value={stringValue}
|
||||||
on:blur={update}
|
on:blur={update}
|
||||||
/>
|
/>
|
||||||
<RevertButton bind:value {defaultValue} on:revert={revert} />
|
|
||||||
|
|
|
@ -3,28 +3,16 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from "svelte";
|
|
||||||
import { stepsToString, stringToSteps } from "./steps";
|
import { stepsToString, stringToSteps } from "./steps";
|
||||||
import RevertButton from "./RevertButton.svelte";
|
|
||||||
import type { NumberValueEvent } from "./events";
|
|
||||||
|
|
||||||
export let value: number[];
|
export let value: number[];
|
||||||
export let defaultValue: number[];
|
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
let stringValue: string;
|
let stringValue: string;
|
||||||
$: stringValue = stepsToString(value);
|
$: stringValue = stepsToString(value);
|
||||||
|
|
||||||
function update(this: HTMLInputElement): void {
|
function update(this: HTMLInputElement): void {
|
||||||
const value = stringToSteps(this.value);
|
value = stringToSteps(this.value);
|
||||||
dispatch("changed", { value });
|
|
||||||
}
|
|
||||||
|
|
||||||
function revert(evt: NumberValueEvent): void {
|
|
||||||
dispatch("changed", { value: evt.detail.value });
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<input type="text" value={stringValue} on:blur={update} class="form-control" />
|
<input type="text" value={stringValue} on:blur={update} class="form-control" />
|
||||||
<RevertButton bind:value {defaultValue} on:revert={revert} />
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import HelpPopup from "./HelpPopup.svelte";
|
import HelpPopup from "./HelpPopup.svelte";
|
||||||
import SpinBox from "./SpinBox.svelte";
|
import SpinBox from "./SpinBox.svelte";
|
||||||
import CheckBox from "./CheckBox.svelte";
|
import CheckBox from "./CheckBox.svelte";
|
||||||
|
import RevertButton from "./RevertButton.svelte";
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
|
@ -25,9 +26,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<HelpPopup html={marked(tr.deckConfigMaximumAnswerSecsTooltip())} />
|
<HelpPopup html={marked(tr.deckConfigMaximumAnswerSecsTooltip())} />
|
||||||
</span>
|
</span>
|
||||||
<svelte:fragment slot="right">
|
<svelte:fragment slot="right">
|
||||||
<SpinBox
|
<SpinBox min={30} max={600} bind:value={$config.capAnswerTimeToSecs} />
|
||||||
min={30}
|
<RevertButton
|
||||||
max={600}
|
|
||||||
defaultValue={defaults.capAnswerTimeToSecs}
|
defaultValue={defaults.capAnswerTimeToSecs}
|
||||||
bind:value={$config.capAnswerTimeToSecs}
|
bind:value={$config.capAnswerTimeToSecs}
|
||||||
/>
|
/>
|
||||||
|
@ -35,9 +35,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
</ConfigEntry>
|
</ConfigEntry>
|
||||||
|
|
||||||
<ConfigEntryFull>
|
<ConfigEntryFull>
|
||||||
<CheckBox defaultValue={defaults.showTimer} bind:value={$config.showTimer}>
|
<CheckBox bind:value={$config.showTimer}>
|
||||||
{tr.schedulingShowAnswerTimer()}
|
{tr.schedulingShowAnswerTimer()}
|
||||||
<HelpPopup html={marked(tr.deckConfigShowAnswerTimerTooltip())} />
|
<HelpPopup html={marked(tr.deckConfigShowAnswerTimerTooltip())} />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
<RevertButton
|
||||||
|
defaultValue={defaults.showTimer}
|
||||||
|
bind:value={$config.showTimer}
|
||||||
|
/>
|
||||||
</ConfigEntryFull>
|
</ConfigEntryFull>
|
||||||
</TitledContainer>
|
</TitledContainer>
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
@include bootstrap-dark.night-mode;
|
@include bootstrap-dark.night-mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control, .form-select{
|
.form-control,
|
||||||
|
.form-select {
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
// the unprefixed version wasn't added until Chrome 81
|
// the unprefixed version wasn't added until Chrome 81
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
|
|
Loading…
Reference in a new issue