aktueller stand

This commit is contained in:
torbinus
2026-09-17 16:02:51 +02:00
parent 7e51514383
commit 065cb8b64f
295 changed files with 642342 additions and 1059 deletions
+170 -9
View File
@@ -1,31 +1,47 @@
---
import { ClientRouter } from "astro:transitions";
import "../styles/global.css";
import Header from "../components/Header.astro";
import Footer from "../components/Footer.astro";
import { COMPANY_NAME, PRIMARY_DOMAIN, sections, resolveSection } from "../lib/sections";
import CookieNotice from "../components/CookieNotice.astro";
import SectionCurtain from "../components/SectionCurtain.astro";
import HhonigWelcome from "../components/HhonigWelcome.astro";
import SecondHeader from "../components/SecondHeader.astro";
import Vertrauensleiste from "../components/Vertrauensleiste.astro";
import { COMPANY_NAME, PRIMARY_DOMAIN, layers, resolveLayer } from "../lib/sections";
interface Props {
title: string;
description: string;
image?: string;
/**
* Wie hell der obere Rand der Seite ist. Der Header schwebt darüber —
* über einem dunklen Foto muss seine Schrift weiß werden, sonst liegt sie
* unlesbar darauf. Standard ist hell, weil die meisten Seiten oben eine
* helle Fläche haben.
*/
heroTone?: "light" | "dark";
}
const { title, description, image } = Astro.props;
const { title, description, image, heroTone = "light" } = Astro.props;
const pathname = Astro.url.pathname;
// Host only matters to resolve the bare "/" root; every other path is
// resolved from the pathname alone, so skip touching request headers there
// (they aren't available on statically prerendered pages).
const hostname = pathname === "/" ? Astro.request.headers.get("host") ?? Astro.url.hostname : "";
const section = resolveSection(pathname, hostname);
const layer = resolveLayer(pathname, hostname);
// Nur die Shop-Ebene braucht ihn, aber gelesen wird er hier: Cookies stehen
// im Layout zur Verfügung, in der Leiste darunter nicht mehr zuverlässig.
const isLoggedIn = Boolean(Astro.cookies.get("customer_jwt")?.value);
// "/" mirrors different content per host; canonicalize it to the matching
// stable section path so both domains consolidate onto one indexable URL.
const canonicalPath = pathname === "/" ? sections[section].homeHref : pathname;
const canonicalPath = pathname === "/" ? layers[layer].homeHref : pathname;
const canonicalUrl = new URL(canonicalPath, PRIMARY_DOMAIN).toString();
---
<html lang="de" data-section={section}>
<html lang="de" data-layer={layer} data-hero={heroTone}>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
@@ -40,12 +56,157 @@ const canonicalUrl = new URL(canonicalPath, PRIMARY_DOMAIN).toString();
<meta property="og:url" content={canonicalUrl} />
{image && <meta property="og:image" content={image} />}
<meta name="twitter:card" content="summary_large_image" />
<!-- Seitenwechsel als View Transition statt hartem Neuaufbau. -->
<ClientRouter />
</head>
<body class="min-h-screen flex flex-col bg-white text-brand-body antialiased">
<Header section={section} />
<main class="flex-1">
<body class="min-h-screen flex flex-col text-brand-body antialiased">
<a href="#inhalt" class="skip-link">Zum Inhalt springen</a>
<!-- Nullhoher Marker: verlässt er den Viewport, ist die Seite gescrollt.
Der Header beobachtet ihn, statt auf jedes Scroll-Event zu horchen. -->
<div id="scroll-sentinel" aria-hidden="true"></div>
<div class="grain" aria-hidden="true"></div>
<div class="floating-bees" aria-hidden="true">
<div class="bee bee-1"><img src="/images/bee-single.png" alt="" width="40" /></div>
<div class="bee bee-2"><img src="/images/bee-single.png" alt="" width="32" /></div>
<div class="bee bee-3"><img src="/images/bee-single.png" alt="" width="36" /></div>
</div>
<Header layer={layer} />
{layer !== "site" && <SecondHeader layer={layer} loggedIn={isLoggedIn} />}
{layer === "shop" && <Vertrauensleiste />}
<main id="inhalt" class="flex-1">
<slot />
</main>
<Footer section={section} />
<Footer layer={layer} />
<CookieNotice />
<SectionCurtain />
<HhonigWelcome />
<script>
// astro:page-load feuert beim ersten Laden UND nach jedem
// View-Transition-Wechsel — sonst blieben Reveals nach einer
// Navigation dauerhaft unsichtbar.
document.addEventListener("astro:page-load", () => {
const revealObserver = new IntersectionObserver(
(entries) => {
for (const entry of entries) {
if (entry.isIntersecting) {
entry.target.classList.add("visible");
revealObserver.unobserve(entry.target);
}
}
},
{ threshold: 0.1, rootMargin: "0px 0px -60px 0px" }
);
const revealEls = document.querySelectorAll(".reveal");
// Was beim Aufbau schon im Bild steht, darf nicht erst von unten
// hereinfahren. Die Seite baut in diesem Moment ohnehin noch auf, und
// die Verschiebung liest sich dann nicht als Aufbau, sondern als
// Sprung. Diese Elemente blenden nur auf — der zeitliche Versatz
// bleibt, die Bewegung entfällt. Alles, was erst hereingescrollt
// wird, behält den vollen Reveal.
for (const el of revealEls) {
if (el.getBoundingClientRect().top < window.innerHeight) {
el.classList.add("reveal-settled");
}
}
revealEls.forEach((el) => revealObserver.observe(el));
// Safety net: a fast jump-scroll (End key, anchor link, etc.) can skip
// straight past an element without ever putting it in the viewport, so
// the observer never fires for it and it would stay invisible forever.
// Force-reveal anything still hidden after a short delay.
setTimeout(() => {
revealEls.forEach((el) => el.classList.add("visible"));
}, 1500);
});
</script>
<script>
// Große Display-Headlines wortweise aufbauen. Der Text wird erst hier
// zerlegt — ohne JS bleibt die Headline vollständig und sichtbar.
document.addEventListener("astro:page-load", () => {
for (const el of document.querySelectorAll<HTMLElement>(".display-xl")) {
if (el.querySelector(".word")) continue;
// Gesetzte Zeilenumbrüche bleiben erhalten: über textContent zu
// gehen würde jedes <br> verschlucken und den Claim zu einem
// einzigen Fließtext zusammenziehen.
const tokens: (string | "br")[] = [];
for (const node of Array.from(el.childNodes)) {
if (node.nodeName === "BR") {
tokens.push("br");
} else {
for (const word of (node.textContent ?? "").trim().split(/\s+/)) {
if (word) tokens.push(word);
}
}
}
if (tokens.filter((t) => t !== "br").length < 2) continue;
el.textContent = "";
let i = 0;
tokens.forEach((token, index) => {
if (token === "br") {
el.append(document.createElement("br"));
return;
}
const span = document.createElement("span");
span.className = "word";
span.style.setProperty("--i", String(i++));
span.textContent = token;
if (tokens[index + 1] && tokens[index + 1] !== "br") el.append(span, " ");
else el.append(span);
});
el.classList.add("word-stagger");
}
});
</script>
<script>
// Count-up numbers: data-count-to holds the target integer, the
// element's own text supplies the formatting (e.g. "950.000" or
// "2,5 Mio.") which we only overwrite once the count reaches its
// final frame, so a slow network/JS delay never shows a stuck "0".
document.addEventListener("astro:page-load", () => {
const countEls = Array.from(document.querySelectorAll<HTMLElement>("[data-count-to]"));
const reduceMotionCount = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const countObserver = new IntersectionObserver(
(entries) => {
for (const entry of entries) {
if (!entry.isIntersecting) continue;
const el = entry.target as HTMLElement;
countObserver.unobserve(el);
const target = Number(el.dataset.countTo);
const finalText = el.textContent ?? "";
if (reduceMotionCount || !Number.isFinite(target)) continue;
const duration = 1400;
const start = performance.now();
const format = (value: number) => Math.round(value).toLocaleString("de-DE");
function tick(now: number) {
const elapsed = Math.min((now - start) / duration, 1);
const eased = 1 - Math.pow(1 - elapsed, 3);
el.textContent = format(target * eased);
if (elapsed < 1) {
requestAnimationFrame(tick);
} else {
el.textContent = finalText;
}
}
requestAnimationFrame(tick);
}
},
{ threshold: 0.5 }
);
countEls.forEach((el) => countObserver.observe(el));
});
</script>
</body>
</html>