Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 1x 4x 4x 4x 4x 2x 2x 2x 4x | "use client";
import { useEffect, useState } from "react";
import { ExternalLink, Moon } from "lucide-react";
import {
STATIC_SITE_URL,
nextOpening,
staticSiteUrl,
} from "@/lib/offline-mode";
import { useT } from "@/lib/i18n/translate";
/**
* The off-hours notice (ADR-053). It reads the address bar, not a query
* parameter, because the middleware rewrites the visitor's own URL to
* /offline; the time is formatted in the browser, in the visitor's zone.
*/
export default function OfflineNotice() {
const t = useT("admin");
const [target, setTarget] = useState(`${STATIC_SITE_URL}/`);
const [opening, setOpening] = useState<string | null>(null);
useEffect(() => {
const { pathname, search } = window.location;
setTarget(staticSiteUrl(`${pathname}${search}`));
setOpening(
new Intl.DateTimeFormat(undefined, {
weekday: "long",
hour: "2-digit",
minute: "2-digit",
timeZoneName: "short",
}).format(nextOpening(new Date())),
);
}, []);
return (
<div className="min-h-[60vh] flex items-center justify-center">
<section
role="status"
aria-labelledby="offline-title"
data-testid="offline-notice"
className="bg-(--surface-2) rounded-lg p-8 max-w-lg w-full mx-4 text-center"
>
<Moon size={48} className="mx-auto mb-4 text-amber-400" />
<h1 id="offline-title" className="text-2xl font-bold mb-2">
{t("The live demo is offline outside office hours")}
</h1>
<p className="text-(--text-secondary) mb-2">
{t(
"To save running costs, the live dataspace and its databases are stopped every evening, at weekends and on Berlin public holidays. It runs on weekdays from about 07:30 to 20:15 Berlin time in summer and from about 06:30 to 19:15 in winter.",
)}
</p>
<p
className="text-(--text-secondary) mb-6"
data-testid="offline-opening"
>
{opening
? t("Back on {opening}.", { opening })
: t("Back on the next working day.")}
</p>
<a
href={target}
data-testid="offline-static-link"
className="inline-flex items-center gap-2 px-4 py-2 bg-teal-700 hover:bg-teal-600 text-white rounded-lg font-medium transition-colors"
>
{t("Open this page in the static demo")}
<ExternalLink size={16} aria-hidden="true" />
</a>
<p className="text-xs text-(--text-secondary) mt-4">
{t(
"The static demo is always available. It has the same pages with synthetic data and a persona picker in place of sign-in.",
)}
</p>
</section>
</div>
);
}
|