diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index 6ed7abc..365aabf 100644 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -8,9 +8,18 @@ import '@fontsource/open-sans/600.css'; import '../styles/global.css'; import Header from '../components/Header.astro'; import Footer from '../components/Footer.astro'; +import { getDb } from '../lib/db'; +import { getSessionUser, SESSION_COOKIE } from '../lib/auth'; interface Props { title: string; description?: string } const { title, description = 'InsanityLab — Performance. Balance. Longevity. Allenamento personalizzato, piccoli gruppi e benessere a Bologna.' } = Astro.props; + +// Overlay annotate: badge coi tag contenuto, solo per utenti loggati con ?annotate=1. +let annotate = false; +if (Astro.url.searchParams.get('annotate') === '1') { + const tok = Astro.cookies.get(SESSION_COOKIE)?.value; + annotate = Boolean(tok && getSessionUser(getDb(), tok)); +} --- @@ -65,5 +74,31 @@ const { title, description = 'InsanityLab — Performance. Balance. Longevity. A update(); } + {annotate && ( + + + )}