Warn if no day is set to Normal (#3557)

This commit is contained in:
Abdo 2024-11-07 01:35:39 +03:00 committed by GitHub
parent ac731624e1
commit eb393aeaee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -290,6 +290,7 @@ deck-config-easy-days-sunday = Sunday
deck-config-easy-days-normal = Normal
deck-config-easy-days-reduced = Reduced
deck-config-easy-days-minimum = Minimum
deck-config-easy-days-no-normal-days = At least one day should be set to '{ deck-config-easy-days-normal }'.
## Adding/renaming

View file

@ -8,6 +8,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import Item from "$lib/components/Item.svelte";
import TitledContainer from "$lib/components/TitledContainer.svelte";
import type { DeckOptionsState } from "./lib";
import Warning from "./Warning.svelte";
export let state: DeckOptionsState;
export let api: Record<string, never>;
@ -20,6 +21,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
$config.easyDaysPercentages = defaults.easyDaysPercentages;
}
$: noNormalDay = $config.easyDaysPercentages.some((p) => p === 1.0)
? ""
: tr.deckConfigEasyDaysNoNormalDays();
const easyDays = [
tr.deckConfigEasyDaysMonday(),
tr.deckConfigEasyDaysTuesday(),
@ -81,6 +86,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</table>
</div>
</Item>
<Item>
<Warning warning={noNormalDay} />
</Item>
</DynamicallySlottable>
</TitledContainer>