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:
@@ -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
15
src/stores/popup.ts
Normal 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
|
||||
);
|
||||
Reference in New Issue
Block a user