Feat/Add globe to help tooltip (#4148)

* Add global option to HelpItem

* Fix: Spacing

* add to more sections

* Fix: Spacing again
This commit is contained in:
Luc Mcgrady 2025-07-04 08:42:40 +01:00 committed by GitHub
parent 0b5218706a
commit 4232185735
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 1 deletions

View file

@ -8,6 +8,8 @@
import Row from "./Row.svelte"; import Row from "./Row.svelte";
import type { HelpItem } from "./types"; import type { HelpItem } from "./types";
import { mdiEarth } from "./icons";
import Icon from "./Icon.svelte";
export let item: HelpItem; export let item: HelpItem;
</script> </script>
@ -21,6 +23,11 @@
{/if} {/if}
</h2> </h2>
{#if item.help} {#if item.help}
{#if item.global}
<div class="icon">
<Icon icon={mdiEarth} />
</div>
{/if}
{@html renderMarkdown(item.help)} {@html renderMarkdown(item.help)}
{:else} {:else}
{@html renderMarkdown( {@html renderMarkdown(
@ -54,4 +61,12 @@
color: var(--fg-subtle); color: var(--fg-subtle);
font-size: small; font-size: small;
} }
.icon {
display: inline-block;
width: 1em;
fill: currentColor;
margin-right: 0.25em;
margin-bottom: 1.25em;
}
</style> </style>

View file

@ -9,6 +9,7 @@ export type HelpItem = {
help?: string; help?: string;
url?: string; url?: string;
sched?: HelpItemScheduler; sched?: HelpItemScheduler;
global?: boolean;
}; };
export enum HelpItemScheduler { export enum HelpItemScheduler {

View file

@ -82,6 +82,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
title: 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",
global: true,
}, },
}; };
const helpSections: HelpItem[] = Object.values(settings); const helpSections: HelpItem[] = Object.values(settings);

View file

@ -133,14 +133,15 @@
}, },
newCardsIgnoreReviewLimit: { newCardsIgnoreReviewLimit: {
title: tr.deckConfigNewCardsIgnoreReviewLimit(), title: tr.deckConfigNewCardsIgnoreReviewLimit(),
help: newCardsIgnoreReviewLimitHelp, help: newCardsIgnoreReviewLimitHelp,
url: HelpPage.DeckOptions.newCardsday, url: HelpPage.DeckOptions.newCardsday,
global: true,
}, },
applyAllParentLimits: { applyAllParentLimits: {
title: tr.deckConfigApplyAllParentLimits(), title: tr.deckConfigApplyAllParentLimits(),
help: applyAllParentLimitsHelp, help: applyAllParentLimitsHelp,
url: HelpPage.DeckOptions.newCardsday, url: HelpPage.DeckOptions.newCardsday,
global: true,
}, },
}; };
const helpSections: HelpItem[] = Object.values(settings); const helpSections: HelpItem[] = Object.values(settings);

View file

@ -35,6 +35,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
title: "FSRS", title: "FSRS",
help: tr.deckConfigFsrsTooltip(), help: tr.deckConfigFsrsTooltip(),
url: HelpPage.DeckOptions.fsrs, url: HelpPage.DeckOptions.fsrs,
global: true,
}, },
desiredRetention: { desiredRetention: {
title: tr.deckConfigDesiredRetention(), title: tr.deckConfigDesiredRetention(),
@ -56,6 +57,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
title: tr.deckConfigRescheduleCardsOnChange(), title: tr.deckConfigRescheduleCardsOnChange(),
help: tr.deckConfigRescheduleCardsOnChangeTooltip(), help: tr.deckConfigRescheduleCardsOnChangeTooltip(),
sched: HelpItemScheduler.FSRS, sched: HelpItemScheduler.FSRS,
global: true,
}, },
computeOptimalRetention: { computeOptimalRetention: {
title: tr.deckConfigComputeOptimalRetention(), title: tr.deckConfigComputeOptimalRetention(),
@ -65,10 +67,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
healthCheck: { healthCheck: {
title: tr.deckConfigHealthCheck(), title: tr.deckConfigHealthCheck(),
help: help:
tr.deckConfigAffectsEntireCollection() +
"\n\n" +
tr.deckConfigHealthCheckTooltip1() + tr.deckConfigHealthCheckTooltip1() +
"\n\n" + "\n\n" +
tr.deckConfigHealthCheckTooltip2(), tr.deckConfigHealthCheckTooltip2(),
sched: HelpItemScheduler.FSRS, sched: HelpItemScheduler.FSRS,
global: true,
}, },
}; };
const helpSections: HelpItem[] = Object.values(settings); const helpSections: HelpItem[] = Object.values(settings);