Import API from all option sections

This commit is contained in:
Henrik Giesel 2021-05-29 17:32:12 +02:00
parent 2728b5fa63
commit f895919435
11 changed files with 119 additions and 118 deletions

View File

@ -7,12 +7,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState;
export let api: Record<string, never>;
let components = state.addonComponents;
const auxData = state.currentAuxData;
</script>
{#if $components.length || state.haveAddons}
<TitledContainer title="Add-ons">
<TitledContainer title="Add-ons" {api}>
<p>
If you're using an add-on that hasn't been updated to use this new screen
yet, you can access the old deck options screen by holding down the shift

View File

@ -10,11 +10,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState;
export let api: Record<string, never>;
let config = state.currentConfig;
let defaults = state.defaults;
</script>
<TitledContainer title={tr.deckConfigAdvancedTitle()}>
<TitledContainer title={tr.deckConfigAdvancedTitle()} {api}>
<SpinBoxRow
bind:value={$config.maximumReviewInterval}
defaultValue={defaults.maximumReviewInterval}

View File

@ -9,11 +9,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState;
export let api: Record<string, never>;
let config = state.currentConfig;
let defaults = state.defaults;
</script>
<TitledContainer title={tr.deckConfigAudioTitle()}>
<TitledContainer title={tr.deckConfigAudioTitle()} {api}>
<CheckBoxRow
bind:value={$config.disableAutoplay}
defaultValue={defaults.disableAutoplay}

View File

@ -4,48 +4,31 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import * as tr from "lib/i18n";
import marked from "marked";
import TitledContainer from "./TitledContainer.svelte";
import Col from "./Col.svelte";
import Row from "./Row.svelte";
import HelpPopup from "./HelpPopup.svelte";
import CheckBox from "./CheckBox.svelte";
import RevertButton from "./RevertButton.svelte";
import CheckBoxRow from "./CheckBoxRow.svelte";
import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState;
export let api: Record<string, never>;
let config = state.currentConfig;
let defaults = state.defaults;
</script>
<TitledContainer title={tr.deckConfigBuryTitle()}>
<Row>
<Col>
<CheckBox bind:value={$config.buryNew}>
{tr.deckConfigBuryNewSiblings()}
<HelpPopup html={marked(tr.deckConfigBuryTooltip())} />
</CheckBox>
</Col>
<Col grow={false}>
<RevertButton
defaultValue={defaults.buryNew}
bind:value={$config.buryNew}
/>
</Col>
</Row>
<TitledContainer title={tr.deckConfigBuryTitle()} {api}>
<CheckBoxRow
bind:value={$config.buryNew}
defaultValue={defaults.buryNew}
markdownTooltip={tr.deckConfigBuryTitle()}
>
{tr.deckConfigBuryNewSiblings()}
</CheckBoxRow>
<Row>
<Col>
<CheckBox bind:value={$config.buryReviews}>
{tr.deckConfigBuryReviewSiblings()}
<HelpPopup html={marked(tr.deckConfigBuryTooltip())} />
</CheckBox>
</Col>
<Col grow={false}>
<RevertButton
defaultValue={defaults.buryReviews}
bind:value={$config.buryReviews}
/>
</Col>
</Row>
<CheckBoxRow
bind:value={$config.buryReviews}
defaultValue={defaults.buryReviews}
markdownTooltip={tr.deckConfigBuryTooltip()}
>
{tr.deckConfigBuryReviewSiblings()}
</CheckBoxRow>
</TitledContainer>

View File

@ -1,57 +0,0 @@
<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import Container from "components/Container.svelte";
import SectionItem from "components/SectionItem.svelte";
import DailyLimits from "./DailyLimits.svelte";
import DisplayOrder from "./DisplayOrder.svelte";
import NewOptions from "./NewOptions.svelte";
import AdvancedOptions from "./AdvancedOptions.svelte";
import BuryOptions from "./BuryOptions.svelte";
import LapseOptions from "./LapseOptions.svelte";
import TimerOptions from "./TimerOptions.svelte";
import AudioOptions from "./AudioOptions.svelte";
import Addons from "./Addons.svelte";
import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState;
export let options: Record<string, never>;
</script>
<Container api={options}>
<SectionItem>
<DailyLimits {state} />
</SectionItem>
<SectionItem>
<NewOptions {state} />
</SectionItem>
<SectionItem>
<LapseOptions {state} />
</SectionItem>
<SectionItem>
<BuryOptions {state} />
</SectionItem>
{#if state.v3Scheduler}
<SectionItem>
<DisplayOrder {state} />
</SectionItem>
{/if}
<SectionItem>
<TimerOptions {state} />
</SectionItem>
<SectionItem>
<AudioOptions {state} />
</SectionItem>
<SectionItem>
<Addons {state} />
</SectionItem>
<SectionItem>
<AdvancedOptions {state} />
</SectionItem>
</Container>

View File

@ -5,11 +5,14 @@
<script lang="ts">
import * as tr from "lib/i18n";
import TitledContainer from "./TitledContainer.svelte";
import SectionItem from "components/SectionItem.svelte";
import SpinBoxRow from "./SpinBoxRow.svelte";
import Warning from "./Warning.svelte";
import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState;
export let api: Record<string, never>;
let config = state.currentConfig;
let defaults = state.defaults;
let parentLimits = state.parentLimits;
@ -35,24 +38,28 @@
: "";
</script>
<TitledContainer title={tr.deckConfigDailyLimits()}>
<SpinBoxRow
bind:value={$config.newPerDay}
defaultValue={defaults.newPerDay}
markdownTooltip={tr.deckConfigNewLimitTooltip() + v3Extra}
>
{tr.schedulingNewCardsday()}
</SpinBoxRow>
<TitledContainer title={tr.deckConfigDailyLimits()} {api}>
<SectionItem>
<SpinBoxRow
bind:value={$config.newPerDay}
defaultValue={defaults.newPerDay}
markdownTooltip={tr.deckConfigNewLimitTooltip() + v3Extra}
>
{tr.schedulingNewCardsday()}
</SpinBoxRow>
<Warning warning={newCardsGreaterThanParent} />
<Warning warning={newCardsGreaterThanParent} />
</SectionItem>
<SpinBoxRow
bind:value={$config.reviewsPerDay}
defaultValue={defaults.reviewsPerDay}
markdownTooltip={tr.deckConfigReviewLimitTooltip() + v3Extra}
>
{tr.schedulingMaximumReviewsday()}
</SpinBoxRow>
<SectionItem>
<SpinBoxRow
bind:value={$config.reviewsPerDay}
defaultValue={defaults.reviewsPerDay}
markdownTooltip={tr.deckConfigReviewLimitTooltip() + v3Extra}
>
{tr.schedulingMaximumReviewsday()}
</SpinBoxRow>
<Warning warning={reviewsTooLow} />
<Warning warning={reviewsTooLow} />
</SectionItem>
</TitledContainer>

View File

@ -4,7 +4,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import ConfigSelector from "./ConfigSelector.svelte";
import ConfigEditor from "./ConfigEditor.svelte";
import Container from "components/Container.svelte";
import SectionItem from "components/SectionItem.svelte";
import DailyLimits from "./DailyLimits.svelte";
import DisplayOrder from "./DisplayOrder.svelte";
import NewOptions from "./NewOptions.svelte";
import AdvancedOptions from "./AdvancedOptions.svelte";
import BuryOptions from "./BuryOptions.svelte";
import LapseOptions from "./LapseOptions.svelte";
import TimerOptions from "./TimerOptions.svelte";
import AudioOptions from "./AudioOptions.svelte";
import Addons from "./Addons.svelte";
import type { DeckOptionsState } from "./lib";
import type { Writable } from "svelte/store";
import HtmlAddon from "./HtmlAddon.svelte";
@ -33,7 +44,50 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
}
export const options = {};
export const dailyLimits = {};
export const newOptions = {};
export const lapseOptions = {};
export const buryOptions = {};
export const displayOrder = {};
export const timerOptions = {};
export const audioOptions = {};
export const addonOptions = {};
export const advancedOptions = {};
</script>
<ConfigSelector {state} />
<ConfigEditor {state} {options} />
<Container api={options}>
<SectionItem>
<DailyLimits {state} api={dailyLimits} />
</SectionItem>
<SectionItem>
<NewOptions {state} api={newOptions} />
</SectionItem>
<SectionItem>
<LapseOptions {state} api={lapseOptions} />
</SectionItem>
<SectionItem>
<BuryOptions {state} api={buryOptions} />
</SectionItem>
{#if state.v3Scheduler}
<SectionItem>
<DisplayOrder {state} api={displayOrder} />
</SectionItem>
{/if}
<SectionItem>
<TimerOptions {state} api={timerOptions} />
</SectionItem>
<SectionItem>
<AudioOptions {state} api={audioOptions} />
</SectionItem>
<SectionItem>
<Addons {state} api={addonOptions} />
</SectionItem>
<SectionItem>
<AdvancedOptions {state} api={advancedOptions} />
</SectionItem>
</Container>

View File

@ -11,6 +11,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { reviewMixChoices } from "./strings";
export let state: DeckOptionsState;
export let api: Record<string, never>;
let config = state.currentConfig;
let defaults = state.defaults;
@ -36,7 +38,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
];
</script>
<TitledContainer title={tr.deckConfigOrderingTitle()}>
<TitledContainer title={tr.deckConfigOrderingTitle()} {api}>
<EnumSelectorRow
bind:value={$config.newCardGatherPriority}
defaultValue={defaults.newCardGatherPriority}

View File

@ -12,6 +12,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState;
export let api = {};
let config = state.currentConfig;
let defaults = state.defaults;
@ -29,7 +31,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
const leechChoices = [tr.actionsSuspendCard(), tr.schedulingTagOnly()];
</script>
<TitledContainer title={tr.schedulingLapses()}>
<TitledContainer title={tr.schedulingLapses()} {api}>
<StepsInputRow
bind:value={$config.relearnSteps}
defaultValue={defaults.relearnSteps}

View File

@ -12,6 +12,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState;
export let api = {};
let config = state.currentConfig;
let defaults = state.defaults;
@ -37,7 +39,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
: "";
</script>
<TitledContainer title={tr.schedulingNewCards()}>
<TitledContainer title={tr.schedulingNewCards()} {api}>
<StepsInputRow
bind:value={$config.learnSteps}
defaultValue={defaults.learnSteps}

View File

@ -10,11 +10,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState;
export let api: Record<string, never>;
let config = state.currentConfig;
let defaults = state.defaults;
</script>
<TitledContainer title={tr.deckConfigTimerTitle()}>
<TitledContainer title={tr.deckConfigTimerTitle()} {api}>
<SpinBoxRow
bind:value={$config.capAnswerTimeToSecs}
defaultValue={defaults.capAnswerTimeToSecs}