Two things reported from use. The topbar dropdowns shifted the whole page on click. reka's DropdownMenu is modal by default, which locks body scroll; losing the scrollbar widens the layout by its width (measured: 15px at 1440), so everything moved sideways. It also blocked clicking the page while a menu was open. Non-modal is now the default for every dropdown, not just the nav's: a menu is not a dialog. Hover descriptions became a preference on /system/appearance, applied in the Tooltip primitive so a tooltip added later honours it without each call site remembering. On by default; nothing depends on a tooltip to be usable. Appearance also lost its duplicated copy: the page, its first card, and that card's field each said "Appearance" or "Theme" in turn.
27 lines
770 B
TypeScript
27 lines
770 B
TypeScript
import { ref, type Ref } from "vue";
|
|
|
|
export const TOOLTIPS_KEY = "archie.tooltips";
|
|
export function storedTooltips(): boolean {
|
|
try {
|
|
return localStorage.getItem(TOOLTIPS_KEY) !== "off";
|
|
} catch {
|
|
// Private windows and blocked site data throw on access. On is the
|
|
// default, so this is not worth surfacing.
|
|
return true;
|
|
}
|
|
}
|
|
|
|
const current = ref<boolean>(storedTooltips());
|
|
|
|
/** The live preference, shared app-wide. Change it through `setTooltips`. */
|
|
export const tooltipsEnabled: Ref<boolean> = current;
|
|
|
|
export function setTooltips(enabled: boolean): void {
|
|
current.value = enabled;
|
|
try {
|
|
localStorage.setItem(TOOLTIPS_KEY, enabled ? "on" : "off");
|
|
} catch {
|
|
// Still applies for this page view; only persistence is lost.
|
|
}
|
|
}
|