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"; import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState; export let state: DeckOptionsState;
export let api: Record<string, never>;
let components = state.addonComponents; let components = state.addonComponents;
const auxData = state.currentAuxData; const auxData = state.currentAuxData;
</script> </script>
{#if $components.length || state.haveAddons} {#if $components.length || state.haveAddons}
<TitledContainer title="Add-ons"> <TitledContainer title="Add-ons" {api}>
<p> <p>
If you're using an add-on that hasn't been updated to use this new screen 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 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"; import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState; export let state: DeckOptionsState;
export let api: Record<string, never>;
let config = state.currentConfig; let config = state.currentConfig;
let defaults = state.defaults; let defaults = state.defaults;
</script> </script>
<TitledContainer title={tr.deckConfigAdvancedTitle()}> <TitledContainer title={tr.deckConfigAdvancedTitle()} {api}>
<SpinBoxRow <SpinBoxRow
bind:value={$config.maximumReviewInterval} bind:value={$config.maximumReviewInterval}
defaultValue={defaults.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"; import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState; export let state: DeckOptionsState;
export let api: Record<string, never>;
let config = state.currentConfig; let config = state.currentConfig;
let defaults = state.defaults; let defaults = state.defaults;
</script> </script>
<TitledContainer title={tr.deckConfigAudioTitle()}> <TitledContainer title={tr.deckConfigAudioTitle()} {api}>
<CheckBoxRow <CheckBoxRow
bind:value={$config.disableAutoplay} bind:value={$config.disableAutoplay}
defaultValue={defaults.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"> <script lang="ts">
import * as tr from "lib/i18n"; import * as tr from "lib/i18n";
import marked from "marked";
import TitledContainer from "./TitledContainer.svelte"; import TitledContainer from "./TitledContainer.svelte";
import Col from "./Col.svelte"; import CheckBoxRow from "./CheckBoxRow.svelte";
import Row from "./Row.svelte";
import HelpPopup from "./HelpPopup.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;
export let api: Record<string, never>;
let config = state.currentConfig; let config = state.currentConfig;
let defaults = state.defaults; let defaults = state.defaults;
</script> </script>
<TitledContainer title={tr.deckConfigBuryTitle()}> <TitledContainer title={tr.deckConfigBuryTitle()} {api}>
<Row> <CheckBoxRow
<Col> bind:value={$config.buryNew}
<CheckBox bind:value={$config.buryNew}> defaultValue={defaults.buryNew}
{tr.deckConfigBuryNewSiblings()} markdownTooltip={tr.deckConfigBuryTitle()}
<HelpPopup html={marked(tr.deckConfigBuryTooltip())} /> >
</CheckBox> {tr.deckConfigBuryNewSiblings()}
</Col> </CheckBoxRow>
<Col grow={false}>
<RevertButton
defaultValue={defaults.buryNew}
bind:value={$config.buryNew}
/>
</Col>
</Row>
<Row> <CheckBoxRow
<Col> bind:value={$config.buryReviews}
<CheckBox bind:value={$config.buryReviews}> defaultValue={defaults.buryReviews}
{tr.deckConfigBuryReviewSiblings()} markdownTooltip={tr.deckConfigBuryTooltip()}
<HelpPopup html={marked(tr.deckConfigBuryTooltip())} /> >
</CheckBox> {tr.deckConfigBuryReviewSiblings()}
</Col> </CheckBoxRow>
<Col grow={false}>
<RevertButton
defaultValue={defaults.buryReviews}
bind:value={$config.buryReviews}
/>
</Col>
</Row>
</TitledContainer> </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"> <script lang="ts">
import * as tr from "lib/i18n"; import * as tr from "lib/i18n";
import TitledContainer from "./TitledContainer.svelte"; import TitledContainer from "./TitledContainer.svelte";
import SectionItem from "components/SectionItem.svelte";
import SpinBoxRow from "./SpinBoxRow.svelte"; import SpinBoxRow from "./SpinBoxRow.svelte";
import Warning from "./Warning.svelte"; import Warning from "./Warning.svelte";
import type { DeckOptionsState } from "./lib"; import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState; export let state: DeckOptionsState;
export let api: Record<string, never>;
let config = state.currentConfig; let config = state.currentConfig;
let defaults = state.defaults; let defaults = state.defaults;
let parentLimits = state.parentLimits; let parentLimits = state.parentLimits;
@ -35,24 +38,28 @@
: ""; : "";
</script> </script>
<TitledContainer title={tr.deckConfigDailyLimits()}> <TitledContainer title={tr.deckConfigDailyLimits()} {api}>
<SpinBoxRow <SectionItem>
bind:value={$config.newPerDay} <SpinBoxRow
defaultValue={defaults.newPerDay} bind:value={$config.newPerDay}
markdownTooltip={tr.deckConfigNewLimitTooltip() + v3Extra} defaultValue={defaults.newPerDay}
> markdownTooltip={tr.deckConfigNewLimitTooltip() + v3Extra}
{tr.schedulingNewCardsday()} >
</SpinBoxRow> {tr.schedulingNewCardsday()}
</SpinBoxRow>
<Warning warning={newCardsGreaterThanParent} /> <Warning warning={newCardsGreaterThanParent} />
</SectionItem>
<SpinBoxRow <SectionItem>
bind:value={$config.reviewsPerDay} <SpinBoxRow
defaultValue={defaults.reviewsPerDay} bind:value={$config.reviewsPerDay}
markdownTooltip={tr.deckConfigReviewLimitTooltip() + v3Extra} defaultValue={defaults.reviewsPerDay}
> markdownTooltip={tr.deckConfigReviewLimitTooltip() + v3Extra}
{tr.schedulingMaximumReviewsday()} >
</SpinBoxRow> {tr.schedulingMaximumReviewsday()}
</SpinBoxRow>
<Warning warning={reviewsTooLow} /> <Warning warning={reviewsTooLow} />
</SectionItem>
</TitledContainer> </TitledContainer>

View File

@ -4,7 +4,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
--> -->
<script lang="ts"> <script lang="ts">
import ConfigSelector from "./ConfigSelector.svelte"; 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 { DeckOptionsState } from "./lib";
import type { Writable } from "svelte/store"; import type { Writable } from "svelte/store";
import HtmlAddon from "./HtmlAddon.svelte"; 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 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> </script>
<ConfigSelector {state} /> <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"; import { reviewMixChoices } from "./strings";
export let state: DeckOptionsState; export let state: DeckOptionsState;
export let api: Record<string, never>;
let config = state.currentConfig; let config = state.currentConfig;
let defaults = state.defaults; let defaults = state.defaults;
@ -36,7 +38,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
]; ];
</script> </script>
<TitledContainer title={tr.deckConfigOrderingTitle()}> <TitledContainer title={tr.deckConfigOrderingTitle()} {api}>
<EnumSelectorRow <EnumSelectorRow
bind:value={$config.newCardGatherPriority} bind:value={$config.newCardGatherPriority}
defaultValue={defaults.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"; import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState; export let state: DeckOptionsState;
export let api = {};
let config = state.currentConfig; let config = state.currentConfig;
let defaults = state.defaults; 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()]; const leechChoices = [tr.actionsSuspendCard(), tr.schedulingTagOnly()];
</script> </script>
<TitledContainer title={tr.schedulingLapses()}> <TitledContainer title={tr.schedulingLapses()} {api}>
<StepsInputRow <StepsInputRow
bind:value={$config.relearnSteps} bind:value={$config.relearnSteps}
defaultValue={defaults.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"; import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState; export let state: DeckOptionsState;
export let api = {};
let config = state.currentConfig; let config = state.currentConfig;
let defaults = state.defaults; let defaults = state.defaults;
@ -37,7 +39,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
: ""; : "";
</script> </script>
<TitledContainer title={tr.schedulingNewCards()}> <TitledContainer title={tr.schedulingNewCards()} {api}>
<StepsInputRow <StepsInputRow
bind:value={$config.learnSteps} bind:value={$config.learnSteps}
defaultValue={defaults.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"; import type { DeckOptionsState } from "./lib";
export let state: DeckOptionsState; export let state: DeckOptionsState;
export let api: Record<string, never>;
let config = state.currentConfig; let config = state.currentConfig;
let defaults = state.defaults; let defaults = state.defaults;
</script> </script>
<TitledContainer title={tr.deckConfigTimerTitle()}> <TitledContainer title={tr.deckConfigTimerTitle()} {api}>
<SpinBoxRow <SpinBoxRow
bind:value={$config.capAnswerTimeToSecs} bind:value={$config.capAnswerTimeToSecs}
defaultValue={defaults.capAnswerTimeToSecs} defaultValue={defaults.capAnswerTimeToSecs}