2021-04-17 16:01:53 +02:00
|
|
|
<!--
|
2021-05-27 23:19:05 +02:00
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
2021-04-17 16:01:53 +02:00
|
|
|
-->
|
|
|
|
<script lang="ts">
|
2021-05-28 00:52:49 +02:00
|
|
|
import marked from "marked";
|
2021-04-22 19:55:26 +02:00
|
|
|
import * as tr from "lib/i18n";
|
2021-05-27 23:19:05 +02:00
|
|
|
import TitledContainer from "./TitledContainer.svelte";
|
2021-05-29 02:12:47 +02:00
|
|
|
import Row from "./Row.svelte";
|
|
|
|
import Col from "./Col.svelte";
|
2021-05-28 00:52:49 +02:00
|
|
|
import HelpPopup from "./HelpPopup.svelte";
|
|
|
|
import Warnings from "./Warnings.svelte";
|
2021-04-17 16:01:53 +02:00
|
|
|
import SpinBox from "./SpinBox.svelte";
|
2021-05-28 23:59:20 +02:00
|
|
|
import RevertButton from "./RevertButton.svelte";
|
2021-04-25 10:40:02 +02:00
|
|
|
import type { DeckOptionsState } from "./lib";
|
2021-04-17 16:01:53 +02:00
|
|
|
|
2021-04-25 10:40:02 +02:00
|
|
|
export let state: DeckOptionsState;
|
2021-04-17 16:01:53 +02:00
|
|
|
let config = state.currentConfig;
|
|
|
|
let defaults = state.defaults;
|
|
|
|
let parentLimits = state.parentLimits;
|
|
|
|
|
2021-05-24 11:04:00 +02:00
|
|
|
const v3Extra = state.v3Scheduler
|
|
|
|
? "\n\n" +
|
|
|
|
tr.deckConfigLimitNewBoundByReviews() +
|
|
|
|
"\n\n" +
|
|
|
|
tr.deckConfigLimitDeckV3()
|
|
|
|
: "";
|
2021-05-24 10:25:17 +02:00
|
|
|
|
2021-04-17 16:01:53 +02:00
|
|
|
$: newCardsGreaterThanParent =
|
2021-05-15 12:09:50 +02:00
|
|
|
!state.v3Scheduler && $config.newPerDay > $parentLimits.newCards
|
2021-04-25 15:03:23 +02:00
|
|
|
? tr.deckConfigDailyLimitWillBeCapped({ cards: $parentLimits.newCards })
|
2021-04-17 16:01:53 +02:00
|
|
|
: "";
|
|
|
|
|
|
|
|
$: reviewsTooLow =
|
2021-04-25 15:03:23 +02:00
|
|
|
Math.min(9999, $config.newPerDay * 10) > $config.reviewsPerDay
|
|
|
|
? tr.deckConfigReviewsTooLow({
|
|
|
|
cards: $config.newPerDay,
|
|
|
|
expected: Math.min(9999, $config.newPerDay * 10),
|
|
|
|
})
|
2021-04-17 16:01:53 +02:00
|
|
|
: "";
|
|
|
|
</script>
|
|
|
|
|
2021-05-27 23:19:05 +02:00
|
|
|
<TitledContainer title={tr.deckConfigDailyLimits()}>
|
2021-05-29 02:12:47 +02:00
|
|
|
<Row>
|
|
|
|
<Col size={7}>
|
2021-05-28 00:52:49 +02:00
|
|
|
{tr.schedulingNewCardsday()}<HelpPopup
|
|
|
|
html={marked(tr.deckConfigNewLimitTooltip() + v3Extra)}
|
|
|
|
/>
|
2021-05-29 02:12:47 +02:00
|
|
|
</Col>
|
|
|
|
<Col size={5}>
|
2021-05-28 23:59:20 +02:00
|
|
|
<SpinBox min={0} bind:value={$config.newPerDay} />
|
|
|
|
<RevertButton
|
2021-05-28 00:52:49 +02:00
|
|
|
defaultValue={defaults.newPerDay}
|
|
|
|
bind:value={$config.newPerDay}
|
|
|
|
/>
|
2021-05-29 02:12:47 +02:00
|
|
|
</Col>
|
|
|
|
</Row>
|
2021-05-28 00:52:49 +02:00
|
|
|
|
|
|
|
<Warnings warnings={[newCardsGreaterThanParent]} />
|
|
|
|
|
2021-05-29 02:12:47 +02:00
|
|
|
<Row>
|
|
|
|
<Col size={7}>
|
2021-05-28 00:52:49 +02:00
|
|
|
{tr.schedulingMaximumReviewsday()}<HelpPopup
|
|
|
|
html={marked(tr.deckConfigReviewLimitTooltip() + v3Extra)}
|
|
|
|
/>
|
2021-05-29 02:12:47 +02:00
|
|
|
</Col>
|
|
|
|
<Col size={5}>
|
2021-05-28 23:59:20 +02:00
|
|
|
<SpinBox min={0} bind:value={$config.reviewsPerDay} />
|
|
|
|
<RevertButton
|
2021-05-28 00:52:49 +02:00
|
|
|
defaultValue={defaults.reviewsPerDay}
|
|
|
|
bind:value={$config.reviewsPerDay}
|
|
|
|
/>
|
2021-05-29 02:12:47 +02:00
|
|
|
</Col>
|
|
|
|
</Row>
|
2021-05-28 00:52:49 +02:00
|
|
|
|
|
|
|
<Warnings warnings={[reviewsTooLow]} />
|
2021-05-27 23:19:05 +02:00
|
|
|
</TitledContainer>
|