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 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 ## Top section
# Used in the deck configuration screen to show how many decks are used # 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 { type HelpItem, HelpItemScheduler } from "../components/types";
import CardStateCustomizer from "./CardStateCustomizer.svelte"; import CardStateCustomizer from "./CardStateCustomizer.svelte";
import FsrsOptions from "./FsrsOptions.svelte"; import FsrsOptions from "./FsrsOptions.svelte";
import GlobalLabel from "./GlobalLabel.svelte";
import type { DeckOptionsState } from "./lib"; import type { DeckOptionsState } from "./lib";
import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte"; import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte";
import SpinBoxRow from "./SpinBoxRow.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 = { const settings = {
fsrs: { fsrs: {
title: tr.deckConfigAllDecks({ option: "FSRS" }), title: "FSRS",
help: tr.deckConfigFsrsTooltip(), help: tr.deckConfigFsrsTooltip(),
url: HelpPage.DeckOptions.fsrs, 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, sched: HelpItemScheduler.SM2,
}, },
customScheduling: { customScheduling: {
title: tr.deckConfigAllDecks({ option: tr.deckConfigCustomScheduling() }), title: tr.deckConfigCustomScheduling(),
help: tr.deckConfigCustomSchedulingTooltip(), help: tr.deckConfigCustomSchedulingTooltip(),
url: "https://faqs.ankiweb.net/the-2021-scheduler.html#add-ons-and-custom-scheduling", 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={() => on:click={() =>
openHelpModal(Object.keys(settings).indexOf("fsrs"))} openHelpModal(Object.keys(settings).indexOf("fsrs"))}
> >
{settings.fsrs.title} <GlobalLabel title={settings.fsrs.title} />
</SettingTitle> </SettingTitle>
</SwitchRow> </SwitchRow>
</Item> </Item>

View file

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

View file

@ -15,6 +15,7 @@
import SwitchRow from "../components/SwitchRow.svelte"; import SwitchRow from "../components/SwitchRow.svelte";
import TitledContainer from "../components/TitledContainer.svelte"; import TitledContainer from "../components/TitledContainer.svelte";
import type { HelpItem } from "../components/types"; import type { HelpItem } from "../components/types";
import GlobalLabel from "./GlobalLabel.svelte";
import type { DeckOptionsState } from "./lib"; import type { DeckOptionsState } from "./lib";
import { ValueTab } from "./lib"; import { ValueTab } from "./lib";
import SpinBoxRow from "./SpinBoxRow.svelte"; import SpinBoxRow from "./SpinBoxRow.svelte";
@ -130,16 +131,13 @@
url: HelpPage.DeckOptions.maximumReviewsday, url: HelpPage.DeckOptions.maximumReviewsday,
}, },
newCardsIgnoreReviewLimit: { newCardsIgnoreReviewLimit: {
title: tr.deckConfigAllDecks({ title: tr.deckConfigNewCardsIgnoreReviewLimit(),
option: tr.deckConfigNewCardsIgnoreReviewLimit(),
}),
help: newCardsIgnoreReviewLimitHelp, help: newCardsIgnoreReviewLimitHelp,
url: HelpPage.DeckOptions.newCardsday, url: HelpPage.DeckOptions.newCardsday,
}, },
applyAllParentLimits: { applyAllParentLimits: {
title: tr.deckConfigAllDecks({ title: tr.deckConfigApplyAllParentLimits(),
option: tr.deckConfigApplyAllParentLimits(),
}),
help: applyAllParentLimitsHelp, help: applyAllParentLimitsHelp,
url: HelpPage.DeckOptions.newCardsday, url: HelpPage.DeckOptions.newCardsday,
}, },
@ -203,7 +201,7 @@
Object.keys(settings).indexOf("newCardsIgnoreReviewLimit"), Object.keys(settings).indexOf("newCardsIgnoreReviewLimit"),
)} )}
> >
{settings.newCardsIgnoreReviewLimit.title} <GlobalLabel title={settings.newCardsIgnoreReviewLimit.title} />
</SettingTitle> </SettingTitle>
</SwitchRow> </SwitchRow>
</Item> </Item>
@ -216,7 +214,7 @@
Object.keys(settings).indexOf("applyAllParentLimits"), Object.keys(settings).indexOf("applyAllParentLimits"),
)} )}
> >
{settings.applyAllParentLimits.title} <GlobalLabel title={settings.applyAllParentLimits.title} />
</SettingTitle> </SettingTitle>
</SwitchRow> </SwitchRow>
</Item> </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 SwitchRow from "components/SwitchRow.svelte";
import SettingTitle from "../components/SettingTitle.svelte"; import SettingTitle from "../components/SettingTitle.svelte";
import GlobalLabel from "./GlobalLabel.svelte";
import type { DeckOptionsState } from "./lib"; import type { DeckOptionsState } from "./lib";
import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte"; import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte";
import SpinBoxRow from "./SpinBoxRow.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"> <div class="m-2">
<SwitchRow bind:value={$fsrsReschedule} defaultValue={false}> <SwitchRow bind:value={$fsrsReschedule} defaultValue={false}>
<SettingTitle on:click={() => openHelpModal("rescheduleCardsOnChange")}> <SettingTitle on:click={() => openHelpModal("rescheduleCardsOnChange")}>
{tr.deckConfigAllDecks({ option: tr.deckConfigRescheduleCardsOnChange() })} <GlobalLabel title={tr.deckConfigRescheduleCardsOnChange()} />
</SettingTitle> </SettingTitle>
</SwitchRow> </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} 🌐