- The timeline's ngu-tl classes and keyframes are site-tl; nguLogo is siteLogo; the event card's ngu grid area is org; window.__NGU_SITE__ is window.__SITE__; QR downloads are qr-<page>.png - Browser keys (theme, closed banner and privacy notice, chunk reload) start site-; the page's first script moves any old ngu- values over once, so nobody loses their theme or sees a closed notice again - Session and Google sign-in cookies are site_session and site_oauth (__Host- over https); everyone signs in again once Record ids, server paths, the service and the database file keep their names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import { X } from "@phosphor-icons/react";
|
|
import { useState, useEffect } from "react";
|
|
import { Link } from "react-router-dom";
|
|
import { SITE_BANNER } from "../data/bannerConfig.ts";
|
|
|
|
export default function Banner() {
|
|
const [visible, setVisible] = useState(false);
|
|
const storageKey = `site-banner-dismissed:${SITE_BANNER.id}`;
|
|
|
|
useEffect(() => {
|
|
if (!SITE_BANNER.enabled) return;
|
|
if (!SITE_BANNER.dismissible) return setVisible(true);
|
|
try {
|
|
if (!localStorage.getItem(storageKey)) setVisible(true);
|
|
} catch {
|
|
setVisible(true); // storage blocked, show it anyway
|
|
}
|
|
}, [storageKey]);
|
|
|
|
const dismiss = () => {
|
|
setVisible(false);
|
|
try { localStorage.setItem(storageKey, "1"); } catch {}
|
|
};
|
|
|
|
if (!visible) return null;
|
|
|
|
const linkClass =
|
|
"underline underline-offset-4 decoration-[#aac992] hover:text-white transition-colors";
|
|
|
|
return (
|
|
<div
|
|
className="relative w-full px-12 py-2.5 text-center"
|
|
style={{ background: "rgba(0, 47, 57, 0.95)" }}
|
|
role="region"
|
|
aria-label="Site announcement"
|
|
>
|
|
<p className="text-sm text-white/85">
|
|
{SITE_BANNER.content.map((part, i) => {
|
|
if (!part.href) return <span key={i}>{part.text}</span>;
|
|
return part.external ? (
|
|
<a key={i} href={part.href} target="_blank" rel="noopener noreferrer" className={linkClass}>
|
|
{part.text}
|
|
</a>
|
|
) : (
|
|
<Link key={i} to={part.href} className={linkClass}>
|
|
{part.text}
|
|
</Link>
|
|
);
|
|
})}
|
|
</p>
|
|
|
|
{SITE_BANNER.dismissible && (
|
|
<button
|
|
onClick={dismiss}
|
|
aria-label="Dismiss announcement"
|
|
className="absolute right-3 top-1/2 -translate-y-1/2 p-1.5 rounded-md text-white/50 hover:text-white hover:bg-white/10 transition-colors"
|
|
>
|
|
<X className="w-4 h-4" weight="bold" aria-hidden="true" />
|
|
</button>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|