Move globe icon into separate Svelte file

Confirmed correct layout in RTL mode.

I experimented with adding a tooltip as well, as suggested in
https://forums.ankiweb.net/t/anki-23-12-beta/37771/82, but it's
confusing as we already change the mouse cursor/underline when the user
hovers over a label. Given the help text universally starts with
"affects the entire collection", I think that's good enough.
This commit is contained in:
Damien Elmes 2023-12-12 12:33:31 +10:00
parent 45abf1c7e8
commit 980594252d
6 changed files with 23 additions and 17 deletions

View file

@ -1,9 +1,5 @@
### Text shown on the "Deck Options" screen
# Text added to an option name when it affects all decks at once, e.g.
# "FSRS 🌐"
deck-config-all-decks = { $option } 🌐
## Top section
# Used in the deck configuration screen to show how many decks are used

View file

@ -17,6 +17,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { type HelpItem, HelpItemScheduler } from "../components/types";
import CardStateCustomizer from "./CardStateCustomizer.svelte";
import FsrsOptions from "./FsrsOptions.svelte";
import GlobalLabel from "./GlobalLabel.svelte";
import type { DeckOptionsState } from "./lib";
import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte";
import SpinBoxRow from "./SpinBoxRow.svelte";
@ -32,7 +33,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
const settings = {
fsrs: {
title: tr.deckConfigAllDecks({ option: "FSRS" }),
title: "FSRS",
help: tr.deckConfigFsrsTooltip(),
url: HelpPage.DeckOptions.fsrs,
},
@ -102,7 +103,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
sched: HelpItemScheduler.SM2,
},
customScheduling: {
title: tr.deckConfigAllDecks({ option: tr.deckConfigCustomScheduling() }),
title: tr.deckConfigCustomScheduling(),
help: tr.deckConfigCustomSchedulingTooltip(),
url: "https://faqs.ankiweb.net/the-2021-scheduler.html#add-ons-and-custom-scheduling",
},
@ -139,7 +140,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
on:click={() =>
openHelpModal(Object.keys(settings).indexOf("fsrs"))}
>
{settings.fsrs.title}
<GlobalLabel title={settings.fsrs.title} />
</SettingTitle>
</SwitchRow>
</Item>

View file

@ -5,6 +5,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<script lang="ts">
import ConfigInput from "../components/ConfigInput.svelte";
import RevertButton from "../components/RevertButton.svelte";
import GlobalLabel from "./GlobalLabel.svelte";
export let value: string;
export let title: string;
@ -14,7 +15,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<ConfigInput>
<RevertButton slot="revert" bind:value defaultValue="" />
<details>
<summary>{title}</summary>
<summary><GlobalLabel {title} /></summary>
<div class="text">
<textarea
class="card-state-customizer form-control"

View file

@ -15,6 +15,7 @@
import SwitchRow from "../components/SwitchRow.svelte";
import TitledContainer from "../components/TitledContainer.svelte";
import type { HelpItem } from "../components/types";
import GlobalLabel from "./GlobalLabel.svelte";
import type { DeckOptionsState } from "./lib";
import { ValueTab } from "./lib";
import SpinBoxRow from "./SpinBoxRow.svelte";
@ -130,16 +131,13 @@
url: HelpPage.DeckOptions.maximumReviewsday,
},
newCardsIgnoreReviewLimit: {
title: tr.deckConfigAllDecks({
option: tr.deckConfigNewCardsIgnoreReviewLimit(),
}),
title: tr.deckConfigNewCardsIgnoreReviewLimit(),
help: newCardsIgnoreReviewLimitHelp,
url: HelpPage.DeckOptions.newCardsday,
},
applyAllParentLimits: {
title: tr.deckConfigAllDecks({
option: tr.deckConfigApplyAllParentLimits(),
}),
title: tr.deckConfigApplyAllParentLimits(),
help: applyAllParentLimitsHelp,
url: HelpPage.DeckOptions.newCardsday,
},
@ -203,7 +201,7 @@
Object.keys(settings).indexOf("newCardsIgnoreReviewLimit"),
)}
>
{settings.newCardsIgnoreReviewLimit.title}
<GlobalLabel title={settings.newCardsIgnoreReviewLimit.title} />
</SettingTitle>
</SwitchRow>
</Item>
@ -216,7 +214,7 @@
Object.keys(settings).indexOf("applyAllParentLimits"),
)}
>
{settings.applyAllParentLimits.title}
<GlobalLabel title={settings.applyAllParentLimits.title} />
</SettingTitle>
</SwitchRow>
</Item>

View file

@ -19,6 +19,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import SwitchRow from "components/SwitchRow.svelte";
import SettingTitle from "../components/SettingTitle.svelte";
import GlobalLabel from "./GlobalLabel.svelte";
import type { DeckOptionsState } from "./lib";
import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte";
import SpinBoxRow from "./SpinBoxRow.svelte";
@ -268,7 +269,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<div class="m-2">
<SwitchRow bind:value={$fsrsReschedule} defaultValue={false}>
<SettingTitle on:click={() => openHelpModal("rescheduleCardsOnChange")}>
{tr.deckConfigAllDecks({ option: tr.deckConfigRescheduleCardsOnChange() })}
<GlobalLabel title={tr.deckConfigRescheduleCardsOnChange()} />
</SettingTitle>
</SwitchRow>

View file

@ -0,0 +1,9 @@
<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
export let title: string;
</script>
{title} 🌐