From 42321857358247cea1fd9611c58262ed2c6eb54f Mon Sep 17 00:00:00 2001 From: Luc Mcgrady Date: Fri, 4 Jul 2025 08:42:40 +0100 Subject: [PATCH] Feat/Add globe to help tooltip (#4148) * Add global option to HelpItem * Fix: Spacing * add to more sections * Fix: Spacing again --- ts/lib/components/HelpSection.svelte | 15 +++++++++++++++ ts/lib/components/types.ts | 1 + ts/routes/deck-options/AdvancedOptions.svelte | 1 + ts/routes/deck-options/DailyLimits.svelte | 3 ++- ts/routes/deck-options/FsrsOptionsOuter.svelte | 5 +++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ts/lib/components/HelpSection.svelte b/ts/lib/components/HelpSection.svelte index 71b45fb6c..b52486865 100644 --- a/ts/lib/components/HelpSection.svelte +++ b/ts/lib/components/HelpSection.svelte @@ -8,6 +8,8 @@ import Row from "./Row.svelte"; import type { HelpItem } from "./types"; + import { mdiEarth } from "./icons"; + import Icon from "./Icon.svelte"; export let item: HelpItem; @@ -21,6 +23,11 @@ {/if} {#if item.help} + {#if item.global} +
+ +
+ {/if} {@html renderMarkdown(item.help)} {:else} {@html renderMarkdown( @@ -54,4 +61,12 @@ color: var(--fg-subtle); font-size: small; } + + .icon { + display: inline-block; + width: 1em; + fill: currentColor; + margin-right: 0.25em; + margin-bottom: 1.25em; + } diff --git a/ts/lib/components/types.ts b/ts/lib/components/types.ts index 9a2105d9e..2f94a2778 100644 --- a/ts/lib/components/types.ts +++ b/ts/lib/components/types.ts @@ -9,6 +9,7 @@ export type HelpItem = { help?: string; url?: string; sched?: HelpItemScheduler; + global?: boolean; }; export enum HelpItemScheduler { diff --git a/ts/routes/deck-options/AdvancedOptions.svelte b/ts/routes/deck-options/AdvancedOptions.svelte index 31c3f0d4c..fb892b7ec 100644 --- a/ts/routes/deck-options/AdvancedOptions.svelte +++ b/ts/routes/deck-options/AdvancedOptions.svelte @@ -82,6 +82,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html title: tr.deckConfigCustomScheduling(), help: tr.deckConfigCustomSchedulingTooltip(), url: "https://faqs.ankiweb.net/the-2021-scheduler.html#add-ons-and-custom-scheduling", + global: true, }, }; const helpSections: HelpItem[] = Object.values(settings); diff --git a/ts/routes/deck-options/DailyLimits.svelte b/ts/routes/deck-options/DailyLimits.svelte index 9b156ca00..ea403c1f4 100644 --- a/ts/routes/deck-options/DailyLimits.svelte +++ b/ts/routes/deck-options/DailyLimits.svelte @@ -133,14 +133,15 @@ }, newCardsIgnoreReviewLimit: { title: tr.deckConfigNewCardsIgnoreReviewLimit(), - help: newCardsIgnoreReviewLimitHelp, url: HelpPage.DeckOptions.newCardsday, + global: true, }, applyAllParentLimits: { title: tr.deckConfigApplyAllParentLimits(), help: applyAllParentLimitsHelp, url: HelpPage.DeckOptions.newCardsday, + global: true, }, }; const helpSections: HelpItem[] = Object.values(settings); diff --git a/ts/routes/deck-options/FsrsOptionsOuter.svelte b/ts/routes/deck-options/FsrsOptionsOuter.svelte index 89f44e0d3..fa543b5fc 100644 --- a/ts/routes/deck-options/FsrsOptionsOuter.svelte +++ b/ts/routes/deck-options/FsrsOptionsOuter.svelte @@ -35,6 +35,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html title: "FSRS", help: tr.deckConfigFsrsTooltip(), url: HelpPage.DeckOptions.fsrs, + global: true, }, desiredRetention: { title: tr.deckConfigDesiredRetention(), @@ -56,6 +57,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html title: tr.deckConfigRescheduleCardsOnChange(), help: tr.deckConfigRescheduleCardsOnChangeTooltip(), sched: HelpItemScheduler.FSRS, + global: true, }, computeOptimalRetention: { title: tr.deckConfigComputeOptimalRetention(), @@ -65,10 +67,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html healthCheck: { title: tr.deckConfigHealthCheck(), help: + tr.deckConfigAffectsEntireCollection() + + "\n\n" + tr.deckConfigHealthCheckTooltip1() + "\n\n" + tr.deckConfigHealthCheckTooltip2(), sched: HelpItemScheduler.FSRS, + global: true, }, }; const helpSections: HelpItem[] = Object.values(settings);