1
0
mirror of https://github.com/koloml/furbooru-tagging-assistant.git synced 2026-02-06 23:32:58 +00:00

Added the store for dynamically changing the popup titles

This commit is contained in:
2026-01-09 05:27:48 +04:00
parent 5fd6dee999
commit 70129d7a0e
2 changed files with 20 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
import Footer from "$components/layout/Footer.svelte";
import { initializeLinksReplacement } from "$lib/popup-links";
import { onDestroy } from "svelte";
import { headTitle } from "$stores/popup";
interface Props {
children?: import('svelte').Snippet;
@@ -22,6 +23,10 @@
})
</script>
<svelte:head>
<title>{$headTitle}</title>
</svelte:head>
<Header/>
<main>
{@render children?.()}

15
src/stores/popup.ts Normal file
View File

@@ -0,0 +1,15 @@
import { derived, writable } from "svelte/store";
import { PLUGIN_NAME } from "$lib/constants";
/**
* Store containing the name of the subpage. This name will be added to the title alongside the name of the plugin.
*/
export const popupTitle = writable<string | null>(null);
/**
* Name of the current route with the name of the plugin appended to it.
*/
export const headTitle = derived(
popupTitle,
$popupTitle => ($popupTitle ? `${$popupTitle} | ` : '') + PLUGIN_NAME
);