Use the Site design logo as the favicon (site and admin) #11

Merged
reudy merged 2 commits from logo-favicon into main 2026-10-26 14:20:07 +01:00
2 changed files with 9 additions and 2 deletions
Showing only changes of commit 745cd24562 - Show all commits

View file

@ -13,10 +13,15 @@ async function getGlobal(pb: App.Locals['pb'], key: string, fallback: unknown) {
} }
export const load: LayoutServerLoad = async ({ locals }) => { export const load: LayoutServerLoad = async ({ locals }) => {
const colors = await getGlobal(locals.pb, 'colors', defaultColors); const [colors, header] = await Promise.all([
getGlobal(locals.pb, 'colors', defaultColors),
getGlobal(locals.pb, 'header', {}) as Promise<{ logo?: { url?: string } }>
]);
return { return {
user: locals.user, user: locals.user,
colors, colors,
// The site's logo is the admin's tab icon too (same as the public site).
logoUrl: header?.logo?.url || '',
// Admin dates/times are entered and shown in the site's timezone, and // Admin dates/times are entered and shown in the site's timezone, and
// prices in the shop currency — same settings the booking emails use. // prices in the shop currency — same settings the booking emails use.
timezone: env.SITE_TIMEZONE || 'Europe/Oslo', timezone: env.SITE_TIMEZONE || 'Europe/Oslo',

View file

@ -13,8 +13,10 @@
import { page } from '$app/state'; import { page } from '$app/state';
import { createBasketStore, setBasketContext } from '$lib/basket.svelte'; import { createBasketStore, setBasketContext } from '$lib/basket.svelte';
import { brandThemeVars, rootStyleTag } from '$shared/theme'; import { brandThemeVars, rootStyleTag } from '$shared/theme';
import { thumbUrl } from '$shared/pb';
let { children, data } = $props(); let { children, data } = $props();
let icon = $derived(data.logoUrl ? thumbUrl(data.logoUrl) : favicon);
// Routes rendered without the admin shell: the login screen, and the // Routes rendered without the admin shell: the login screen, and the
// preview iframe (which must look like the public site, not the admin). // preview iframe (which must look like the public site, not the admin).
@ -67,7 +69,7 @@
</script> </script>
<svelte:head> <svelte:head>
<link rel="icon" href={favicon} /> <link rel="icon" href={icon} />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Admin buttons/highlights use the site's Primary and Accent colours (sanitised; readable text picked automatically). --> <!-- Admin buttons/highlights use the site's Primary and Accent colours (sanitised; readable text picked automatically). -->
{@html rootStyleTag(brandThemeVars(data.colors))} {@html rootStyleTag(brandThemeVars(data.colors))}