chore(repo): sync wireframe structure and references

This commit is contained in:
david committed 2026-08-08 03:09:06 +02:00
1 parent 05d2d5777f
commit d953a79e95
453 files changed
+36639 -621

No files matched your search

@@ -0,0 +1,99 @@
import { ShieldCheck, Smartphone, Zap, Headphones } from "lucide-react";
import { CHAMFER } from "@/lib/chamfer";
const advantages = [
{
icon: ShieldCheck,
title: "DSGVO-konform",
desc: "Alle Daten werden ausschließlich auf deutschen Servern gehostet. Wir erfüllen alle Datenschutzanforderungen, ohne dass Sie sich darum kümmern müssen.",
},
{
icon: Smartphone,
title: "Überall verfügbar",
desc: "Im Büro, auf der Baustelle oder unterwegs: HiveGrid läuft auf jedem Gerät. Responsive Design für Desktop, Tablet und Smartphone.",
},
{
icon: Zap,
title: "Schnelle Einrichtung",
desc: "In unter 5 Minuten ist Ihr Betrieb digital aufgestellt. Keine IT-Abteilung nötig, keine komplizierte Installation. Einfach registrieren und loslegen.",
},
{
icon: Headphones,
title: "Persönlicher Support",
desc: "Bei uns sprechen Sie mit echten Menschen, nicht mit Chatbots. Unser Support-Team kennt die Branche und hilft Ihnen schnell und kompetent weiter.",
},
];
export default function AdvantagesSection() {
return (
<section
className="section-full"
style={{ background: "var(--surface)", paddingBlock: 80 }}
>
<div
className="flex flex-col gap-10 mx-auto"
style={{ maxWidth: "var(--content-width)" }}
>
{/* Header */}
<div className="flex flex-col items-center gap-4 text-center">
<span
className="text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5"
style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}
>
VORTEILE
</span>
<h2
className="text-[32px] md:text-[42px] font-bold leading-[1.15]"
style={{ color: "var(--text-primary)" }}
>
Warum SHK-Betriebe HiveGrid wählen.
</h2>
</div>
{/* Cards */}
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6">
{advantages.map(({ icon: Icon, title, desc }) => (
<div
key={title}
className="flex flex-col gap-4"
style={{ background: "var(--container-bg)", padding: 28, clipPath: CHAMFER }}
>
<Icon size={32} style={{ color: "var(--accent-yellow)" }} strokeWidth={1.75} />
<h3 className="text-[18px] font-semibold" style={{ color: "var(--text-primary)" }}>
{title}
</h3>
<p
className="text-[14px] leading-relaxed flex-1"
style={{ color: "var(--text-secondary)" }}
>
{desc}
</p>
</div>
))}
</div>
{/* heyData DSGVO seal */}
<div className="flex flex-col items-center gap-3 pt-2">
<a
href="https://heydata.eu"
target="_blank"
rel="noopener noreferrer"
title="heyData GDPR seal"
>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
alt="heyData DSGVO-Siegel"
src="https://api.heydata.eu/privacy-seal/seal/2cdc4714-a706-4790-975c-7c95935905fe?lang=de&design=design1&sealType=GDPR"
width={140}
height={140}
style={{ border: 0 }}
/>
</a>
<p className="text-[13px]" style={{ color: "var(--text-tertiary)" }}>
Geprüft und zertifiziert durch heyData
</p>
</div>
</div>
</section>
);
}
@@ -0,0 +1,198 @@
"use client";
import { useState } from "react";
import { Check, X, Palmtree, House, Receipt, Clock, RotateCcw, Inbox } from "lucide-react";
import CanvasHint, { useCanvasHint } from "@/components/ui/CanvasHint";
/* ──────────────────────────────────────────────────────────────────────────
* ApprovalInbox — interactive centrepiece for the mitarbeitermanagement page.
* The team's open requests (Urlaub, Homeoffice, Spesen …); approve or reject
* each one — the card gets a status stamp and slides out, the counter ticks
* down, and an empty state lets you replay. Brand-styled.
* ────────────────────────────────────────────────────────────────────────── */
type Status = "pending" | "approved" | "rejected";
type Request = {
id: string;
name: string;
initials: string;
color: string;
typeLabel: string;
detail: string;
Icon: typeof Palmtree;
};
const INITIAL: Request[] = [
{ id: "r1", name: "Lena Krause", initials: "LK", color: "#0D6E6E", typeLabel: "Urlaubsantrag", detail: "12.–19. Juli · 6 Tage", Icon: Palmtree },
{ id: "r2", name: "Tom Berger", initials: "TB", color: "#3B82F6", typeLabel: "Homeoffice", detail: "Freitag, 11. Juli", Icon: House },
{ id: "r3", name: "Sara Möller", initials: "SM", color: "#F97316", typeLabel: "Spesenabrechnung", detail: "€ 84,50 · Tankbeleg", Icon: Receipt },
{ id: "r4", name: "Jonas Weiß", initials: "JW", color: "#8B5CF6", typeLabel: "Überstundenabbau", detail: "3 Std. · Mittwoch", Icon: Clock },
];
type Item = Request & { status: Status };
export default function ApprovalInbox({ hideHeader = false }: { hideHeader?: boolean }) {
const [items, setItems] = useState<Item[]>(() => INITIAL.map((r) => ({ ...r, status: "pending" as Status })));
const hint = useCanvasHint<HTMLDivElement>();
const decide = (id: string, status: Status) => {
hint.dismiss();
setItems((its) => its.map((it) => (it.id === id ? { ...it, status } : it)));
// Let the stamp + slide animation play, then drop the row.
window.setTimeout(() => setItems((its) => its.filter((it) => it.id !== id)), 520);
};
const reset = () => setItems(INITIAL.map((r) => ({ ...r, status: "pending" as Status })));
const openCount = items.filter((it) => it.status === "pending").length;
const allDone = items.length === 0;
return (
<section className="section-full" style={{ background: "var(--surface)", paddingBlock: hideHeader ? 40 : 80 }}>
<div className="mx-auto flex flex-col gap-5" style={{ maxWidth: 620 }}>
{!hideHeader && (
<div className="flex flex-col items-center gap-4 text-center">
<span className="text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5" style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}>
ANTRÄGE
</span>
<h2 className="text-[32px] md:text-[42px] font-bold leading-[1.15]" style={{ color: "var(--text-primary)" }}>Anträge im Griff.</h2>
</div>
)}
{/* Inbox on a dotted "canvas" — same treatment as the workflow editor &
kanban board. The onboarding popup replaces the old caption. */}
<div
ref={hint.ref}
className="relative rounded-2xl"
style={{
background: "#FAFBFD",
border: "1px solid var(--border-light)",
backgroundImage: "radial-gradient(circle, #E5E7EB 1px, transparent 1px)",
backgroundSize: "24px 24px",
padding: 16,
}}
>
<div className="w-full overflow-hidden rounded-2xl" style={{ background: "#FFFFFF", border: "1px solid var(--border-light)", boxShadow: "0 30px 60px -30px rgba(15,23,42,0.3)" }}>
{/* Inbox header */}
<div className="flex items-center gap-3 px-5 py-4" style={{ borderBottom: "1px solid var(--border-light)", background: "var(--container-bg)" }}>
<span className="grid place-items-center rounded-lg shrink-0" style={{ width: 34, height: 34, background: "var(--accent-yellow-light)" }}>
<Inbox size={17} style={{ color: "var(--accent-yellow-dark)" }} />
</span>
<div className="flex flex-col">
<span className="text-[14px] font-bold" style={{ color: "var(--text-primary)" }}>Offene Anträge</span>
<span className="text-[12px]" style={{ color: "var(--text-tertiary)" }}>
{openCount > 0 ? `${openCount} zu bearbeiten` : "alles erledigt"}
</span>
</div>
{items.length < INITIAL.length && (
<button onClick={reset} className="ml-auto inline-flex items-center gap-1.5 text-[12.5px] font-semibold rounded-lg px-2.5 py-1.5 transition-colors hover:bg-[var(--bg-muted)]" style={{ color: "var(--text-secondary)" }}>
<RotateCcw size={13} /> Zurücksetzen
</button>
)}
</div>
{/* Requests */}
<div className="flex flex-col p-4">
{allDone ? (
<div className="flex flex-col items-center gap-3 text-center px-4" style={{ paddingBlock: 44 }}>
<span className="grid place-items-center rounded-full" style={{ width: 52, height: 52, background: "#DCFCE7" }}>
<Check size={26} style={{ color: "#16A34A" }} />
</span>
<span className="text-[15px] font-bold" style={{ color: "var(--text-primary)" }}>Alle Anträge bearbeitet</span>
<button onClick={reset} className="inline-flex items-center gap-1.5 text-[13px] font-semibold rounded-lg px-3 py-2 transition-colors hover:bg-[var(--bg-muted)]" style={{ color: "var(--accent-yellow-dark)" }}>
<RotateCcw size={14} /> Nochmal ansehen
</button>
</div>
) : (
items.map((it) => {
const decided = it.status !== "pending";
const approved = it.status === "approved";
return (
<div
key={it.id}
style={{
maxHeight: decided ? 0 : 220,
opacity: decided ? 0 : 1,
marginBottom: decided ? 0 : 10,
transform: decided ? `translateX(${approved ? 24 : -24}px)` : "none",
overflow: "hidden",
transition: "all 0.45s cubic-bezier(0.22,1,0.36,1)",
}}
>
<div
className="relative flex flex-col sm:flex-row sm:items-center gap-3 sm:gap-3.5 shadow-sm hover:shadow-md transition-shadow"
style={{
padding: "13px 14px 13px 16px",
borderRadius: 10,
border: "1px solid var(--border-light)",
background: approved ? "rgba(34,197,94,0.06)" : it.status === "rejected" ? "rgba(239,68,68,0.05)" : "#FFFFFF",
}}
>
{/* left accent bar — the request's colour (matches the workflow nodes / kanban language) */}
<span className="absolute rounded-r-full" style={{ left: 0, top: 8, bottom: 8, width: 3, background: it.color }} />
{/* Avatar + text — kept together; on mobile they sit above the actions */}
<div className="flex items-center gap-3.5 min-w-0">
<span className="grid place-items-center rounded-full text-[13px] font-bold shrink-0" style={{ width: 40, height: 40, background: `${it.color}1a`, color: it.color }}>
{it.initials}
</span>
<div className="flex flex-col min-w-0 gap-0.5">
<div className="flex items-center gap-2 min-w-0">
<span className="text-[14px] font-semibold truncate" style={{ color: "var(--text-primary)" }}>{it.name}</span>
<span className="inline-flex items-center gap-1 text-[11px] font-semibold rounded-full px-2 py-0.5 shrink-0" style={{ background: `${it.color}14`, color: it.color, border: `1px solid ${it.color}2e` }}>
<it.Icon size={11} /> {it.typeLabel}
</span>
</div>
<span className="text-[12.5px] whitespace-nowrap" style={{ color: "var(--text-tertiary)" }}>{it.detail}</span>
</div>
</div>
{/* Actions / status — right on desktop, full row below on mobile */}
<div className="sm:ml-auto shrink-0 flex justify-end">
{decided ? (
<span
className="inline-flex items-center gap-1.5 text-[13px] font-bold rounded-lg px-3 py-2"
style={{
background: approved ? "rgba(34,197,94,0.12)" : "rgba(239,68,68,0.1)",
color: approved ? "#16A34A" : "#DC2626",
}}
>
{approved ? <Check size={15} /> : <X size={15} />}
{approved ? "Genehmigt" : "Abgelehnt"}
</span>
) : (
<div className="flex items-center gap-2">
<button
onClick={() => decide(it.id, "rejected")}
aria-label="Ablehnen"
className="grid place-items-center rounded-lg transition-colors"
style={{ width: 38, height: 38, border: "1px solid var(--border-light)", color: "var(--text-muted)" }}
onMouseEnter={(e) => { e.currentTarget.style.background = "rgba(239,68,68,0.08)"; e.currentTarget.style.color = "#DC2626"; e.currentTarget.style.borderColor = "#EF4444"; }}
onMouseLeave={(e) => { e.currentTarget.style.background = "transparent"; e.currentTarget.style.color = "var(--text-muted)"; e.currentTarget.style.borderColor = "var(--border-light)"; }}
>
<X size={17} />
</button>
<button
onClick={() => decide(it.id, "approved")}
className="inline-flex items-center gap-1.5 text-[13px] font-bold rounded-lg transition-transform hover:scale-[1.03]"
style={{ padding: "9px 14px", background: "#16A34A", color: "#FFFFFF" }}
>
<Check size={16} /> Genehmigen
</button>
</div>
)}
</div>
</div>
</div>
);
})
)}
</div>
</div>
{/* Centered onboarding hint (dismisses on first decision or via X) */}
<CanvasHint show={hint.show} onDismiss={hint.dismiss} title="Anträge bearbeiten" subtitle="Genehmige oder lehne mit einem Klick ab" />
</div>
</div>
</section>
);
}
@@ -0,0 +1,527 @@
"use client";
import { FormEvent, useEffect, useRef, useState } from "react";
import Link from "next/link";
import { Building2, Check, SendHorizontal, UserRound, HardHat, TrafficCone } from "lucide-react";
import type { DemoChatTurn } from "@/lib/chat-demo/assistant";
const bullets = [
"Projekt-Kanäle für jedes Vorhaben",
"Dateien & Fotos direkt teilen",
"Aufgaben aus dem Chat erstellen",
"Desktop & Mobile synchronisiert",
];
const CHAT_BACKGROUND = "hsl(30 17% 95.5%)";
const CHAT_MONOGRAM_PATTERN =
"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M14 10v8M10 14h8' stroke='%23C4931E' stroke-opacity='0.14' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E\")";
// Own messages use the site's secondary colour (teal), not orange.
const OWN_BUBBLE_BACKGROUND = "#0D6E6E";
const OWN_BUBBLE_BORDER = "#0A5A5A";
const OTHER_BUBBLE_BACKGROUND = "#FFFFFF";
const OTHER_BUBBLE_BORDER = "#E9E7E5";
const OTHER_BUBBLE_TIME = "#7A726C";
const OTHER_BUBBLE_SENDER = "#F59F0A";
type DemoMessageAuthor = "team" | "self" | "assistant";
type DemoMessage = {
id: string;
sender: string;
text: string;
time: string;
author: DemoMessageAuthor;
};
type ChatDemoSectionProps = {
showSideContent?: boolean;
/** WIP / "coming soon" state — the mobile app isn't out yet, so the phone is
* blurred behind a construction-themed overlay. */
comingSoon?: boolean;
};
// Construction "Absperrband" — brand amber / dark hazard stripes.
const HAZARD_STRIPES = "repeating-linear-gradient(45deg, #F1B729 0 10px, #171106 10px 20px)";
// Barrier tape ("Absperrband") stretched diagonally across the blurred phone —
// reads as "cordoned off / under construction", not a generic badge. Clipped to
// the phone's rounded bounds so the ends cut off like real tape.
function ComingSoonTape() {
return (
<div className="absolute inset-0 overflow-hidden rounded-[36px]" aria-hidden style={{ pointerEvents: "none" }}>
<div
className="absolute left-1/2 top-1/2 flex items-center justify-center gap-5"
style={{
width: "175%",
transform: "translate(-50%, -50%) rotate(-13deg)",
background: "var(--accent-yellow)",
borderTop: "2px solid #171106",
borderBottom: "2px solid #171106",
boxShadow: "0 16px 34px -10px rgba(0,0,0,0.45)",
padding: "9px 0",
}}
>
{Array.from({ length: 6 }).map((_, i) => (
<span
key={i}
className="inline-flex items-center gap-2 text-[12.5px] font-extrabold uppercase tracking-[0.16em] whitespace-nowrap"
style={{ color: "#171106" }}
>
<HardHat size={14} strokeWidth={2.6} /> Bald verfügbar
</span>
))}
</div>
</div>
);
}
// Construction-themed copy that fills the whitespace next to the phone.
function ComingSoonAside() {
return (
<div className="flex w-full max-w-[400px] flex-col gap-5">
<style>{`@keyframes chat-hazard{from{background-position:0 0}to{background-position:28px 0}}@media(prefers-reduced-motion:reduce){.chat-hazard-anim{animation:none!important}}`}</style>
{/* mini Absperrband accent */}
<span
className="chat-hazard-anim"
style={{ width: 84, height: 8, borderRadius: 4, background: HAZARD_STRIPES, backgroundSize: "28px 28px", animation: "chat-hazard 1.1s linear infinite" }}
/>
<h2 className="text-[30px] md:text-[38px] font-extrabold leading-[1.1]" style={{ color: "var(--text-primary)", letterSpacing: "-0.02em" }}>
Der Chat für unterwegs <span style={{ color: "var(--accent-yellow)" }}>wird gerade gebaut.</span>
</h2>
<p className="text-[16px] leading-relaxed" style={{ color: "var(--text-secondary)" }}>
Die mobile App legen wir gerade auf die Baustelle. Am Desktop bist du schon
voll dabei — die Version fürs Handy folgt in Kürze.
</p>
<div className="flex items-center gap-3 text-[13px] font-medium" style={{ color: "var(--text-tertiary)" }}>
<TrafficCone size={18} strokeWidth={2} style={{ color: "var(--accent-yellow-dark)" }} />
<span>In Arbeit · noch ohne Termin, aber unterwegs.</span>
</div>
</div>
);
}
const seedMessages: DemoMessage[] = [
{
id: "m-1",
sender: "Murat Kaya",
text: "Foto vom Heizungskeller hochgeladen.",
time: "09:12",
author: "team",
},
{
id: "m-2",
sender: "Lea Brandt",
text: "Aufmaß ist fertig, schicke gleich die Unterlagen.",
time: "09:15",
author: "team",
},
{
id: "m-3",
sender: "Du",
text: "Super, dann können wir morgen mit der Installation anfangen. 👍",
time: "09:17",
author: "self",
},
{
id: "m-4",
sender: "Murat Kaya",
text: "Material ist bestellt, Lieferung Donnerstag.",
time: "09:20",
author: "team",
},
{
id: "m-5",
sender: "Daniel Reiter",
text: "Hinweis: Für morgen fehlt noch eine verbindliche Terminbestätigung vom Kunden.",
time: "09:21",
author: "assistant",
},
];
function nowTimeLabel(): string {
return new Intl.DateTimeFormat("de-DE", { hour: "2-digit", minute: "2-digit" }).format(new Date());
}
function createMessageId(): string {
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
return crypto.randomUUID();
}
return `demo-${Date.now()}-${Math.random().toString(16).slice(2)}`;
}
function toConversationTurns(messages: DemoMessage[]): DemoChatTurn[] {
return messages
.filter((msg) => msg.author !== "team")
.map((msg) => ({
role: msg.author === "self" ? "user" : "assistant",
content: msg.text,
}));
}
async function requestAssistantReply(message: string, conversation: DemoChatTurn[]): Promise<string> {
const response = await fetch("/api/demo-chat/reply", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ message, conversation }),
});
if (!response.ok) {
throw new Error("assistant_unavailable");
}
const data = (await response.json()) as { reply?: unknown };
if (typeof data.reply !== "string" || !data.reply.trim()) {
throw new Error("assistant_invalid");
}
return data.reply.trim();
}
export default function ChatDemoSection({ showSideContent = true, comingSoon = false }: ChatDemoSectionProps) {
const phoneRef = useRef<HTMLDivElement>(null);
const [messages, setMessages] = useState(seedMessages);
const [draft, setDraft] = useState("");
const [isReplying, setIsReplying] = useState(false);
const [sendError, setSendError] = useState<string | null>(null);
const scrollRef = useRef<HTMLDivElement>(null);
useEffect(() => {
const container = scrollRef.current;
if (!container) {
return;
}
container.scrollTop = container.scrollHeight;
}, [messages, isReplying]);
useEffect(() => {
const phoneEl = phoneRef.current;
if (!phoneEl) {
return;
}
const handleNativeWheel = (event: WheelEvent) => {
const container = scrollRef.current;
if (!container) {
return;
}
if (container.scrollHeight <= container.clientHeight) {
return;
}
event.preventDefault();
event.stopPropagation();
container.scrollTop += event.deltaY;
};
phoneEl.addEventListener("wheel", handleNativeWheel, { passive: false });
return () => {
phoneEl.removeEventListener("wheel", handleNativeWheel);
};
}, []);
async function handleSubmit(event: FormEvent<HTMLFormElement>) {
event.preventDefault();
const trimmed = draft.trim();
if (!trimmed || isReplying) {
return;
}
const userMessage: DemoMessage = {
id: createMessageId(),
sender: "Du",
text: trimmed,
time: nowTimeLabel(),
author: "self",
};
const nextConversation = [...messages, userMessage];
setMessages(nextConversation);
setDraft("");
setSendError(null);
setIsReplying(true);
try {
const [replyText] = await Promise.all([
requestAssistantReply(trimmed, toConversationTurns(nextConversation)),
new Promise((resolve) => setTimeout(resolve, 520)),
]);
setMessages((prev) => [
...prev,
{
id: createMessageId(),
sender: "Daniel Reiter",
text: replyText,
time: nowTimeLabel(),
author: "assistant",
},
]);
} catch {
setSendError("Antwort konnte gerade nicht geladen werden.");
} finally {
setIsReplying(false);
}
}
return (
<section
className="section-full"
style={{ background: "var(--surface)", paddingBlock: 80 }}
>
<div
className={`flex flex-col items-center justify-center gap-12 lg:gap-20 mx-auto ${showSideContent || comingSoon ? "lg:flex-row" : ""}`}
style={{ maxWidth: showSideContent ? "var(--content-width)" : comingSoon ? 860 : 420 }}
>
{comingSoon ? <ComingSoonAside /> : null}
{showSideContent ? (
<div className="flex w-full max-w-[420px] flex-col gap-4 lg:hidden">
<span
className="self-start text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5"
style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}
>
KOMMUNIKATION
</span>
<h2
className="text-[32px] font-bold leading-[1.15]"
style={{ color: "var(--text-primary)" }}
>
Ihr Team bleibt vernetzt, <span style={{ color: "var(--accent-yellow)" }}>informiert</span> und abgestimmt.
</h2>
</div>
) : null}
{/* Phone mockup (wrapped so the coming-soon overlay can sit on top) */}
<div className="relative shrink-0">
<div
ref={phoneRef}
className="rounded-[40px] overflow-hidden flex flex-col"
style={{
width: 300,
height: 600,
background: "#FFFFFF",
border: "4px solid #D1D5DB",
boxShadow: "0 12px 40px -4px rgba(0,0,0,0.13), 0 4px 12px rgba(0,0,0,0.06)",
...(comingSoon ? { filter: "blur(3px) saturate(0.92)", pointerEvents: "none", userSelect: "none" } : null),
}}
aria-hidden={comingSoon || undefined}
>
{/* Status bar */}
<div
className="flex items-center justify-between px-6 shrink-0"
style={{ height: 44, background: "#FFFFFF", fontSize: 13, fontWeight: 600 }}
>
<span style={{ color: "var(--text-primary)" }}>9:41</span>
</div>
{/* Chat header */}
<div
className="flex items-center gap-3 shrink-0"
style={{
height: 56,
background: "#FFFFFF",
padding: "0 16px",
borderBottom: "1px solid #E5E7EB",
}}
>
<div
className="flex items-center justify-center rounded-full shrink-0 text-[14px] font-semibold text-white"
style={{ width: 36, height: 36, background: "#F3E4C2" }}
>
<Building2 size={16} color="#8A6116" strokeWidth={2.2} />
</div>
<div>
<p className="text-[14px] font-semibold" style={{ color: "var(--text-primary)" }}>
Heizungsprojekt Schulz
</p>
<p className="text-[11px]" style={{ color: "var(--text-secondary)" }}>
4 Mitglieder · 2 online
</p>
</div>
</div>
{/* Messages */}
<div
ref={scrollRef}
className="chat-scroll-hidden flex flex-col gap-2 flex-1 overflow-y-auto"
style={{
background: CHAT_BACKGROUND,
backgroundImage: CHAT_MONOGRAM_PATTERN,
backgroundRepeat: "repeat",
backgroundSize: "28px 28px",
padding: "12px 12px",
overscrollBehaviorY: "contain",
WebkitOverflowScrolling: "touch",
}}
>
{messages.map((msg) => (
<div
key={msg.id}
className={`flex items-end gap-2 ${msg.author === "self" ? "justify-end" : "justify-start"}`}
>
{msg.author !== "self" && (
<div
className="flex items-center justify-center rounded-full shrink-0"
style={{ width: 26, height: 26, background: "#E8DDCE" }}
>
<UserRound size={12} color="#7F6D58" strokeWidth={2.3} />
</div>
)}
<div
className="text-[12px] leading-snug max-w-[72%]"
style={{
backgroundColor: msg.author === "self" ? OWN_BUBBLE_BACKGROUND : OTHER_BUBBLE_BACKGROUND,
borderRadius: msg.author === "self" ? "16px 16px 4px 16px" : "16px 16px 16px 4px",
padding: "8px 12px",
color: msg.author === "self" ? "#FFFFFF" : "var(--text-primary)",
boxShadow: "0 1px 2px rgba(0,0,0,0.06)",
border: msg.author === "self" ? `1px solid ${OWN_BUBBLE_BORDER}` : `1px solid ${OTHER_BUBBLE_BORDER}`,
}}
>
{msg.author !== "self" ? (
<p className="mb-1 text-[11px] font-semibold" style={{ color: OTHER_BUBBLE_SENDER }}>
{msg.sender}
</p>
) : null}
{msg.text}
<p className="mt-1 text-[10px]" style={{ color: msg.author === "self" ? "rgba(255,255,255,0.82)" : OTHER_BUBBLE_TIME }}>
{msg.time}
</p>
</div>
</div>
))}
</div>
{sendError ? (
<div className="px-3 py-1 text-[11px]" style={{ color: "#B91C1C", background: "#FEF2F2" }}>
{sendError}
</div>
) : null}
{/* Input */}
<form
onSubmit={(event) => {
void handleSubmit(event);
}}
className="flex items-center gap-2 shrink-0"
style={{
height: 56,
background: "#FFFFFF",
padding: "0 12px",
borderTop: "1px solid #E5E7EB",
}}
>
<input
value={draft}
onChange={(event) => setDraft(event.target.value)}
placeholder="Nachricht schreiben..."
className="flex-1 min-w-0 rounded-full text-[14px]"
style={{
background: "#FFFFFF",
height: 36,
padding: "0 14px",
color: "#111827",
fontSize: 14,
outline: "none",
border: "1px solid #E5E7EB",
}}
/>
<button
type="submit"
disabled={!draft.trim() || isReplying}
className="flex items-center justify-center rounded-full shrink-0 transition-opacity"
style={{
width: 34,
height: 34,
background: !draft.trim() || isReplying ? "#DCCFB8" : "var(--accent-yellow)",
opacity: !draft.trim() || isReplying ? 0.8 : 1,
}}
>
<SendHorizontal size={14} color="#1A1A1A" />
</button>
</form>
{/* Home indicator */}
<div className="flex items-center justify-center" style={{ height: 20, background: "#FFFFFF" }}>
<div className="rounded-full" style={{ width: 120, height: 4, background: "#D1D5DB" }} />
</div>
</div>
{comingSoon ? <ComingSoonTape /> : null}
</div>
{showSideContent ? (
<>
<div className="hidden flex-col gap-6 lg:flex" style={{ maxWidth: 420 }}>
<span
className="self-start text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5"
style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}
>
KOMMUNIKATION
</span>
<h2
className="text-[32px] md:text-[42px] font-bold leading-[1.15]"
style={{ color: "var(--text-primary)" }}
>
Ihr Team bleibt vernetzt, <span style={{ color: "var(--accent-yellow)" }}>informiert</span> und abgestimmt.
</h2>
<p className="text-[16px] leading-relaxed" style={{ color: "var(--text-secondary)" }}>
So vertraut wie WhatsApp, aber fürs Handwerk gebaut: Alle Fotos, Aufgaben und
Absprachen sind projektbezogen und zentral dokumentiert.
</p>
<ul className="flex flex-col gap-3">
{bullets.map((b) => (
<li key={b} className="flex items-center gap-3">
<Check size={18} style={{ color: "var(--accent-yellow)", flexShrink: 0 }} strokeWidth={2.5} />
<span className="text-[14px] font-medium" style={{ color: "var(--text-primary)" }}>
{b}
</span>
</li>
))}
</ul>
<Link
href="/produkt/chat"
className="self-start text-[14px] font-semibold hover:underline"
style={{ color: "var(--accent-yellow-dark)" }}
>
Chat App entdecken →
</Link>
</div>
<div className="flex w-full max-w-[420px] flex-col gap-4 lg:hidden">
<p className="text-[16px] leading-relaxed" style={{ color: "var(--text-secondary)" }}>
So vertraut wie WhatsApp, aber fürs Handwerk gebaut: Alle Fotos, Aufgaben und
Absprachen sind projektbezogen und zentral dokumentiert.
</p>
<ul className="flex flex-col gap-3">
{bullets.map((b) => (
<li key={b} className="flex items-center gap-3">
<Check size={18} style={{ color: "var(--accent-yellow)", flexShrink: 0 }} strokeWidth={2.5} />
<span className="text-[14px] font-medium" style={{ color: "var(--text-primary)" }}>
{b}
</span>
</li>
))}
</ul>
<Link
href="/produkt/chat"
className="self-start text-[14px] font-semibold hover:underline"
style={{ color: "var(--accent-yellow-dark)" }}
>
Chat App entdecken →
</Link>
</div>
</>
) : null}
</div>
</section>
);
}
@@ -0,0 +1,16 @@
"use client";
import dynamic from "next/dynamic";
type ChatDemoSectionClientProps = {
showSideContent?: boolean;
comingSoon?: boolean;
};
const ChatDemoSection = dynamic<ChatDemoSectionClientProps>(() => import("@/components/sections/ChatDemoSection"), {
ssr: false,
});
export default function ChatDemoSectionClient({ showSideContent = true, comingSoon = false }: ChatDemoSectionClientProps) {
return <ChatDemoSection showSideContent={showSideContent} comingSoon={comingSoon} />;
}
@@ -0,0 +1,146 @@
.section {
overflow: hidden;
padding: clamp(48px, 5vw, 68px) clamp(20px, 2.2vw, 34px);
background: var(--bg-primary);
}
.inner {
width: 100%;
max-width: 1480px;
margin: 0 auto;
}
.heading {
display: flex;
flex-direction: column;
align-items: center;
max-width: 760px;
margin: 0 auto 34px;
text-align: center;
}
.heading > span {
margin-bottom: 16px;
color: var(--accent-yellow-dark);
font-size: 12px;
font-weight: 750;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.heading h2 {
margin: 0;
color: var(--text-primary);
font-size: clamp(36px, 4.2vw, 58px);
font-weight: 800;
letter-spacing: -0.045em;
line-height: 1.05;
text-wrap: balance;
}
.heading p {
max-width: 660px;
margin: 20px 0 0;
color: var(--text-secondary);
font-size: 16px;
line-height: 1.7;
}
.lanes {
display: grid;
gap: 10px;
}
.card {
display: grid;
grid-template-columns: minmax(280px, 0.52fr) minmax(0, 1.48fr);
gap: clamp(28px, 3.2vw, 48px);
align-items: center;
padding-block: clamp(22px, 2vw, 30px);
padding-inline: clamp(28px, 2.6vw, 38px);
border: 1px solid var(--border-light);
background: var(--container-bg);
clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
will-change: transform;
}
.card:nth-child(even) {
grid-template-columns: minmax(0, 1.48fr) minmax(280px, 0.52fr);
}
.card:nth-child(even) .visual {
grid-column: 1;
grid-row: 1;
}
.card:nth-child(even) .copy {
grid-column: 2;
grid-row: 1;
}
.copy h3 {
margin: 0 0 18px;
color: var(--text-primary);
font-size: clamp(28px, 2.5vw, 40px);
font-weight: 800;
letter-spacing: -0.04em;
line-height: 1.04;
white-space: nowrap;
}
.copy p {
margin: 0;
color: var(--text-secondary);
font-size: 15.5px;
line-height: 1.75;
}
.link {
display: inline-flex;
align-items: center;
gap: 7px;
margin-top: 24px;
color: var(--teal, #0d6e6e);
font-size: 14px;
font-weight: 750;
text-decoration: none;
}
.link:hover {
text-decoration: underline;
text-underline-offset: 4px;
}
.visual {
position: relative;
min-width: 0;
padding-block: clamp(7px, 0.7vw, 10px);
padding-inline: clamp(11px, 1.15vw, 18px);
transform-origin: center;
will-change: transform;
}
.screenshot {
overflow: hidden;
border: 1px solid #dfe4e8;
border-radius: 12px;
background: #fff;
box-shadow: 0 14px 34px rgba(15, 23, 42, 0.09);
line-height: 0;
transform-origin: center;
will-change: transform, box-shadow;
}
.screenshot img {
display: block;
width: 100%;
height: auto;
}
@media (prefers-reduced-motion: reduce) {
.card,
.visual,
.screenshot {
transform: none !important;
}
}
@@ -0,0 +1,220 @@
"use client";
import { useRef } from "react";
import Image from "next/image";
import Link from "next/link";
import { ArrowUpRight } from "lucide-react";
import { useGSAP } from "@gsap/react";
import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/dist/ScrollTrigger";
import styles from "./DesktopSystemCards.module.css";
gsap.registerPlugin(useGSAP, ScrollTrigger);
export type DesktopSystemCardItem = {
title: string;
body: string;
screenshot: string;
screenshotWidth: number;
screenshotHeight: number;
href?: string;
};
export default function DesktopSystemCards({
badge,
headline,
subtext,
items,
}: {
badge: string;
headline: string;
subtext: string;
items: readonly DesktopSystemCardItem[];
}) {
const root = useRef<HTMLElement>(null);
useGSAP(
(_context, contextSafe) => {
const select = gsap.utils.selector(root);
const media = gsap.matchMedia();
media.add(
{
desktop: "(min-width: 1024px)",
reduceMotion: "(prefers-reduced-motion: reduce)",
},
(context) => {
const { desktop, reduceMotion } = context.conditions as {
desktop: boolean;
reduceMotion: boolean;
};
if (!desktop || reduceMotion) return;
const heading = select("[data-system-heading]")[0];
if (heading) {
gsap.from(heading.children, {
autoAlpha: 0,
y: 24,
duration: 0.72,
ease: "power3.out",
stagger: 0.08,
clearProps: "transform,opacity,visibility",
scrollTrigger: {
trigger: heading,
start: "clamp(top 84%)",
once: true,
},
});
}
select("[data-system-card]").forEach((card, index) => {
const copy = card.querySelector("[data-system-copy]");
const visual = card.querySelector("[data-system-visual]");
const screenshot = card.querySelector("[data-system-screenshot]");
const direction = index % 2 === 0 ? 1 : -1;
const reveal = gsap.timeline({
defaults: { ease: "power3.out" },
scrollTrigger: {
trigger: card,
start: "clamp(top 82%)",
once: true,
},
});
reveal.fromTo(
card,
{
autoAlpha: 0,
y: 38,
scale: 0.985,
},
{
autoAlpha: 1,
y: 0,
scale: 1,
duration: 0.78,
clearProps: "transform,opacity,visibility",
},
);
if (copy) {
reveal.fromTo(
copy,
{
autoAlpha: 0,
x: -38 * direction,
},
{
autoAlpha: 1,
x: 0,
duration: 0.62,
clearProps: "transform,opacity,visibility",
},
0.12
);
}
if (visual) {
reveal.fromTo(
visual,
{
autoAlpha: 0,
x: 72 * direction,
rotation: 1.15 * direction,
scale: 0.955,
},
{
autoAlpha: 1,
x: 0,
rotation: 0,
scale: 1,
duration: 0.86,
clearProps: "transform,opacity,visibility",
},
0.08
);
}
if (!screenshot) return;
const enter = contextSafe!(() => {
gsap.to(screenshot, {
y: -4,
scale: 1.006,
boxShadow: "0 20px 44px rgba(15, 23, 42, 0.12)",
duration: 0.3,
ease: "power2.out",
overwrite: "auto",
});
});
const leave = contextSafe!(() => {
gsap.to(screenshot, {
y: 0,
scale: 1,
boxShadow: "0 14px 34px rgba(15, 23, 42, 0.09)",
duration: 0.4,
ease: "power3.out",
overwrite: "auto",
onComplete: () => {
gsap.set(screenshot, { clearProps: "transform,boxShadow" });
},
});
});
screenshot.addEventListener("pointerenter", enter);
screenshot.addEventListener("pointerleave", leave);
context.add(() => {
screenshot.removeEventListener("pointerenter", enter);
screenshot.removeEventListener("pointerleave", leave);
gsap.killTweensOf(screenshot);
gsap.set(screenshot, { clearProps: "transform,boxShadow" });
});
});
}
);
return () => media.revert();
},
{ scope: root }
);
return (
<section ref={root} className={styles.section} aria-labelledby="desktop-system-cards-title">
<div className={styles.inner}>
<header className={styles.heading} data-system-heading>
<span>{badge}</span>
<h2 id="desktop-system-cards-title">{headline}</h2>
<p>{subtext}</p>
</header>
<div className={styles.lanes}>
{items.map((item) => (
<article className={styles.card} data-system-card key={item.title}>
<div className={styles.copy} data-system-copy>
<h3>{item.title}</h3>
<p>{item.body}</p>
{item.href ? (
<Link href={item.href} className={styles.link}>
Bereich ansehen <ArrowUpRight size={17} aria-hidden />
</Link>
) : null}
</div>
<div className={styles.visual} data-system-visual>
<div className={styles.screenshot} data-system-screenshot>
<Image
src={item.screenshot}
alt={`${item.title} in HiveGrid`}
width={item.screenshotWidth}
height={item.screenshotHeight}
sizes="(min-width: 1280px) 760px, (min-width: 1024px) 58vw, 100vw"
/>
</div>
</div>
</article>
))}
</div>
</div>
</section>
);
}
@@ -0,0 +1,294 @@
"use client";
import { useEffect, useRef, useState } from "react";
import { Type, Image as ImageIcon, Heading1, MousePointerClick, LayoutGrid, Minus, Trash2, GripVertical, RotateCcw, Plus } from "lucide-react";
import CanvasHint, { useCanvasHint } from "@/components/ui/CanvasHint";
/* ──────────────────────────────────────────────────────────────────────────
* EmailBuilder — interactive centrepiece for the email-marketing page. Click a
* block in the palette to add it to the live e-mail preview; drag blocks to
* reorder, hover to remove. Brand-styled, not a 1:1 copy of the real editor.
* ────────────────────────────────────────────────────────────────────────── */
type BlockType = "subject" | "image" | "text" | "button" | "products" | "divider";
const PALETTE: { type: BlockType; label: string; icon: typeof Type }[] = [
{ type: "subject", label: "Überschrift", icon: Heading1 },
{ type: "image", label: "Bild", icon: ImageIcon },
{ type: "text", label: "Text", icon: Type },
{ type: "button", label: "CTA-Button", icon: MousePointerClick },
{ type: "products", label: "Produkte", icon: LayoutGrid },
{ type: "divider", label: "Trenner", icon: Minus },
];
type Block = { id: string; type: BlockType };
const INITIAL: Block[] = [
{ id: "b1", type: "subject" },
{ id: "b2", type: "image" },
{ id: "b3", type: "text" },
{ id: "b4", type: "button" },
];
function BlockPreview({ type }: { type: BlockType }) {
switch (type) {
case "subject":
return (
<span
contentEditable="plaintext-only"
suppressContentEditableWarning
className="block text-[17px] font-bold leading-snug outline-none rounded cursor-text focus:ring-2 focus:ring-[var(--accent-yellow)] focus:px-1 focus:-mx-1"
style={{ color: "var(--text-primary)" }}
>
Ihre neue Wärmepumpe wartet auf Sie
</span>
);
case "image":
return (
<div
className="w-full rounded-lg flex flex-col items-center justify-center gap-1.5"
style={{ height: 120, background: "var(--container-bg)", border: "1px dashed var(--border-light)" }}
>
<ImageIcon size={22} style={{ color: "var(--text-muted)" }} />
<span className="text-[10px] font-medium" style={{ color: "var(--text-muted)" }}>Bild hierher ziehen</span>
</div>
);
case "text":
return (
<p
contentEditable="plaintext-only"
suppressContentEditableWarning
className="text-[13px] leading-relaxed outline-none rounded cursor-text focus:ring-2 focus:ring-[var(--accent-yellow)]"
style={{ color: "var(--text-secondary)" }}
>
Hallo Herr Müller, danke für Ihr Interesse an der Wärmepumpe. Wir haben Ihnen
ein persönliches Angebot zusammengestellt. Schauen Sie gern rein.
</p>
);
case "button":
return (
<div
className="inline-flex items-center justify-center text-[13px] font-semibold rounded-lg"
style={{ background: "var(--accent-yellow)", color: "var(--text-primary)", padding: "10px 20px" }}
>
Jetzt Angebot ansehen
</div>
);
case "products":
return (
<div className="grid grid-cols-2 gap-2.5">
{[
{ name: "Heizung", price: "ab € 3.900" },
{ name: "Sanitär", price: "ab € 1.490" },
{ name: "Wartung", price: "ab € 149" },
{ name: "Solar", price: "ab € 6.200" },
].map((p) => (
<div key={p.name} className="flex flex-col gap-1.5 rounded-lg p-2.5" style={{ background: "var(--container-bg)", border: "1px solid var(--border-light)" }}>
<div className="w-full rounded grid place-items-center" style={{ height: 44, background: "#FFFFFF", border: "1px dashed var(--border-light)" }}>
<ImageIcon size={14} style={{ color: "var(--text-muted)" }} />
</div>
<span className="text-[11px] font-semibold" style={{ color: "var(--text-primary)" }}>{p.name}-Paket</span>
<span className="text-[10px]" style={{ color: "var(--text-tertiary)" }}>{p.price}</span>
</div>
))}
</div>
);
case "divider":
return <div style={{ height: 1, background: "var(--border-light)" }} />;
}
}
export default function EmailBuilder({ hideHeader = false }: { hideHeader?: boolean }) {
const [blocks, setBlocks] = useState<Block[]>(INITIAL);
const [dragId, setDragId] = useState<string | null>(null);
const [resetKey, setResetKey] = useState(0); // bump to remount blocks → clears edited contentEditable text
const idRef = useRef(100);
const blockRefs = useRef<Record<string, HTMLDivElement | null>>({});
const hint = useCanvasHint<HTMLDivElement>();
const addBlock = (type: BlockType) => {
hint.dismiss();
idRef.current += 1;
setBlocks((bs) => [...bs, { id: `b${idRef.current}`, type }]);
};
const removeBlock = (id: string) => setBlocks((bs) => bs.filter((b) => b.id !== id));
const reset = () => {
setDragId(null);
setBlocks(INITIAL);
setResetKey((k) => k + 1);
};
useEffect(() => {
if (!dragId) return;
document.body.style.setProperty("user-select", "none");
document.body.style.setProperty("-webkit-user-select", "none");
const onMove = (e: PointerEvent) => {
const y = e.clientY;
const targetId = blocks.find((b) => {
const el = blockRefs.current[b.id];
if (!el) return false;
const r = el.getBoundingClientRect();
return y >= r.top && y <= r.bottom;
})?.id;
if (!targetId || targetId === dragId) return;
setBlocks((bs) => {
const from = bs.findIndex((b) => b.id === dragId);
const to = bs.findIndex((b) => b.id === targetId);
if (from === -1 || to === -1) return bs;
const arr = [...bs];
const [moved] = arr.splice(from, 1);
arr.splice(to, 0, moved);
return arr;
});
};
const onUp = () => setDragId(null);
window.addEventListener("pointermove", onMove, { passive: true });
window.addEventListener("pointerup", onUp);
window.addEventListener("pointercancel", onUp);
return () => {
window.removeEventListener("pointermove", onMove);
window.removeEventListener("pointerup", onUp);
window.removeEventListener("pointercancel", onUp);
document.body.style.removeProperty("user-select");
document.body.style.removeProperty("-webkit-user-select");
};
}, [dragId, blocks]);
return (
<section className="section-full" style={{ background: "var(--surface)", paddingBlock: hideHeader ? 40 : 80 }}>
<div className="mx-auto flex flex-col gap-6" style={{ maxWidth: "var(--content-width)" }}>
{!hideHeader && (
<div className="flex flex-col items-center gap-4 text-center">
<span className="text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5" style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}>
E-MAIL-BAUKASTEN
</span>
<h2 className="text-[32px] md:text-[42px] font-bold leading-[1.15]" style={{ color: "var(--text-primary)" }}>Kampagnen selbst gebaut.</h2>
</div>
)}
{/* Builder on a dotted "canvas" — same treatment as the workflow editor
& kanban. Reset sits in the corner; the popup replaces the caption. */}
<div
ref={hint.ref}
className="relative rounded-2xl"
style={{
background: "#FAFBFD",
border: "1px solid var(--border-light)",
backgroundImage: "radial-gradient(circle, #E5E7EB 1px, transparent 1px)",
backgroundSize: "24px 24px",
padding: "32px 24px",
}}
>
{/* Reset — top-right corner of the canvas */}
<button
onClick={reset}
className="absolute top-3 right-3 z-[40] inline-flex items-center gap-1.5 text-[12.5px] font-semibold rounded-lg px-2.5 py-1.5 transition-colors hover:bg-[var(--bg-muted)]"
style={{ color: "var(--text-secondary)", background: "#FFFFFF", border: "1px solid var(--border-light)" }}
>
<RotateCcw size={13} /> Zurücksetzen
</button>
<div className="flex flex-col lg:flex-row gap-8 lg:gap-10 justify-center items-center lg:items-start">
{/* Palette */}
<div className="w-full lg:w-[230px] min-w-0 grid grid-cols-3 lg:grid-cols-1 gap-2.5">
{PALETTE.map(({ type, label, icon: Icon }) => (
<button
key={type}
onClick={() => addBlock(type)}
className="group flex items-center gap-2.5 rounded-lg text-left bg-white border border-[var(--border-light)] shadow-sm transition-colors duration-150 hover:border-[var(--accent-yellow)] hover:shadow-md"
style={{ padding: "9px 11px" }}
>
{/* Icon sits neutral at rest; brand amber only appears on hover
(an amber tile on every row read as generic/vibecoded). */}
<span
className="grid place-items-center rounded-md shrink-0 transition-colors duration-150 bg-[var(--container-bg)] text-[var(--text-secondary)] group-hover:bg-[var(--accent-yellow-light)] group-hover:text-[var(--accent-yellow-dark)]"
style={{ width: 28, height: 28 }}
>
<Icon size={15} />
</span>
<span className="text-[13px] font-semibold min-w-0 truncate" style={{ color: "var(--text-primary)" }}>{label}</span>
<Plus
size={14}
strokeWidth={2.5}
className="ml-auto shrink-0 hidden lg:block opacity-0 -translate-x-1 transition-all duration-150 group-hover:opacity-100 group-hover:translate-x-0 text-[var(--accent-yellow-dark)]"
/>
</button>
))}
</div>
{/* Email preview */}
<div
className="w-full max-w-[440px] min-w-0 overflow-hidden rounded-2xl"
style={{ background: "#FFFFFF", border: "1px solid var(--border-light)", boxShadow: "0 30px 60px -30px rgba(15,23,42,0.3)" }}
>
{/* Mail header */}
<div className="flex items-center gap-3 px-5 py-3.5" style={{ borderBottom: "1px solid var(--border-light)", background: "var(--container-bg)" }}>
<span className="grid place-items-center rounded-full text-[13px] font-bold shrink-0" style={{ width: 34, height: 34, background: "var(--accent-yellow)", color: "var(--text-primary)" }}>G</span>
<div className="flex flex-col min-w-0">
<span className="text-[13px] font-semibold truncate" style={{ color: "var(--text-primary)" }}>Geerkens Sanitär &amp; Heizung GmbH</span>
<span className="text-[11.5px] truncate" style={{ color: "var(--text-tertiary)" }}>an Sie · buero@geerkens.de</span>
</div>
</div>
{/* Body blocks */}
<div className="flex flex-col gap-4 p-5" style={{ touchAction: dragId ? "none" : undefined }}>
{blocks.length === 0 && (
<p className="text-[13px] text-center py-8" style={{ color: "var(--text-muted)" }}>
Fügen Sie links Blöcke hinzu …
</p>
)}
{blocks.map((b) => {
const isDragging = dragId === b.id;
return (
<div
key={`${resetKey}-${b.id}`}
ref={(el) => {
blockRefs.current[b.id] = el;
}}
className="group relative rounded-lg transition-shadow"
style={{
padding: 8,
margin: -8,
background: isDragging ? "var(--container-bg)" : "transparent",
boxShadow: isDragging ? "0 12px 30px -12px rgba(15,23,42,0.25)" : "none",
cursor: isDragging ? "grabbing" : undefined,
}}
>
<BlockPreview type={b.type} />
{/* Drag handle */}
<span
onPointerDown={() => { hint.dismiss(); setDragId(b.id); }}
className="absolute left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 grid place-items-center rounded-md opacity-0 group-hover:opacity-100 transition-opacity"
style={{ width: 22, height: 22, background: "#fff", border: "1px solid var(--border-light)", cursor: "grab", touchAction: "none" }}
aria-label="Verschieben"
>
<GripVertical size={13} style={{ color: "var(--text-muted)" }} />
</span>
{/* Remove */}
<button
onClick={() => removeBlock(b.id)}
className="absolute right-0 top-0 translate-x-1/2 -translate-y-1/2 grid place-items-center rounded-full opacity-0 group-hover:opacity-100 transition hover:text-[#EF4444] hover:border-[#EF4444]"
style={{ width: 24, height: 24, background: "#fff", border: "1px solid var(--border-light)", color: "var(--text-muted)" }}
aria-label="Block entfernen"
>
<Trash2 size={13} />
</button>
</div>
);
})}
</div>
</div>
</div>
{/* Centered onboarding hint (dismisses on first block add/drag or via X) */}
<CanvasHint show={hint.show} onDismiss={hint.dismiss} title="E-Mail bauen" subtitle="Klick links auf einen Block, um ihn hinzuzufügen" />
</div>
</div>
</section>
);
}
@@ -0,0 +1,172 @@
"use client";
import { useRef, useState } from "react";
import { ChevronUp, ChevronDown } from "lucide-react";
import { useGSAP } from "@gsap/react";
import { gsap } from "gsap";
import { faqs } from "@/lib/faqs";
gsap.registerPlugin(useGSAP);
export default function FAQSection({
items = faqs,
intro = "Finden Sie schnell Antworten auf die wichtigsten Fragen.",
}: {
items?: { q: string; a: string }[];
intro?: string;
}) {
const [open, setOpen] = useState<number | null>(0);
const root = useRef<HTMLElement>(null);
useGSAP(
() => {
const media = gsap.matchMedia();
media.add("(prefers-reduced-motion: no-preference)", () => {
const section = root.current;
const header = root.current?.querySelector("[data-faq-header]");
const rows = root.current?.querySelectorAll("[data-faq-row]");
if (!section || !header || !rows?.length) return;
const headerChildren = Array.from(header.children);
const rowElements = Array.from(rows);
gsap.set(headerChildren, { autoAlpha: 0, y: 22 });
gsap.set(rowElements, { autoAlpha: 0, y: 18 });
const revealTimeline = gsap.timeline({
paused: true,
defaults: { ease: "power3.out" },
});
revealTimeline
.to(headerChildren, {
autoAlpha: 1,
y: 0,
duration: 0.55,
stagger: 0.06,
})
.to(
rowElements,
{
autoAlpha: 1,
y: 0,
duration: 0.42,
stagger: 0.045,
},
"-=0.2",
);
const reveal = () => revealTimeline.play();
const observer = new IntersectionObserver(
([entry]) => {
if (!entry?.isIntersecting) return;
reveal();
observer.disconnect();
},
{ rootMargin: "0px 0px -16% 0px", threshold: 0.04 },
);
observer.observe(section);
return () => {
observer.disconnect();
revealTimeline.kill();
};
});
return () => media.revert();
},
{ scope: root },
);
useGSAP(
() => {
if (open === null || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
const answer = root.current?.querySelector('[data-faq-answer="' + open + '"]');
if (!answer) return;
gsap.fromTo(
answer,
{ autoAlpha: 0, y: -7 },
{
autoAlpha: 1,
y: 0,
duration: 0.3,
ease: "power2.out",
overwrite: "auto",
},
);
},
{ scope: root, dependencies: [open], revertOnUpdate: true },
);
return (
<section
ref={root}
className="section-full"
style={{ background: "var(--surface)", paddingBlock: 80 }}
>
<div
className="flex flex-col items-center gap-10 mx-auto"
style={{ maxWidth: "var(--content-width)" }}
>
{/* Header */}
<div className="flex flex-col items-center gap-4 text-center" data-faq-header>
<span
className="text-[12px] font-semibold tracking-widest chamfer-badge px-3 py-1"
style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}
>
FAQ
</span>
<h2
className="text-[32px] md:text-[42px] font-bold leading-[1.15]"
style={{ color: "var(--text-primary)" }}
>
Häufig gestellte Fragen.
</h2>
<p className="text-[16px]" style={{ color: "var(--text-secondary)" }}>
{intro}
</p>
</div>
{/* FAQ list */}
<div className="w-full" style={{ maxWidth: 720 }}>
{items.map((item, i) => (
<div key={item.q} data-faq-row>
<div
style={{
borderBottom: i < items.length - 1 ? "1px solid var(--border-neutral)" : "none",
}}
>
<button
onClick={() => setOpen(open === i ? null : i)}
className="flex items-center justify-between w-full text-left py-6"
>
<span
className="text-[16px] font-semibold pr-8"
style={{ color: "var(--text-primary)" }}
>
{item.q}
</span>
{open === i ? (
<ChevronUp size={20} className="shrink-0" style={{ color: "var(--text-secondary)" }} />
) : (
<ChevronDown size={20} className="shrink-0" style={{ color: "var(--text-secondary)" }} />
)}
</button>
{open === i && (
<p
data-faq-answer={i}
className="text-[15px] leading-relaxed pb-6"
style={{ color: "var(--text-secondary)" }}
>
{item.a}
</p>
)}
</div>
</div>
))}
</div>
</div>
</section>
);
}
@@ -0,0 +1,119 @@
import Link from "next/link";
import { CHAMFER } from "@/lib/chamfer";
import {
Workflow,
Mail,
MessageCircle,
Kanban,
TrendingUp,
Users,
} from "lucide-react";
const features = [
{
icon: Workflow,
title: "Workflow Engine",
desc: "Wiederkehrende Abläufe automatisieren. Einmal einrichten, dauerhaft profitieren.",
href: "/produkt/workflow-engine",
},
{
icon: Mail,
title: "Email Marketing",
desc: "Angebots-Follow-ups, Wartungserinnerungen und Newsletter, ohne Mehraufwand.",
href: "/produkt/email-marketing",
},
{
icon: MessageCircle,
title: "Chat App",
desc: "Büro und Baustelle synchron. Schluss mit WhatsApp-Gruppen.",
href: "/produkt/chat",
},
{
icon: Kanban,
title: "Projektmanagement",
desc: "Fristen, Aufgaben und Verantwortlichkeiten. Alles auf einen Blick.",
href: "/produkt/projektmanagement",
},
{
icon: TrendingUp,
title: "Vertriebspipelines",
desc: "Von der Anfrage bis zum Auftrag. Kein Lead geht verloren.",
href: "/produkt/vertriebspipelines",
},
{
icon: Users,
title: "Mitarbeitermanagement",
desc: "Einsatzplanung, Verfügbarkeit und Aufgaben auf einen Blick.",
href: "/produkt/mitarbeitermanagement",
},
];
export default function FeaturesGrid() {
return (
<section
className="section-full"
style={{ background: "var(--surface)", paddingBlock: 80 }}
>
<div
className="flex flex-col items-center gap-10 mx-auto"
style={{ maxWidth: "var(--content-width)" }}
>
{/* Header */}
<div className="flex flex-col items-center gap-4 text-center">
<span
className="text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5"
style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}
>
PRODUKTE
</span>
<h2
className="text-[32px] md:text-[42px] font-bold leading-[1.15] max-w-2xl"
style={{ color: "var(--text-primary)" }}
>
Alles was Ihr Betrieb braucht.{" "}
<br className="hidden md:block" />
In einer Plattform.
</h2>
<p
className="text-[16px] max-w-lg"
style={{ color: "var(--text-secondary)" }}
>
Von der Auftragsannahme bis zur Rechnungsstellung. HiveGrid vereint alle Werkzeuge.
</p>
</div>
{/* Grid */}
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 w-full">
{features.map(({ icon: Icon, title, desc, href }) => (
<div
key={title}
className="flex flex-col gap-4"
style={{ background: "var(--container-bg)", padding: 32, clipPath: CHAMFER }}
>
<Icon size={24} style={{ color: "var(--accent-yellow)" }} strokeWidth={2} />
<h3
className="text-[18px] font-semibold"
style={{ color: "var(--text-primary)" }}
>
{title}
</h3>
<p
className="text-[14px] leading-relaxed flex-1"
style={{ color: "var(--text-secondary)" }}
>
{desc}
</p>
<Link
href={href}
className="text-[14px] font-semibold hover:underline"
style={{ color: "var(--accent-yellow-dark)" }}
>
Mehr erfahren →
</Link>
</div>
))}
</div>
</div>
</section>
);
}
@@ -0,0 +1,149 @@
"use client";
/* ═══════════════════════════════════════════════════════════════════════
HeroConnect — interactive "connect your AI" card for the KI-Brücke hero.
Toggle between Claude and ChatGPT; each shows the connector URL (copyable)
and the client-specific 3-step connect flow. Content cross-fades on switch.
Presented as an "In Kürze"-style preview (mcp.hivegrid.de is still pilot).
═══════════════════════════════════════════════════════════════════════ */
import { useState } from "react";
import { Sparkle, Copy, Check, ShieldCheck } from "@phosphor-icons/react/ssr";
import { CHAMFER } from "@/lib/chamfer";
const CONNECTOR_URL = "mcp.hivegrid.de";
type Client = {
id: string;
name: string;
viewBox: string;
path: string;
steps: string[];
};
const CLIENTS: Client[] = [
{
id: "claude",
name: "Claude",
viewBox: "0 0 24 24",
path: "m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",
steps: [
"Connector-URL kopieren",
"In Claude: Einstellungen → Connectors → Hinzufügen",
"Anmelden, Rechte freigeben, fertig",
],
},
{
id: "chatgpt",
name: "ChatGPT",
viewBox: "0 0 24 24",
path: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",
steps: [
"Connector-URL kopieren",
"In ChatGPT: Einstellungen → Connectors (Entwicklermodus)",
"Anmelden, Rechte freigeben, fertig",
],
},
];
const CSS = `
@keyframes hc-fade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
@keyframes hc-pulse{0%,100%{opacity:.35;transform:scale(1)}50%{opacity:1;transform:scale(1.35)}}
`;
export default function HeroConnect() {
const [activeId, setActiveId] = useState(CLIENTS[0].id);
const [copied, setCopied] = useState(false);
const client = CLIENTS.find((c) => c.id === activeId) ?? CLIENTS[0];
const copy = () => {
navigator.clipboard?.writeText(`https://${CONNECTOR_URL}`).then(
() => {
setCopied(true);
setTimeout(() => setCopied(false), 1600);
},
() => {},
);
};
return (
<div className="relative w-full lg:w-[520px]" style={{ maxWidth: 520 }}>
<style dangerouslySetInnerHTML={{ __html: CSS }} />
<div
style={{
background: "var(--surface)",
clipPath: CHAMFER,
filter: "drop-shadow(0 30px 60px rgba(15,23,42,0.18)) drop-shadow(0 6px 16px rgba(15,23,42,0.08))",
}}
>
{/* header */}
<div className="flex items-center gap-2 px-5 py-3.5" style={{ background: "var(--container-bg)" }}>
<span className="inline-flex items-center gap-1 text-[12px] font-bold" style={{ color: "var(--accent-yellow-dark)" }}>
<Sparkle size={13} weight="fill" style={{ color: "var(--accent-yellow)" }} /> MCP
</span>
<span className="text-[12.5px] font-medium" style={{ color: "var(--text-secondary)" }}>in Minuten verbunden</span>
<span className="ml-auto inline-flex items-center gap-1.5 text-[11px] font-semibold" style={{ color: "var(--text-tertiary)" }}>
<i className="block w-2 h-2 rounded-full" style={{ background: "#57C05B", animation: "hc-pulse 1.8s ease-in-out infinite" }} />
live
</span>
</div>
{/* client tabs */}
<div className="grid grid-cols-2" style={{ borderBottom: "1px solid var(--border-light)" }}>
{CLIENTS.map((c) => {
const on = c.id === activeId;
return (
<button
key={c.id}
onClick={() => setActiveId(c.id)}
className="relative flex items-center justify-center gap-2 py-3.5 transition-colors"
style={{ background: on ? "var(--surface)" : "var(--bg-muted)" }}
>
<svg viewBox={c.viewBox} className="shrink-0" style={{ height: 18, width: 18, fill: on ? "var(--text-primary)" : "var(--text-tertiary)" }} aria-hidden>
<path d={c.path} />
</svg>
<span className="text-[14.5px] font-bold" style={{ color: on ? "var(--text-primary)" : "var(--text-tertiary)" }}>{c.name}</span>
{on && <span className="absolute left-0 right-0 bottom-0 h-[2.5px]" style={{ background: "var(--accent-yellow)" }} />}
</button>
);
})}
</div>
{/* body (re-keyed per client so it re-animates on switch) */}
<div key={activeId} className="px-5 py-5 flex flex-col gap-5" style={{ animation: "hc-fade 0.28s ease both" }}>
{/* connector URL */}
<div className="flex flex-col gap-1.5">
<span className="text-[11px] font-semibold uppercase tracking-wider" style={{ color: "var(--text-tertiary)" }}>Connector-URL</span>
<div className="flex items-center gap-2 px-3 py-2.5" style={{ background: "var(--container-bg)", borderRadius: 8, border: "1px solid var(--border-light)" }}>
<span className="text-[14px] font-semibold truncate" style={{ color: "var(--text-primary)", fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace" }}>{CONNECTOR_URL}</span>
<button
onClick={copy}
className="ml-auto inline-flex items-center gap-1.5 shrink-0 text-[12.5px] font-bold rounded-md px-2.5 py-1.5 transition-colors"
style={{ background: copied ? "var(--accent-yellow-light)" : "var(--accent-yellow)", color: "var(--accent-yellow-dark)" }}
>
{copied ? <Check size={14} weight="bold" /> : <Copy size={14} weight="bold" />}
{copied ? "Kopiert" : "Kopieren"}
</button>
</div>
</div>
{/* steps */}
<ol className="flex flex-col gap-3">
{client.steps.map((s, i) => (
<li key={i} className="flex items-start gap-3">
<span className="grid place-items-center shrink-0 rounded-full text-[12px] font-extrabold" style={{ width: 24, height: 24, background: "var(--dark-bg)", color: "var(--accent-yellow)" }}>{i + 1}</span>
<span className="text-[14px] leading-snug pt-0.5" style={{ color: "var(--text-secondary)" }}>{s}</span>
</li>
))}
</ol>
{/* footer trust line */}
<div className="flex items-center gap-2 pt-1" style={{ borderTop: "1px solid var(--border-light)", paddingTop: 14 }}>
<ShieldCheck size={16} weight="duotone" style={{ color: "var(--accent-yellow-dark)" }} />
<span className="text-[12.5px]" style={{ color: "var(--text-tertiary)" }}>OAuth 2.1 · du gibst die Rechte frei, jederzeit widerrufbar.</span>
</div>
</div>
</div>
</div>
);
}
@@ -0,0 +1,198 @@
"use client";
import Link from "next/link";
import { CHAMFER } from "@/lib/chamfer";
import Image from "next/image";
import { useRef, useEffect } from "react";
import { gsap } from "gsap";
import DemoButton from "@/components/ui/DemoButton";
export default function HeroSection() {
const sectionRef = useRef<HTMLElement>(null);
const badgeRef = useRef<HTMLSpanElement>(null);
const headlineRef = useRef<HTMLHeadingElement>(null);
const subtextRef = useRef<HTMLParagraphElement>(null);
const buttonsRef = useRef<HTMLDivElement>(null);
const screenshotRef = useRef<HTMLDivElement>(null);
const sealRef = useRef<HTMLAnchorElement>(null);
useEffect(() => {
const ctx = gsap.context(() => {
const tl = gsap.timeline({ defaults: { ease: "power3.out" } });
// Stagger entrance from left side
tl.fromTo(
badgeRef.current,
{ opacity: 0, y: 20 },
{ opacity: 1, y: 0, duration: 0.5 }
)
.fromTo(
headlineRef.current,
{ opacity: 0, y: 30 },
{ opacity: 1, y: 0, duration: 0.7 },
"-=0.3"
)
.fromTo(
subtextRef.current,
{ opacity: 0, y: 20 },
{ opacity: 1, y: 0, duration: 0.5 },
"-=0.4"
)
.fromTo(
buttonsRef.current,
{ opacity: 0, y: 20 },
{ opacity: 1, y: 0, duration: 0.5 },
"-=0.3"
)
.fromTo(
screenshotRef.current,
{ opacity: 0, scale: 0.95, y: 30 },
{ opacity: 1, scale: 1, y: 0, duration: 0.8, ease: "power2.out" },
"-=0.4"
)
.fromTo(
sealRef.current,
{ opacity: 0, scale: 0.8 },
{ opacity: 1, scale: 1, duration: 0.4 },
"-=0.3"
);
}, sectionRef);
return () => ctx.revert();
}, []);
return (
<section
ref={sectionRef}
className="section-full relative overflow-x-clip"
style={{ paddingTop: "var(--hero-top-padding)", paddingBottom: 48 }}
>
<style>{`
@media (min-width: 768px) {
.hero-bottom-pad { padding-bottom: 80px !important; }
}
`}</style>
<div
className="hero-ambient-bg pointer-events-none absolute inset-x-0 -top-28 bottom-0"
aria-hidden="true"
style={{
background: [
"radial-gradient(46% 62% at 5% 8%, rgba(241,183,41,0.34) 0%, rgba(241,183,41,0) 74%)",
"radial-gradient(46% 62% at 95% 24%, rgba(13,110,110,0.28) 0%, rgba(13,110,110,0) 76%)",
"linear-gradient(132deg, var(--accent-yellow-light) 0%, #FFF7E2 32%, var(--surface) 58%, #EDF8F8 76%, var(--accent-teal-light) 100%)",
"linear-gradient(180deg, rgba(255,255,255,0) 72%, var(--surface) 100%)",
].join(", "),
}}
/>
{/* Smooth fade to white at bottom */}
<div
className="absolute inset-x-0 bottom-0 z-[1] pointer-events-none"
style={{ height: 120, background: "linear-gradient(to bottom, transparent, var(--surface))" }}
/>
<div
className="relative z-10 flex flex-col lg:flex-row items-center justify-between gap-8 lg:gap-14 mx-auto"
style={{ maxWidth: "var(--content-width)" }}
>
{/* Left */}
<div className="flex flex-col gap-4 md:gap-6 w-full lg:w-auto lg:flex-1">
{/* Badge */}
<span
ref={badgeRef}
className="self-start text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5 opacity-0"
style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}
>
SHK-SOFTWARE
</span>
{/* Headline */}
<h1
ref={headlineRef}
className="text-[32px] sm:text-[40px] md:text-[56px] font-bold leading-[1.1] opacity-0"
style={{ color: "var(--text-primary)" }}
>
Ihr Betrieb läuft organisiert,{" "}
<span style={{ color: "var(--accent-yellow)" }}>automatisiert</span>{" "}
und effizient.
</h1>
{/* Subtext */}
<p
ref={subtextRef}
className="text-[16px] md:text-[18px] leading-relaxed max-w-xl opacity-0"
style={{ color: "var(--text-secondary)" }}
>
HiveGrid bündelt die wichtigsten Prozesse rund um Anfrage, Auftragsgewinnung und
Projektabwicklung. Weniger manuelle Abstimmung, weniger Zettel, mehr Zeit fürs
Handwerk.
</p>
{/* Buttons */}
<div ref={buttonsRef} className="flex flex-wrap items-stretch gap-3 pt-1 md:pt-2 opacity-0">
<DemoButton />
<Link
href="/kunden"
className="inline-flex items-center justify-center rounded-[var(--radius-button)] text-[16px] font-semibold hover:bg-[var(--bg-muted)] transition-colors"
style={{
color: "var(--text-primary)",
background: "var(--surface)",
padding: "14px 28px",
border: "1.5px solid var(--border-neutral)",
}}
>
Mehr erfahren
</Link>
</div>
</div>
{/* Right App Screenshot with heyData seal overlay */}
<div className="relative w-full lg:w-auto shrink-0" style={{ width: "min(100%, 600px)" }}>
<div
ref={screenshotRef}
className="overflow-hidden opacity-0"
style={{
clipPath: CHAMFER,
filter:
"drop-shadow(0 8px 32px rgba(0,0,0,0.08)) drop-shadow(0 2px 8px rgba(0,0,0,0.04))",
}}
>
<Image
src="/images/hero-screenshot.webp"
alt="HiveGrid Dashboard – Pipeline-Volumen, Umsatzübersicht und Vertriebsperformance auf einen Blick"
width={2980}
height={1402}
className="w-full h-auto block"
draggable={false}
priority
sizes="(max-width: 1024px) 100vw, 600px"
/>
</div>
{/* heyData DSGVO seal — overlapping bottom-right of screenshot */}
<a
ref={sealRef}
href="https://heydata.eu"
target="_blank"
rel="noopener noreferrer"
title="heyData GDPR seal"
className="absolute opacity-0 -bottom-8 -right-2 sm:-bottom-10 sm:-right-3 lg:-bottom-12 lg:-right-4"
style={{
zIndex: 10,
filter: "drop-shadow(0 6px 16px rgba(0,0,0,0.15))",
}}
>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
alt="heyData DSGVO-Siegel"
src="https://api.heydata.eu/privacy-seal/seal/2cdc4714-a706-4790-975c-7c95935905fe?lang=de&design=design1&sealType=GDPR"
className="w-[100px] h-[100px] sm:w-[120px] sm:h-[120px] lg:w-[140px] lg:h-[140px]"
style={{ border: 0 }}
/>
</a>
</div>
</div>
</section>
);
}
@@ -0,0 +1,106 @@
import { CHAMFER } from "@/lib/chamfer";
export default function HowItWorksSection() {
const steps = [
{
num: "01",
title: "Workflow erstellen",
desc: "Erstellen Sie Ihren ersten Workflow und automatisieren Sie wiederkehrende Aufgaben.",
screenshot: "/images/step-workflow-erstellen.webp",
},
{
num: "02",
title: "Trigger definieren",
desc: "Wählen Sie das auslösende Ereignis — z.B. neuer Deal, neuer Kontakt oder Zeitplan.",
screenshot: "/images/step-trigger-definieren.webp",
},
{
num: "03",
title: "Aktionen festlegen",
desc: "Bestimmen Sie, was automatisch passieren soll — E-Mail senden, Projekt erstellen, benachrichtigen.",
screenshot: "/images/step-aktionen.webp",
},
{
num: "04",
title: "Aktivieren & überwachen",
desc: "Schalten Sie Ihre Workflows live und behalten Sie Ausführungen und Erfolgsrate im Blick.",
screenshot: "/images/step-aktivieren.webp",
},
];
return (
<section
className="section-full"
style={{ background: "var(--surface)", paddingBlock: 80 }}
>
<div
className="flex flex-col gap-10 mx-auto"
style={{ maxWidth: "var(--content-width)" }}
>
{/* Header */}
<div className="flex flex-col items-center gap-4 text-center">
<span
className="text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5"
style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}
>
SO FUNKTIONIERT ES
</span>
<h2
className="text-[32px] md:text-[42px] font-bold leading-[1.15]"
style={{ color: "var(--text-primary)" }}
>
In vier Schritten zum automatisierten Betrieb.
</h2>
<p className="text-[16px] max-w-xl" style={{ color: "var(--text-secondary)" }}>
Von der ersten Automation bis zum vollständig vernetzten Workflow. So einfach geht's.
</p>
</div>
{/* Steps */}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
{steps.map((step) => (
<div
key={step.num}
className="flex flex-col gap-4"
style={{ background: "var(--container-bg)", padding: 24, clipPath: CHAMFER }}
>
<span
className="text-[14px] font-semibold tracking-widest"
style={{ color: "var(--accent-yellow)" }}
>
{step.num}
</span>
<h3
className="text-[18px] font-semibold"
style={{ color: "var(--text-primary)" }}
>
{step.title}
</h3>
<p
className="text-[14px] leading-relaxed"
style={{ color: "var(--text-secondary)" }}
>
{step.desc}
</p>
<div
className="rounded-lg overflow-hidden mt-2"
style={{
border: "1px solid var(--border-neutral)",
}}
>
<img
src={step.screenshot}
alt={`Schritt ${step.num}: ${step.title}`}
className="w-full h-auto block"
draggable={false}
loading="lazy"
decoding="async"
/>
</div>
</div>
))}
</div>
</div>
</section>
);
}
@@ -0,0 +1,376 @@
"use client";
import { useEffect, useRef, useState } from "react";
import CanvasHint, { useCanvasHint } from "@/components/ui/CanvasHint";
/* ──────────────────────────────────────────────────────────────────────────
* KanbanBoard — compact, interactive product centrepiece for the
* projektmanagement page. Tight columns (subtle light panels), small white
* cards, draggable between columns (mouse + touch).
*
* Card look modelled on a real PM/CRM board (Pipedrive/Linear-style): a tag +
* priority-flag row, a prominent title, and a footer with overlapping assignee
* avatars and a single prioritised status chip. All in the HiveGrid amber
* palette with inline SVG icons — no external icon/theme deps.
* ────────────────────────────────────────────────────────────────────────── */
type Priority = "high" | "medium" | "low";
type Card = {
id: string;
title: string;
tag: string;
tagColor: string;
who: string;
initials: string;
priority: Priority;
/** second, overlapping avatar (e.g. the assigned monteur) */
monteur?: string;
monteurInitials?: string;
/** status chip, prioritised: overdue › due soon › task count › none */
overdueDays?: number;
dueDays?: number;
taskCount?: number;
};
type Column = { id: string; title: string; accent: string; cards: Card[] };
// Subtle "drag me" wiggle for the top todo card — mostly at rest, a quick nudge
// every few seconds. Stops after the first drag; disabled for reduced motion.
const NUDGE_CSS = `
@keyframes kanban-nudge{0%,78%,100%{transform:rotate(0deg)}83%{transform:rotate(-2.6deg)}88%{transform:rotate(2.4deg)}93%{transform:rotate(-1.4deg)}97%{transform:rotate(0.6deg)}}
.kanban-nudge{animation:kanban-nudge 3.4s ease-in-out infinite;transform-origin:60% 65%}
@media (prefers-reduced-motion:reduce){.kanban-nudge{animation:none}}
`;
const INITIAL: Column[] = [
{
id: "todo",
title: "Zu erledigen",
accent: "#93C5FD",
cards: [
{ id: "c1", title: "Angebot Sanitär — Müller", tag: "Angebot", tagColor: "#3B82F6", who: "Lena Krause", initials: "LK", priority: "high", dueDays: 1 },
{ id: "c2", title: "Baustelle Weber vorbereiten", tag: "Baustelle", tagColor: "#E8A317", who: "Tom Berger", initials: "TB", monteur: "Stefan Müller", monteurInitials: "SM", priority: "medium", taskCount: 3 },
{ id: "c3", title: "Material bestellen — Berger", tag: "Material", tagColor: "#F97316", who: "Sara Möller", initials: "SM", priority: "low", overdueDays: 2 },
],
},
{
id: "doing",
title: "In Arbeit",
accent: "#F1B729",
cards: [
{ id: "c4", title: "Heizungstausch — Schmidt", tag: "Heizung", tagColor: "#E8A317", who: "Tom Berger", initials: "TB", monteur: "Jonas Weiß", monteurInitials: "JW", priority: "high", dueDays: 0 },
{ id: "c5", title: "Bad-Renovierung — Fischer", tag: "Sanitär", tagColor: "#0D6E6E", who: "Lena Krause", initials: "LK", priority: "medium", taskCount: 5 },
],
},
{
id: "done",
title: "Erledigt",
accent: "#22C55E",
cards: [
{ id: "c6", title: "Wartung Anlage Nord", tag: "Wartung", tagColor: "#22C55E", who: "Sara Möller", initials: "SM", priority: "low" },
{ id: "c7", title: "Abnahme — Solarcarport", tag: "Abnahme", tagColor: "#22C55E", who: "Jonas Weiß", initials: "JW", priority: "low" },
],
},
];
/* ─── card sub-parts ──────────────────────────────────────────────────── */
function PriorityFlag({ priority }: { priority: Priority }) {
const color = priority === "high" ? "#EF4444" : priority === "medium" ? "#F1B729" : "#CBD5E1";
const tip = priority === "high" ? "Hohe Priorität" : priority === "medium" ? "Mittlere Priorität" : "Niedrige Priorität";
return (
<span title={tip} className="flex-none" style={{ lineHeight: 0 }}>
<svg width="13" height="13" viewBox="0 0 24 24" fill={color} stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z" />
<line x1="4" y1="22" x2="4" y2="15" />
</svg>
</span>
);
}
function Avatar({ initials, title, variant = "who", overlap = false }: { initials: string; title: string; variant?: "who" | "monteur"; overlap?: boolean }) {
const bg = variant === "monteur" ? "#FFEDD5" : "#E5E7EB";
const fg = variant === "monteur" ? "#C2410C" : "#475569";
return (
<span
title={title}
className="grid place-items-center rounded-full flex-none text-[9px] font-bold"
style={{ width: 20, height: 20, background: bg, color: fg, boxShadow: "0 0 0 2px #FFFFFF", marginLeft: overlap ? -6 : 0 }}
>
{initials}
</span>
);
}
function StatusChip({ card }: { card: Card }) {
const base = "inline-flex items-center gap-1 rounded text-[10px] font-semibold px-1.5 py-0.5";
if (card.overdueDays && card.overdueDays > 0) {
return (
<span className={base} style={{ background: "#FEE2E2", color: "#B91C1C" }} title="Überfällig">
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" /><line x1="12" y1="9" x2="12" y2="13" /><line x1="12" y1="17" x2="12.01" y2="17" /></svg>
{card.overdueDays} T überfällig
</span>
);
}
if (card.dueDays !== undefined && card.dueDays <= 3) {
const label = card.dueDays === 0 ? "Termin Heute" : card.dueDays === 1 ? "Termin Morgen" : `Termin in ${card.dueDays} T`;
return (
<span className={base} style={{ background: "#DBEAFE", color: "#1D4ED8" }} title="Anstehender Termin">
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2" /><line x1="16" y1="2" x2="16" y2="6" /><line x1="8" y1="2" x2="8" y2="6" /><line x1="3" y1="10" x2="21" y2="10" /></svg>
{label}
</span>
);
}
if (card.taskCount && card.taskCount > 0) {
return (
<span className={base} style={{ background: "#F1F5F9", color: "#64748B" }} title={`${card.taskCount} offene Aufgaben`}>
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round"><polyline points="9 11 12 14 22 4" /><path d="M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11" /></svg>
{card.taskCount}
</span>
);
}
return null;
}
function CardBody({ card }: { card: Card }) {
const hasFooter = !!card.initials || !!card.monteurInitials || card.overdueDays || card.dueDays !== undefined || card.taskCount;
return (
<div className="flex flex-col gap-2">
{/* Row 1: tag (left) · priority flag (right) */}
<div className="flex items-start justify-between gap-2">
<span
className="inline-flex text-[10px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded self-start"
style={{ background: `${card.tagColor}1f`, color: card.tagColor, border: `1px solid ${card.tagColor}33` }}
>
{card.tag}
</span>
<PriorityFlag priority={card.priority} />
</div>
{/* Title */}
<span className="text-[13.5px] font-semibold leading-snug" style={{ color: "var(--text-primary)" }}>
{card.title}
</span>
{/* Footer: avatars + single status chip */}
{hasFooter && (
<div className="flex items-center justify-between gap-2 pt-2 mt-0.5" style={{ borderTop: "1px solid var(--border-light)" }}>
<span className="flex items-center min-h-[20px]">
<Avatar initials={card.initials} title={card.who} />
{card.monteurInitials && (
<Avatar initials={card.monteurInitials} title={`Monteur: ${card.monteur ?? ""}`} variant="monteur" overlap />
)}
</span>
<StatusChip card={card} />
</div>
)}
</div>
);
}
export default function KanbanBoard({ hideHeader = false }: { hideHeader?: boolean }) {
const [columns, setColumns] = useState<Column[]>(INITIAL);
const [dragging, setDragging] = useState<
{ cardId: string; fromCol: string; offX: number; offY: number; w: number } | null
>(null);
const [pos, setPos] = useState({ x: 0, y: 0 });
const [overCol, setOverCol] = useState<string | null>(null);
const [hinted, setHinted] = useState(false); // true once the user drags anything → stop the nudge
const posRef = useRef({ x: 0, y: 0 });
const colRefs = useRef<Record<string, HTMLDivElement | null>>({});
// Centered onboarding hint — appears when the board scrolls into view,
// dismissed on the first drag or via the X.
const hint = useCanvasHint<HTMLDivElement>();
const draggedCard = dragging
? columns.find((c) => c.id === dragging.fromCol)?.cards.find((k) => k.id === dragging.cardId) ?? null
: null;
const colUnderPointer = (x: number, y: number): string | null => {
for (const [id, el] of Object.entries(colRefs.current)) {
if (!el) continue;
const r = el.getBoundingClientRect();
if (x >= r.left && x <= r.right && y >= r.top && y <= r.bottom) return id;
}
return null;
};
useEffect(() => {
if (!dragging) return;
// Stop text from being selected anywhere on the page while dragging.
document.body.style.setProperty("user-select", "none");
document.body.style.setProperty("-webkit-user-select", "none");
const onMove = (e: PointerEvent) => {
const x = e.clientX;
const y = e.clientY;
posRef.current = { x, y };
setPos({ x, y });
setOverCol(colUnderPointer(x, y));
};
const onUp = () => {
const target = colUnderPointer(posRef.current.x, posRef.current.y);
if (target && target !== dragging.fromCol) {
setColumns((cols) => {
const card = cols.find((c) => c.id === dragging.fromCol)?.cards.find((k) => k.id === dragging.cardId);
if (!card) return cols;
return cols.map((c) => {
if (c.id === dragging.fromCol) return { ...c, cards: c.cards.filter((k) => k.id !== dragging.cardId) };
if (c.id === target) return { ...c, cards: [...c.cards, card] };
return c;
});
});
}
setDragging(null);
setOverCol(null);
};
window.addEventListener("pointermove", onMove, { passive: true });
window.addEventListener("pointerup", onUp);
window.addEventListener("pointercancel", onUp);
return () => {
window.removeEventListener("pointermove", onMove);
window.removeEventListener("pointerup", onUp);
window.removeEventListener("pointercancel", onUp);
document.body.style.removeProperty("user-select");
document.body.style.removeProperty("-webkit-user-select");
};
}, [dragging]);
const startDrag = (e: React.PointerEvent, colId: string, card: Card) => {
if (e.button !== 0 && e.pointerType === "mouse") return;
setHinted(true);
hint.dismiss();
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();
posRef.current = { x: e.clientX, y: e.clientY };
setPos({ x: e.clientX, y: e.clientY });
setOverCol(colId);
setDragging({ cardId: card.id, fromCol: colId, offX: e.clientX - rect.left, offY: e.clientY - rect.top, w: rect.width });
};
return (
<section
className="section-full"
style={{ background: "var(--surface)", paddingBlock: hideHeader ? 40 : 80, userSelect: dragging ? "none" : undefined }}
>
<style dangerouslySetInnerHTML={{ __html: NUDGE_CSS }} />
<div className="mx-auto flex flex-col gap-5" style={{ maxWidth: 880 }}>
{!hideHeader && (
<div className="flex flex-col items-center gap-4 text-center">
<span
className="text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5"
style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}
>
KANBAN-BOARD
</span>
<h2 className="text-[32px] md:text-[42px] font-bold leading-[1.15]" style={{ color: "var(--text-primary)" }}>
Projekte im Blick.
</h2>
</div>
)}
{/* Board on a dotted "canvas" — same treatment as the workflow editor.
The onboarding popup lives inside it and replaces the old caption. */}
<div
ref={hint.ref}
className="relative rounded-2xl"
style={{
background: "#FAFBFD",
border: "1px solid var(--border-light)",
backgroundImage: "radial-gradient(circle, #E5E7EB 1px, transparent 1px)",
backgroundSize: "24px 24px",
padding: 16,
}}
>
<div className="grid grid-cols-1 sm:grid-cols-3 gap-3 items-start" style={{ touchAction: dragging ? "none" : undefined }}>
{columns.map((col) => {
const isOver = dragging != null && overCol === col.id;
return (
<div
key={col.id}
ref={(el) => {
colRefs.current[col.id] = el;
}}
className="flex flex-col gap-2.5 rounded-xl transition-colors"
style={{
minHeight: 210,
padding: 10,
// a clearly-outlined but soft lane so each column is visibly
// separated (dots still shimmer through the light fill);
// amber dashed drop-zone while a card is dragged over it
background: isOver ? "rgba(241,183,41,0.08)" : "rgba(255,255,255,0.55)",
border: isOver ? "1px dashed var(--accent-yellow)" : "1px solid #CBD5E1",
}}
>
{/* Column header */}
<div className="flex items-center gap-2 px-0.5 pb-0.5">
<span className="inline-block" style={{ width: 7, height: 7, borderRadius: 2, background: col.accent }} />
<span className="text-[11px] font-bold uppercase tracking-wider" style={{ color: "var(--text-secondary)" }}>
{col.title}
</span>
<span
className="ml-auto grid place-items-center text-[10px] font-bold rounded-full"
style={{ minWidth: 18, height: 18, padding: "0 5px", background: "var(--border-light)", color: "var(--text-secondary)" }}
>
{col.cards.length}
</span>
</div>
{/* Cards */}
{col.cards.map((card, idx) => {
const isDragging = dragging?.cardId === card.id;
const nudge = col.id === "todo" && idx === 0 && !hinted && !isDragging;
return (
<div
key={card.id}
onPointerDown={(e) => startDrag(e, col.id, card)}
className={`shadow-sm hover:shadow-md transition-shadow ${nudge ? "select-none kanban-nudge" : "select-none"}`}
style={{
background: "#FFFFFF",
border: "1px solid var(--border-light)",
borderRadius: 10,
padding: "11px 12px",
cursor: isDragging ? "grabbing" : "grab",
opacity: isDragging ? 0.4 : 1,
touchAction: "none",
}}
>
<CardBody card={card} />
</div>
);
})}
</div>
);
})}
</div>
{/* Centered onboarding hint (dismisses on first drag or via X) */}
<CanvasHint show={hint.show} onDismiss={hint.dismiss} title="Karten verschieben" subtitle="Zieh eine Karte in eine andere Spalte" />
</div>
</div>
{/* Floating drag ghost */}
{dragging && draggedCard && (
<div
className="fixed pointer-events-none z-[9999]"
style={{ left: pos.x - dragging.offX, top: pos.y - dragging.offY, width: dragging.w, transform: "rotate(2deg)" }}
>
<div
style={{
background: "#FFFFFF",
border: "1px solid var(--accent-yellow)",
borderRadius: 10,
padding: "11px 12px",
boxShadow: "0 22px 44px -14px rgba(15,23,42,0.4)",
}}
>
<CardBody card={draggedCard} />
</div>
</div>
)}
</section>
);
}
@@ -0,0 +1,207 @@
import type { Icon as PhosphorIcon } from "@phosphor-icons/react";
import type { ScreenshotAccordionItem } from "./ScreenshotAccordion";
import type { ReactNode } from "react";
import CtaBanner, { type CtaVariant } from "@/components/ui/CtaShowcase";
export interface ProductFeature {
icon: PhosphorIcon;
title: string;
desc: string;
}
export type AccordionItem = ScreenshotAccordionItem;
export interface ProductPageData {
badge: string;
headline: string;
subtext: string;
accordionBadge?: string;
accordionHeadline?: string;
accordionItems?: AccordionItem[];
featureHeading: string;
featureSubtext: string;
features: ProductFeature[];
ctaHeadline: string;
ctaSubtext: string;
/** Which shared CTA showcase variant to render (hex | portrait | kanban). */
ctaVariant?: CtaVariant;
/** @deprecated superseded by ctaVariant */
ctaStyle?: "light" | "dark";
ctaSecondaryLabel?: string;
ctaSecondaryHref?: string;
/** Optional extra sections inserted before/after feature grid */
extraSectionBefore?: ReactNode;
extraSectionAfter?: ReactNode;
/** Optional: custom visual for solution right side */
solutionVisual?: ReactNode;
}
// Feature icon inside a honeycomb cell (brand motif) — flat-top hexagon frame
// in the same yellow as the icon, with a subtle tint fill.
function HexIcon({ icon: Icon }: { icon: PhosphorIcon }) {
return (
<span className="relative inline-flex items-center justify-center shrink-0" style={{ width: 54, height: 54 }} aria-hidden>
<svg viewBox="0 0 56 56" className="absolute inset-0 w-full h-full" fill="none">
<path
d="M3 28 L15.5 6.4 L40.5 6.4 L53 28 L40.5 49.6 L15.5 49.6 Z"
fill="var(--accent-yellow-light)"
stroke="var(--text-primary)"
strokeWidth="2"
strokeLinejoin="round"
/>
</svg>
<Icon size={23} weight="duotone" style={{ color: "var(--accent-yellow-dark)" }} className="relative" />
</span>
);
}
export default function ProductPageTemplate({
data,
slug,
}: {
data: ProductPageData;
slug?: string;
}) {
const jsonLd = slug
? [
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
name: `HiveGrid ${data.badge ? "" : ""}${data.headline.split(":")[0]}`.trim(),
description: data.subtext || data.featureSubtext,
applicationCategory: "BusinessApplication",
operatingSystem: "Web, iOS, Android",
url: `https://hivegrid.de/produkt/${slug}`,
offers: {
"@type": "Offer",
price: "0",
priceCurrency: "EUR",
availability: "https://schema.org/InStock",
},
provider: { "@type": "Organization", name: "HiveGrid", url: "https://hivegrid.de" },
},
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
itemListElement: [
{ "@type": "ListItem", position: 1, name: "Home", item: "https://hivegrid.de" },
{ "@type": "ListItem", position: 2, name: "Lösungen", item: "https://hivegrid.de/#loesungen" },
{ "@type": "ListItem", position: 3, name: data.headline.split(":")[0].replace(/^HiveGrid\s*/, "").trim(), item: `https://hivegrid.de/produkt/${slug}` },
],
},
]
: null;
return (
<>
{jsonLd?.map((schema, i) => (
<script
key={i}
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
/>
))}
{/* Hero */}
<section
className="section-full"
style={{ background: "var(--surface)", paddingTop: "var(--hero-top-padding)", paddingBottom: data.subtext ? 80 : 20 }}
>
<div className="flex flex-col items-center gap-8 mx-auto text-center" style={{ maxWidth: 800 }}>
<span
className="text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5"
style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}
>
{data.badge}
</span>
<h1
className="text-[28px] sm:text-[36px] md:text-[56px] font-bold leading-[1.1]"
style={{ color: "var(--text-primary)" }}
>
{data.headline}
</h1>
{data.subtext && (
<p
className="text-[17px] md:text-[18px] leading-relaxed max-w-2xl"
style={{ color: "var(--text-secondary)" }}
>
{data.subtext}
</p>
)}
</div>
</section>
{/* Visualisation (interactive centrepiece, e.g. Kanban / Email builder) */}
{data.extraSectionBefore}
{/* Feature Grid */}
<section className="section-full" style={{ background: "var(--surface)", paddingBlock: 80 }}>
<div
className="flex flex-col items-center gap-12 mx-auto"
style={{ maxWidth: "var(--content-width)" }}
>
<div className="flex flex-col items-center gap-4 text-center" style={{ maxWidth: 700 }}>
<h2
className="text-[32px] md:text-[42px] font-bold leading-[1.15]"
style={{ color: "var(--text-primary)" }}
>
{data.featureHeading}
</h2>
{data.featureSubtext && (
<p className="text-[16px] leading-relaxed" style={{ color: "var(--text-secondary)" }}>
{data.featureSubtext}
</p>
)}
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 w-full">
{data.features.map(({ icon: Icon, title, desc }) => (
<div
key={title}
className="relative overflow-hidden"
style={{
background: "var(--container-bg)",
padding: 32,
// Chamfered (cut) corners instead of rounded — echoes the
// honeycomb geometry and reads less generic-AI than uniform radii.
clipPath:
"polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% calc(100% - 16px), calc(100% - 16px) 100%, 16px 100%, 0 calc(100% - 16px), 0 16px)",
}}
>
{/* HiveGrid honeycomb — subtle, top-right, faded into the card */}
<span
aria-hidden
className="absolute top-0 right-0 pointer-events-none"
style={{
width: "58%",
height: "66%",
backgroundImage: "url(/cta-honeycomb.svg)",
backgroundSize: "230px",
backgroundPosition: "top right",
backgroundRepeat: "no-repeat",
opacity: 0.5,
WebkitMaskImage: "radial-gradient(125% 125% at 100% 0%, #000 0%, transparent 62%)",
maskImage: "radial-gradient(125% 125% at 100% 0%, #000 0%, transparent 62%)",
}}
/>
<div className="relative z-10 flex flex-col gap-4">
<HexIcon icon={Icon} />
<h3 className="text-[18px] font-semibold" style={{ color: "var(--text-primary)" }}>{title}</h3>
<p className="text-[14px] leading-relaxed" style={{ color: "var(--text-secondary)" }}>{desc}</p>
</div>
</div>
))}
</div>
</div>
</section>
{/* Extra section after feature grid (e.g. Bento Grid) */}
{data.extraSectionAfter}
{/* CTA — shared showcase; each product picks the variant that fits */}
<CtaBanner
variant={data.ctaVariant ?? "hex"}
headline={data.ctaHeadline}
sub={data.ctaSubtext}
/>
</>
);
}
@@ -0,0 +1,131 @@
"use client";
/* ═══════════════════════════════════════════════════════════════════════
RequestFlow — animated "watch a request travel through the bridge".
Deine KI → KI-Brücke (MCP) → HiveGrid and back. A packet travels the
track, stations light up, and a caption narrates each step. Auto-plays
and loops; pauses on hover; static under prefers-reduced-motion.
═══════════════════════════════════════════════════════════════════════ */
import { useEffect, useRef, useState } from "react";
import { Sparkle, PlugsConnected, Database } from "@phosphor-icons/react/ssr";
import { CHAMFER } from "@/lib/chamfer";
// Station centres in a 3-column grid → 1/6, 3/6, 5/6.
type Step = { pos: number; active: 0 | 1 | 2; n: string; title: string; detail: string; chip?: string };
const STEPS: Step[] = [
{ pos: 16.7, active: 0, n: "1", title: "Du fragst", detail: "„Zeig mir alle offenen Angebote über 10.000 €.“" },
{ pos: 50, active: 1, n: "2", title: "Über die KI-Brücke", detail: "Die Anfrage läuft sicher über MCP, nur im Rahmen deiner Freigaben." },
{ pos: 83.3, active: 2, n: "3", title: "HiveGrid führt es aus", detail: "Liest nur die Daten deines Betriebs, jeder Zugriff protokolliert.", chip: "hg_project_search · read" },
{ pos: 50, active: 1, n: "4", title: "Antwort zurück", detail: "Das Ergebnis läuft über die Brücke zurück zu deiner KI." },
{ pos: 16.7, active: 0, n: "5", title: "Ergebnis in deiner KI", detail: "3 Treffer, direkt im Chat. Kein Copy-Paste, kein Tab-Wechsel." },
];
const STATIONS = [
{ icon: <Sparkle size={24} weight="duotone" style={{ color: "var(--accent-yellow-dark)" }} />, label: "Deine KI", sub: "Dein KI-Client" },
{ icon: <PlugsConnected size={24} weight="duotone" style={{ color: "var(--accent-yellow)" }} />, label: "KI-Brücke", sub: "MCP", dark: true },
{ icon: <Database size={24} weight="duotone" style={{ color: "var(--accent-yellow-dark)" }} />, label: "HiveGrid", sub: "Deine Betriebsdaten" },
];
export default function RequestFlow() {
const [step, setStep] = useState(0);
const paused = useRef(false);
useEffect(() => {
if (typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
const id = window.setInterval(() => {
if (!paused.current) setStep((s) => (s + 1) % STEPS.length);
}, 3500);
return () => window.clearInterval(id);
}, []);
const cur = STEPS[step];
return (
<div className="w-full mx-auto flex flex-col gap-8" style={{ maxWidth: 920 }}>
{/* bridge + travelling packet */}
<div
className="relative"
onMouseEnter={() => { paused.current = true; }}
onMouseLeave={() => { paused.current = false; }}
>
{/* track line */}
<span className="absolute pointer-events-none" style={{ top: 33, left: "16.7%", right: "16.7%", height: 2, background: "var(--border-light)", borderRadius: 2 }} aria-hidden />
{/* travelling packet */}
<span
className="absolute pointer-events-none rounded-full"
style={{
top: 33, left: `${cur.pos}%`, width: 12, height: 12,
transform: "translate(-50%, -5px)",
background: "var(--accent-yellow)",
boxShadow: "0 0 14px 3px rgba(241,183,41,0.7)",
transition: "left 0.75s cubic-bezier(0.65,0,0.35,1)",
}}
aria-hidden
/>
{/* stations */}
<div className="grid grid-cols-3">
{STATIONS.map((s, i) => {
const on = cur.active === i;
return (
<div key={i} className="flex flex-col items-center gap-2 text-center px-1">
<span
className="relative grid place-items-center rounded-2xl transition-all duration-500"
style={{
width: 64, height: 64,
background: s.dark ? "var(--dark-bg)" : "var(--surface)",
border: `1.5px solid ${on ? "var(--accent-yellow)" : "var(--border-light)"}`,
transform: on ? "scale(1.08)" : "scale(1)",
filter: on ? "drop-shadow(0 8px 18px rgba(241,183,41,0.35))" : "none",
zIndex: 2,
}}
>
{s.icon}
</span>
<span className="text-[14px] md:text-[15px] font-bold" style={{ color: "var(--text-primary)" }}>{s.label}</span>
<span className="text-[11.5px] md:text-[12.5px] leading-snug" style={{ color: "var(--text-tertiary)" }}>{s.sub}</span>
</div>
);
})}
</div>
</div>
{/* caption — narrates the current step */}
<div
className="relative overflow-hidden mx-auto w-full flex items-start gap-4"
style={{ maxWidth: 640, background: "var(--container-bg)", padding: "20px 22px", clipPath: CHAMFER }}
>
<span className="grid place-items-center shrink-0 rounded-full text-[14px] font-extrabold" style={{ width: 32, height: 32, background: "var(--dark-bg)", color: "var(--accent-yellow)" }}>
{cur.n}
</span>
<div className="flex flex-col gap-1 min-w-0">
<span className="text-[16px] font-bold" style={{ color: "var(--text-primary)" }}>{cur.title}</span>
<span className="text-[14px] leading-relaxed" style={{ color: "var(--text-secondary)" }}>{cur.detail}</span>
{/* chip slot: reserve the height always so the appearing chip never
shifts the layout (the page would otherwise jump every cycle). */}
<div className="mt-1.5" style={{ minHeight: 30 }}>
{cur.chip && (
<span className="inline-flex items-center gap-2 self-start px-2.5 py-1 text-[12px]" style={{ background: "var(--surface)", border: "1px solid var(--border-light)", borderRadius: 6, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", color: "var(--text-primary)" }}>
{cur.chip}
</span>
)}
</div>
</div>
</div>
{/* step dots */}
<div className="flex items-center justify-center gap-2 -mt-2">
{STEPS.map((s, i) => (
<button
key={i}
onClick={() => setStep(i)}
aria-label={`Schritt ${s.n}`}
className="rounded-full transition-all"
style={{ width: i === step ? 22 : 8, height: 8, background: i === step ? "var(--accent-yellow)" : "var(--border-light)" }}
/>
))}
</div>
</div>
);
}
@@ -0,0 +1,45 @@
.stage {
position: relative;
display: block;
width: 100%;
aspect-ratio: 16 / 10;
transform: translateY(0) scale(1);
transform-origin: center;
filter: drop-shadow(0 10px 24px rgba(15, 23, 42, 0.08));
transition:
transform 280ms cubic-bezier(0.2, 0, 0, 1),
filter 280ms cubic-bezier(0.2, 0, 0, 1);
}
.stage:hover {
transform: translateY(-4px) scale(1.012);
filter: drop-shadow(0 16px 32px rgba(15, 23, 42, 0.13));
}
.screenLayer {
position: relative;
display: block;
width: 100%;
height: 100%;
}
.screenshot {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
pointer-events: none;
transition: opacity 450ms cubic-bezier(0.4, 0, 0.2, 1);
}
@media (prefers-reduced-motion: reduce) {
.stage,
.stage:hover {
transform: none;
transition: none;
}
.screenshot {
transition: none;
}
}
@@ -0,0 +1,399 @@
"use client";
import { useState, useEffect, useRef } from "react";
import { CHAMFER } from "@/lib/chamfer";
import Link from "next/link";
import { ChevronDown, ArrowRight } from "lucide-react";
import styles from "./ScreenshotAccordion.module.css";
/* ─── Types ───────────────────────────────────────────────────────────── */
export interface ScreenshotAccordionItem {
title: string;
body: string;
/** Path to screenshot image — falls back to a generated placeholder */
screenshot?: string;
/** Optional deep-link to the matching product page (e.g. "/produkt/chat") */
href?: string;
}
interface ScreenshotAccordionProps {
items: ScreenshotAccordionItem[];
/** Optional section badge (e.g. "FUNKTIONEN") */
badge?: string;
/** Optional section headline */
headline?: string;
/** Optional section subtext */
subtext?: string;
/** Auto-cycle interval in ms — set 0 to disable (default: 5000) */
interval?: number;
/** Section background (default white); set to match an adjacent section. */
background?: string;
/** Optional section spacing overrides (default: 80px each). */
paddingTop?: number;
paddingBottom?: number;
}
/* ─── Placeholder SVG ─────────────────────────────────────────────────── */
function placeholderSvg(label: string, index: number): string {
const colors = ["#EEF2FF", "#F0FDF4", "#FFF7ED", "#FDF2F8"];
const accents = ["#6366F1", "#22C55E", "#F97316", "#EC4899"];
const bg = colors[index % colors.length];
const accent = accents[index % accents.length];
return `data:image/svg+xml,${encodeURIComponent(`
<svg xmlns="http://www.w3.org/2000/svg" width="960" height="600" viewBox="0 0 960 600">
<rect width="960" height="600" rx="16" fill="${bg}"/>
<rect x="40" y="40" width="180" height="520" rx="12" fill="white" stroke="#E5E7EB" stroke-width="1"/>
<rect x="56" y="72" width="148" height="32" rx="6" fill="${accent}" opacity="0.15"/>
<rect x="56" y="120" width="120" height="12" rx="4" fill="#D1D5DB"/>
<rect x="56" y="148" width="100" height="12" rx="4" fill="#D1D5DB"/>
<rect x="56" y="176" width="130" height="12" rx="4" fill="#D1D5DB"/>
<rect x="56" y="204" width="90" height="12" rx="4" fill="#D1D5DB"/>
<rect x="56" y="232" width="110" height="12" rx="4" fill="#D1D5DB"/>
<rect x="260" y="40" width="660" height="520" rx="12" fill="white" stroke="#E5E7EB" stroke-width="1"/>
<text x="590" y="280" text-anchor="middle" font-family="Inter,system-ui,sans-serif" font-size="22" font-weight="600" fill="${accent}">${label}</text>
<rect x="420" y="310" width="340" height="8" rx="4" fill="#E5E7EB"/>
<rect x="460" y="334" width="260" height="8" rx="4" fill="#F3F4F6"/>
<rect x="300" y="400" width="180" height="44" rx="8" fill="${accent}" opacity="0.12"/>
<rect x="500" y="400" width="180" height="44" rx="8" fill="${accent}" opacity="0.08"/>
<rect x="300" y="460" width="380" height="44" rx="8" fill="${accent}" opacity="0.06"/>
</svg>
`)}`;
}
/* ─── Component ───────────────────────────────────────────────────────── */
export default function ScreenshotAccordion({
items,
badge,
headline,
subtext,
interval = 5000,
background = "var(--surface)",
paddingTop = 80,
paddingBottom = 80,
}: ScreenshotAccordionProps) {
const [activeIndex, setActiveIndex] = useState(0);
const [progressRunId, setProgressRunId] = useState(0);
const [isInView, setIsInView] = useState(true);
const [bodyMinHeight, setBodyMinHeight] = useState(0);
const cycleTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const sectionRef = useRef<HTMLElement>(null);
const accordionColumnRef = useRef<HTMLDivElement>(null);
const autoCycleEnabled = interval > 0 && items.length > 1;
const shouldAutoCycle = autoCycleEnabled && isInView;
useEffect(() => {
const section = sectionRef.current;
if (!section || typeof IntersectionObserver === "undefined") {
return;
}
const observer = new IntersectionObserver(
(entries) => {
const entry = entries[0];
setIsInView(Boolean(entry?.isIntersecting));
},
{ threshold: 0.2 }
);
observer.observe(section);
return () => {
observer.disconnect();
};
}, []);
useEffect(() => {
if (!shouldAutoCycle) {
if (cycleTimeoutRef.current) {
clearTimeout(cycleTimeoutRef.current);
cycleTimeoutRef.current = null;
}
return;
}
cycleTimeoutRef.current = setTimeout(() => {
setActiveIndex((prev) => (prev + 1) % items.length);
setProgressRunId((prev) => prev + 1);
}, interval);
return () => {
if (cycleTimeoutRef.current) {
clearTimeout(cycleTimeoutRef.current);
cycleTimeoutRef.current = null;
}
};
}, [activeIndex, interval, items.length, shouldAutoCycle]);
useEffect(() => {
const column = accordionColumnRef.current;
if (!column || typeof window === "undefined") {
return;
}
let frameId = 0;
const measure = () => {
const columnWidth = column.clientWidth;
if (columnWidth <= 0) {
return;
}
const bodyWidth = Math.max(0, columnWidth - 24 * 2);
const probe = document.createElement("p");
probe.style.position = "absolute";
probe.style.visibility = "hidden";
probe.style.pointerEvents = "none";
probe.style.margin = "0";
probe.style.padding = "0";
probe.style.width = `${bodyWidth}px`;
probe.style.fontSize = "14px";
probe.style.lineHeight = "1.625";
probe.style.fontFamily = "var(--font-sans)";
probe.style.whiteSpace = "normal";
probe.style.color = "var(--text-secondary)";
column.appendChild(probe);
let maxHeight = 0;
for (const item of items) {
probe.textContent = item.body;
const height = Math.ceil(probe.getBoundingClientRect().height);
if (height > maxHeight) {
maxHeight = height;
}
}
column.removeChild(probe);
setBodyMinHeight(maxHeight);
};
const scheduleMeasure = () => {
if (frameId) {
cancelAnimationFrame(frameId);
}
frameId = requestAnimationFrame(measure);
};
scheduleMeasure();
const resizeObserver =
typeof ResizeObserver !== "undefined"
? new ResizeObserver(scheduleMeasure)
: null;
resizeObserver?.observe(column);
window.addEventListener("resize", scheduleMeasure);
return () => {
resizeObserver?.disconnect();
window.removeEventListener("resize", scheduleMeasure);
if (frameId) {
cancelAnimationFrame(frameId);
}
};
}, [items]);
const handleClick = (index: number) => {
setActiveIndex(index);
setProgressRunId((prev) => prev + 1);
};
const hasHeader = badge || headline || subtext;
const activeHref = items[activeIndex]?.href;
return (
<section
ref={sectionRef}
className="section-full"
style={{ background, paddingTop, paddingBottom }}
>
<div className="mx-auto" style={{ maxWidth: "var(--content-width)" }}>
{/* Optional header */}
{hasHeader && (
<div className="flex flex-col items-center gap-4 text-center mb-16">
{badge && (
<span
className="text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5"
style={{
background: "var(--accent-yellow-light)",
color: "var(--accent-yellow-dark)",
}}
>
{badge}
</span>
)}
{headline && (
<h2
className="text-[32px] md:text-[42px] font-bold leading-[1.15]"
style={{ color: "var(--text-primary)" }}
>
{headline}
</h2>
)}
{subtext && (
<p
className="text-[16px] md:text-[18px] leading-relaxed max-w-2xl"
style={{ color: "var(--text-secondary)" }}
>
{subtext}
</p>
)}
</div>
)}
{/* Content: Accordion + Screenshot */}
<div className="flex flex-col lg:flex-row items-start gap-12">
{/* Left: Accordion */}
<div ref={accordionColumnRef} className="flex flex-col w-full lg:w-[400px] shrink-0">
{items.map((item, i) => {
const isActive = i === activeIndex;
return (
<div
key={item.title}
// When active, bleed the card outward by its padding (lg only,
// to avoid horizontal overflow on the full-width mobile column)
// so its text lines up flush with the closed items instead of
// being indented by the 24px padding.
className={isActive ? "lg:-mx-6" : undefined}
style={{
background: isActive ? "var(--container-bg)" : "transparent",
clipPath: isActive ? CHAMFER : undefined,
padding: isActive ? "24px" : 0,
transition: "all 0.2s ease",
}}
>
{/* Header row = the toggle. Body + link live OUTSIDE the button
so the product link can be a valid <a> (no <a> in <button>). */}
<button
onClick={() => handleClick(i)}
className="w-full text-left group"
style={{ padding: isActive ? 0 : "20px 0", background: "transparent" }}
>
{/* Progress bar for active item */}
{isActive && autoCycleEnabled && (
<div
className="mb-4 rounded-full overflow-hidden"
style={{ height: 3, background: "var(--border-light)" }}
>
<div
key={`${activeIndex}-${progressRunId}-${shouldAutoCycle ? "run" : "pause"}`}
className="h-full rounded-full"
style={{
width: "100%",
background: "var(--accent-yellow)",
transformOrigin: "left center",
transform: "scaleX(0)",
animation: shouldAutoCycle
? `accordion-progress-fill ${interval}ms linear forwards`
: "none",
}}
/>
</div>
)}
<div className="flex items-center justify-between gap-3">
<span
className="text-[18px] font-bold"
style={{
color: isActive
? "var(--text-primary)"
: "var(--text-secondary)",
}}
>
{item.title}
</span>
<ChevronDown
size={18}
className="shrink-0 transition-transform duration-200"
style={{
color: "var(--text-muted)",
transform: isActive ? "rotate(180deg)" : "rotate(0deg)",
}}
/>
</div>
</button>
{/* Body + product-page link (active only) */}
{isActive && (
<div className="mt-2 flex flex-col items-start gap-3">
<p
className="text-[14px] leading-relaxed"
style={{
color: "var(--text-secondary)",
minHeight: bodyMinHeight > 0 ? `${bodyMinHeight}px` : undefined,
}}
>
{item.body}
</p>
{item.href && (
<Link
href={item.href}
className="inline-flex items-center gap-1.5 text-[14px] font-semibold transition-transform duration-200 hover:translate-x-0.5"
style={{ color: "var(--accent-yellow-dark)" }}
>
Mehr zu {item.title}
<ArrowRight size={15} />
</Link>
)}
</div>
)}
{/* Divider between closed items */}
{!isActive && i !== items.length - 1 && activeIndex !== i + 1 && (
<div style={{ height: 1, background: "var(--border-light)" }} />
)}
</div>
);
})}
</div>
{/* Right: fixed screenshot stage. Every image occupies the same absolute
layer, so switching modules never changes the row dimensions. The
stage itself lifts on hover; the image is never zoomed inside a
clipped frame, keeping every edge of the product UI visible. */}
<div className="flex-1 w-full min-w-0">
{(() => {
const screenLayer = (
<span className={styles.screenLayer}>
{items.map((item, i) => (
<img
key={item.title}
src={item.screenshot ?? placeholderSvg(item.title, i)}
alt={`Screenshot: ${item.title}`}
className={styles.screenshot}
style={{
opacity: i === activeIndex ? 1 : 0,
objectFit: item.screenshot ? "contain" : "cover",
}}
loading="lazy"
decoding="async"
draggable={false}
/>
))}
</span>
);
return activeHref ? (
<Link
href={activeHref}
aria-label={`Mehr zu ${items[activeIndex]?.title}`}
className={`${styles.stage} cursor-pointer`}
>
{screenLayer}
</Link>
) : (
<div className={styles.stage}>
{screenLayer}
</div>
);
})()}
</div>
</div>
</div>
</section>
);
}
@@ -0,0 +1,370 @@
import {
Kanban, BellRing, Link as LinkIcon, Radar, TrendingUp, Users,
FileText, CircleCheckBig, Zap,
} from "lucide-react";
/* ── Feature list data (teal icons, matching design) ── */
const features = [
{ icon: Kanban, title: "Visuelle Pipeline-Ansicht", desc: "Deals per Drag-and-Drop verwalten" },
{ icon: BellRing, title: "Automatische Follow-ups", desc: "Nie wieder Nachfassen vergessen" },
{ icon: LinkIcon, title: "Angebots-Verknüpfung", desc: "Angebote direkt mit Deals verbinden" },
{ icon: Radar, title: "Lead-Quellen-Tracking", desc: "Wissen, woher deine Leads kommen" },
{ icon: TrendingUp, title: "Umsatzprognose", desc: "Präzise Vorhersagen für deinen Umsatz" },
{ icon: Users, title: "Team-Zuteilung", desc: "Leads automatisch dem Team zuweisen" },
];
/* ── Notification pills ── */
const notifications = [
{ dot: "#F1B729", bg: "#FEF7E0", color: "#C4931E", text: "Neuer Auftrag", pl: 20 },
{ dot: "#34A853", bg: "#EBF5EB", color: "#2D7A3A", text: "Projekt abgeschlossen", pl: 32 },
{ dot: "#5856D6", bg: "#EEF2FF", color: "#4845B0", text: "Termin morgen 10:00", pl: 44 },
];
/* ═══════════════════════════════════════════════════════
COMPONENT
═══════════════════════════════════════════════════════ */
export default function VertriebBentoGrid() {
return (
<section className="section-full" style={{ background: "#FFFFFF", paddingBlock: 80 }}>
<div className="flex flex-col gap-4 mx-auto" style={{ maxWidth: "var(--content-width)" }}>
{/* ── TOP ROW ─────────────────────────────────── */}
<div className="flex flex-col lg:flex-row gap-4" style={{ minHeight: 520 }}>
{/* ▸ Left Column (Features + Bottom Pair) */}
<div className="flex-1 flex flex-col gap-4">
{/* Tile — "Alles was Sie brauchen" */}
<div
className="flex-1 rounded-3xl flex flex-col gap-6 overflow-hidden"
style={{ background: "#FFFFFF", border: "1px solid #E2E2E7", padding: 32 }}
>
<h3 className="text-[28px] font-bold" style={{ color: "var(--text-primary)" }}>
Alles, was du brauchst
</h3>
<div className="flex flex-col gap-5">
{/* Row 1 */}
<div className="flex gap-5">
{features.slice(0, 3).map((f) => (
<FeatureItem key={f.title} {...f} />
))}
</div>
{/* Row 2 */}
<div className="flex gap-5">
{features.slice(3, 6).map((f) => (
<FeatureItem key={f.title} {...f} />
))}
</div>
</div>
</div>
{/* Bottom Pair: Automatisierung + Benachrichtigungen */}
<div className="flex gap-4" style={{ height: 240, flexShrink: 0 }}>
{/* Tile — Automatisierung (Trigger → Zap → Action) */}
<div
className="flex-1 rounded-3xl flex flex-col overflow-hidden"
style={{ background: "#FFFFFF", border: "1px solid #E2E2E7" }}
>
{/* Visual */}
<div
className="flex items-center justify-center gap-3 flex-1 rounded-xl mx-6 mt-4"
style={{ background: "#F8F9FA", padding: "24px 32px" }}
>
{/* Trigger card */}
<div className="rounded-xl flex flex-col gap-1.5" style={{ background: "#FEF7E0", padding: "10px 14px", width: 130 }}>
<span
className="self-start text-[9px] font-bold tracking-wide rounded px-2 py-0.5 text-white"
style={{ background: "#C4931E", letterSpacing: 0.5 }}
>
TRIGGER
</span>
<span className="text-[11px] font-semibold" style={{ color: "var(--dark-bg)" }}>
Status → Fertig
</span>
</div>
{/* Zap icon */}
<Zap size={20} style={{ color: "var(--accent-yellow)" }} />
{/* Action card */}
<div className="rounded-xl flex flex-col gap-1.5" style={{ background: "#EBF5EB", padding: "10px 14px", width: 130 }}>
<span
className="self-start text-[9px] font-bold tracking-wide rounded px-2 py-0.5 text-white"
style={{ background: "#22C55E", letterSpacing: 0.5 }}
>
AKTION
</span>
<span className="text-[11px] font-semibold" style={{ color: "var(--dark-bg)" }}>
E-Mail senden
</span>
</div>
</div>
{/* Text */}
<div className="flex flex-col gap-1 px-6 py-4">
<span className="text-[17px] font-bold" style={{ color: "var(--text-primary)" }}>
Automatisierung
</span>
<span className="text-[13px]" style={{ color: "var(--text-secondary)" }}>
Workflows automatisch bei Statusänderungen auslösen
</span>
</div>
</div>
{/* Tile — Benachrichtigungen */}
<div
className="flex-1 rounded-3xl flex flex-col gap-3 overflow-hidden"
style={{ background: "#FFFFFF", border: "1px solid #E2E2E7", padding: 24 }}
>
{/* Notification pills */}
<div
className="flex flex-col items-center justify-center gap-1.5 flex-1 rounded-xl"
style={{ background: "#F8F9FA" }}
>
{notifications.map((n) => (
<div
key={n.text}
className="flex items-center gap-2 rounded-lg"
style={{
background: n.bg,
height: 30,
padding: `0 12px 0 ${n.pl}px`,
}}
>
<span
className="rounded-full"
style={{ width: 6, height: 6, background: n.dot, flexShrink: 0 }}
/>
<span className="text-[12px] font-medium" style={{ color: n.color }}>
{n.text}
</span>
</div>
))}
</div>
{/* Text */}
<div className="flex flex-col gap-0.5">
<span className="text-[17px] font-bold" style={{ color: "var(--text-primary)" }}>
Benachrichtigungen
</span>
<span className="text-[13px]" style={{ color: "var(--text-secondary)" }}>
Immer informiert, in Echtzeit.
</span>
</div>
</div>
</div>
</div>
{/* ▸ Right Column — Tile "Angebote" */}
<div
className="shrink-0 rounded-3xl flex flex-col justify-end gap-5 overflow-hidden"
style={{ background: "#FFFFFF", border: "1px solid #E2E2E7", padding: 28, width: 420 }}
>
{/* Visual area */}
<div className="relative flex-1 rounded-2xl overflow-hidden" style={{ background: "#F8F9FA" }}>
{/* Tilted document */}
<div
className="absolute rounded-xl flex flex-col gap-2.5 opacity-70"
style={{
left: 50, top: 180, width: 210,
padding: "16px 18px",
background: "#FFFFFF",
boxShadow: "0 4px 16px rgba(0,0,0,0.08)",
transform: "rotate(-4deg)",
}}
>
<div className="flex items-center gap-2">
<FileText size={16} style={{ color: "var(--text-secondary)" }} />
<span className="text-[12px] font-semibold leading-snug" style={{ color: "var(--text-primary)" }}>
Dein Angebot mit Fördergarantie
</span>
</div>
<div className="rounded-sm" style={{ height: 4, width: 160, background: "#E5E7EB" }} />
<div className="rounded-sm" style={{ height: 4, width: 120, background: "#E5E7EB" }} />
</div>
{/* Floating Card */}
<div
className="absolute rounded-2xl flex flex-col gap-4"
style={{
left: 30, top: 24, width: 260,
padding: 20,
background: "#FFFFFF",
boxShadow: "0 8px 32px rgba(0,0,0,0.1)",
}}
>
{/* Header */}
<div className="flex items-center justify-between">
<span className="text-[18px] font-bold" style={{ color: "var(--text-primary)" }}>
Angebot
</span>
<span
className="text-[11px] font-semibold text-white rounded-md px-2.5 py-1"
style={{ background: "#22C55E" }}
>
Fertig
</span>
</div>
{/* Progress bars */}
<div className="flex flex-col gap-2.5">
<ProgressBar width="85%" />
<ProgressBar width="62%" />
<ProgressBar width="45%" />
</div>
{/* Action row */}
<div className="flex items-center justify-between">
<div className="flex items-center gap-1.5">
<CircleCheckBig size={16} style={{ color: "#22C55E" }} />
<span className="text-[12px] font-medium" style={{ color: "var(--text-secondary)" }}>
Im Kundenportal
</span>
</div>
<span
className="text-[12px] font-semibold text-white rounded-lg px-3.5 py-1.5"
style={{ background: "#5856D6" }}
>
Teilen
</span>
</div>
</div>
</div>
{/* Text area */}
<div className="flex flex-col gap-1.5">
<span className="text-[20px] font-bold" style={{ color: "var(--text-primary)" }}>
Angebote
</span>
<span className="text-[14px] leading-snug" style={{ color: "var(--text-secondary)" }}>
Professionelle Angebote erstellen und direkt im Kundenportal teilen.
</span>
</div>
</div>
</div>
{/* ── BOTTOM ROW — Umsatzprognose ─────────── */}
<div
className="rounded-3xl flex flex-col lg:flex-row gap-10 overflow-hidden"
style={{ background: "#FFFFFF", border: "1px solid #E2E2E7", padding: 32, minHeight: 320 }}
>
{/* Text column */}
<div className="flex flex-col justify-center gap-5 shrink-0" style={{ width: "min(100%, 320px)" }}>
<h3 className="text-[28px] font-bold" style={{ color: "var(--text-primary)" }}>
Umsatzprognose
</h3>
<p className="text-[15px] leading-relaxed" style={{ color: "var(--text-secondary)" }}>
Behalte deine Umsatzziele im Blick. Echtzeit-Prognosen auf Basis deiner
Pipeline, automatisch berechnet.
</p>
<div className="flex gap-4">
<KPIBox value="€284k" label="Prognose" color="var(--text-primary)" />
<KPIBox value="€198k" label="Gesichert" color="#22C55E" />
</div>
</div>
{/* Chart area */}
<div
className="flex-1 rounded-2xl relative overflow-hidden"
style={{ background: "#F8F9FA", minHeight: 240 }}
>
<svg className="w-full h-full" viewBox="0 0 660 250" fill="none" preserveAspectRatio="xMidYMid meet">
{/* Grid lines */}
{[80, 120, 160, 200].map((y) => (
<line key={y} x1="30" y1={y} x2="640" y2={y} stroke="#E5E7EB" strokeWidth="1" />
))}
{/* Chart header */}
<text x="30" y="30" fontSize="13" fontWeight="600" fill="var(--text-secondary)" fontFamily="Inter">
2026
</text>
{/* Revenue curve */}
<path
d="M40 180 C80 175, 120 155, 160 150 C200 145, 240 140, 280 135 C320 130, 360 115, 400 110 C440 105, 480 95, 520 88 C560 82, 600 70, 620 65"
stroke="#5856D6" strokeWidth="2.5" strokeLinecap="round" fill="none"
/>
{/* Fill area */}
<path
d="M40 180 C80 175, 120 155, 160 150 C200 145, 240 140, 280 135 C320 130, 360 115, 400 110 C440 105, 480 95, 520 88 C560 82, 600 70, 620 65 L620 220 L40 220 Z"
fill="url(#chartGrad)" opacity="0.5"
/>
<defs>
<linearGradient id="chartGrad" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stopColor="#5856D6" stopOpacity="0.12" />
<stop offset="100%" stopColor="#5856D6" stopOpacity="0.02" />
</linearGradient>
</defs>
{/* Dots */}
{[
[40, 180], [160, 150], [280, 135], [400, 110], [520, 88],
].map(([cx, cy], i) => (
<circle key={i} cx={cx} cy={cy} r={4} fill="#5856D6" />
))}
{/* Last dot — hollow with glow */}
<circle cx={620} cy={65} r={5} fill="#FFFFFF" stroke="#5856D6" strokeWidth={2.5} />
{/* Month labels */}
{["Jan", "Feb", "Mär", "Apr", "Mai", "Jun"].map((m, i) => (
<text
key={m}
x={40 + i * 116}
y={240}
fontSize="11"
fontWeight="500"
fill="#888888"
fontFamily="Inter"
textAnchor="middle"
>
{m}
</text>
))}
</svg>
</div>
</div>
</div>
</section>
);
}
/* ── Sub-components ── */
function FeatureItem({ icon: Icon, title, desc }: { icon: typeof Kanban; title: string; desc: string }) {
return (
<div
className="flex items-center gap-3 flex-1 rounded-xl"
style={{ background: "#F8F9FA", padding: 12 }}
>
<Icon size={24} style={{ color: "var(--accent-teal)", flexShrink: 0 }} strokeWidth={2} />
<div className="flex flex-col gap-0.5">
<span className="text-[14px] font-semibold" style={{ color: "var(--text-primary)" }}>
{title}
</span>
<span className="text-[12px]" style={{ color: "var(--text-secondary)" }}>
{desc}
</span>
</div>
</div>
);
}
function ProgressBar({ width }: { width: string }) {
return (
<div className="rounded-sm overflow-hidden" style={{ height: 6, background: "#E5E7EB" }}>
<div className="rounded-sm h-full" style={{ width, background: "#D0D0D0" }} />
</div>
);
}
function KPIBox({ value, label, color }: { value: string; label: string; color: string }) {
return (
<div
className="rounded-xl flex flex-col gap-0.5"
style={{ background: "#F8F9FA", padding: "12px 16px", border: "1px solid #E8E8ED" }}
>
<span className="text-[24px] font-bold" style={{ color }}>{value}</span>
<span className="text-[12px] font-medium" style={{ color: "var(--text-secondary)" }}>{label}</span>
</div>
);
}
@@ -0,0 +1,328 @@
"use client";
import { FormEvent, useEffect, useRef, useState } from "react";
import { Hash, SendHorizontal, UserRound } from "lucide-react";
/* ──────────────────────────────────────────────────────────────────────────
* WebChatDemo — interactive desktop chat workspace for the chat subpage. Four
* project channels, each with a fixed conversation. Click a channel to open it
* (its unread badge clears). When you send a message, the team's conversation
* simply CONTINUES — the next scripted message replies to the thread, not to
* your line — so it feels like a live chat you dropped into. Own messages use
* the site's secondary colour (teal). The mobile app is a "coming soon" below.
* ────────────────────────────────────────────────────────────────────────── */
const OWN_BG = "#0D6E6E";
const OWN_BORDER = "#0A5A5A";
const OTHER_BG = "#FFFFFF";
const OTHER_BORDER = "#E9E7E5";
const SENDER = "#C4931E";
type Author = "team" | "self" | "assistant";
type Message = { id: string; sender: string; text: string; time: string; author: Author };
type ScriptMsg = { sender: string; text: string; author: Author };
type Channel = { id: string; name: string; meta: string; unread: number; seed: Message[]; followups: ScriptMsg[] };
// Fixed per-channel conversations (identical on every refresh). `followups`
// continue the thread after each user message — they never address the user.
const CHANNELS: Channel[] = [
{
id: "heizung",
name: "Heizungsprojekt Schulz",
meta: "4 Mitglieder · 2 online",
unread: 0,
seed: [
{ id: "h1", sender: "Murat Kaya", text: "Foto vom Heizungskeller hochgeladen.", time: "09:12", author: "team" },
{ id: "h2", sender: "Lea Brandt", text: "Aufmaß ist fertig, schicke gleich die Unterlagen.", time: "09:15", author: "team" },
{ id: "h3", sender: "Du", text: "Super, dann können wir morgen mit der Installation anfangen. 👍", time: "09:17", author: "self" },
{ id: "h4", sender: "Murat Kaya", text: "Material ist bestellt, Lieferung Donnerstag.", time: "09:20", author: "team" },
{ id: "h5", sender: "Daniel Reiter", text: "Hinweis: Für morgen fehlt noch eine verbindliche Terminbestätigung vom Kunden.", time: "09:21", author: "assistant" },
],
followups: [
{ sender: "Lea Brandt", text: "Der Kunde meldet sich sonst eigentlich immer recht zuverlässig zurück.", author: "team" },
{ sender: "Murat Kaya", text: "Werkzeug und Material für morgen liegen jedenfalls schon bereit.", author: "team" },
{ sender: "Tom Berger", text: "Wetter soll morgen auch passen – trocken und mild.", author: "team" },
{ sender: "Sara Möller", text: "Dann steht dem Start ja nichts mehr im Weg. 👍", author: "team" },
{ sender: "Murat Kaya", text: "Bin gespannt, wird ein schönes Projekt.", author: "team" },
],
},
{
id: "bad",
name: "Bad-Renovierung Fischer",
meta: "3 Mitglieder · 1 online",
unread: 3,
seed: [
{ id: "b1", sender: "Lea Brandt", text: "Fliesen sind heute früh angekommen, alles vollständig.", time: "08:40", author: "team" },
{ id: "b2", sender: "Tom Berger", text: "Alte Wanne ist raus, der Estrich muss aber noch trocknen.", time: "08:52", author: "team" },
{ id: "b3", sender: "Du", text: "Top. Ab wann kann der Fliesenleger ran?", time: "09:03", author: "self" },
{ id: "b4", sender: "Tom Berger", text: "Ab Donnerstag, dann ist der Estrich durch.", time: "09:05", author: "team" },
{ id: "b5", sender: "Daniel Reiter", text: "Erinnerung: Die Sonderanfertigung für die Dusche muss bis Mittwoch bestellt sein.", time: "09:08", author: "assistant" },
],
followups: [
{ sender: "Tom Berger", text: "Der Kunde war heute kurz da und ist echt zufrieden mit dem Fortschritt.", author: "team" },
{ sender: "Lea Brandt", text: "Die Armaturen sind übrigens auch schon im Lager angekommen.", author: "team" },
{ sender: "Murat Kaya", text: "Fugenfarbe wird Anthrazit, da hat sich der Kunde festgelegt.", author: "team" },
{ sender: "Sara Möller", text: "Dann liegen wir ja voll im Zeitplan – sauber.", author: "team" },
{ sender: "Tom Berger", text: "👍 Läuft rund hier.", author: "team" },
],
},
{
id: "team",
name: "Team Allgemein",
meta: "12 Mitglieder · 5 online",
unread: 0,
seed: [
{ id: "t1", sender: "Sara Möller", text: "Morgen um 8 kurzes Teammeeting zur Wochenplanung.", time: "07:30", author: "team" },
{ id: "t2", sender: "Jonas Weiß", text: "Bin ab 10 auf der Baustelle Weber, danach im Büro.", time: "07:45", author: "team" },
{ id: "t3", sender: "Du", text: "Passt. Die Kaffeekasse ist übrigens wieder leer 😅", time: "07:50", author: "self" },
{ id: "t4", sender: "Lea Brandt", text: "😄 Ich kümmere mich drum, bring gleich was mit.", time: "07:52", author: "team" },
],
followups: [
{ sender: "Jonas Weiß", text: "Danke Lea! 🙌", author: "team" },
{ sender: "Sara Möller", text: "Kurze Info fürs Team: Der neue Transporter ist ab Freitag da.", author: "team" },
{ sender: "Murat Kaya", text: "Oh nice, wurde auch Zeit. 😄", author: "team" },
{ sender: "Sara Möller", text: "Details und Schlüsselübergabe kommen noch per Mail.", author: "team" },
{ sender: "Tom Berger", text: "Top, danke fürs Update! 👍", author: "team" },
],
},
{
id: "wartung",
name: "Wartung & Service",
meta: "5 Mitglieder · 3 online",
unread: 1,
seed: [
{ id: "w1", sender: "Murat Kaya", text: "Notdienst-Anruf: Heizung bei Familie Krause ausgefallen.", time: "11:02", author: "team" },
{ id: "w2", sender: "Du", text: "Wer kann heute noch hin?", time: "11:04", author: "self" },
{ id: "w3", sender: "Tom Berger", text: "Ich fahre direkt nach dem Mittag raus.", time: "11:06", author: "team" },
{ id: "w4", sender: "Daniel Reiter", text: "Neuer Wartungsvertrag Bäckerei Nowak startet am 01.08. – Ersttermin einplanen.", time: "11:10", author: "assistant" },
],
followups: [
{ sender: "Sara Möller", text: "Für die Bäckerei Nowak wäre Montagvormittag ein guter Ersttermin, oder?", author: "team" },
{ sender: "Lea Brandt", text: "Klingt gut, der Kunde ist da erfahrungsgemäß flexibel.", author: "team" },
{ sender: "Tom Berger", text: "Bei Familie Krause war's vorhin übrigens nur die Umwälzpumpe – läuft wieder.", author: "team" },
{ sender: "Murat Kaya", text: "Ah, gut zu wissen. Die war ja schon länger auffällig.", author: "team" },
{ sender: "Sara Möller", text: "Dann haben wir für heute ja alles im Griff. 👍", author: "team" },
],
},
];
// Neutral team continuations once a channel's scripted follow-ups run out.
const GENERIC: ScriptMsg[] = [
{ sender: "Lea Brandt", text: "Alles klar, machen wir so.", author: "team" },
{ sender: "Murat Kaya", text: "👍", author: "team" },
{ sender: "Tom Berger", text: "Passt für mich.", author: "team" },
{ sender: "Sara Möller", text: "Notiert, danke!", author: "team" },
{ sender: "Daniel Reiter", text: "Ich halte alles im Projekt fest.", author: "assistant" },
];
function nowTime(): string {
return new Intl.DateTimeFormat("de-DE", { hour: "2-digit", minute: "2-digit" }).format(new Date());
}
function newId(): string {
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") return crypto.randomUUID();
return `web-${Date.now()}-${Math.random().toString(16).slice(2)}`;
}
export default function WebChatDemo() {
const [activeId, setActiveId] = useState<string>(CHANNELS[0].id);
const [threads, setThreads] = useState<Record<string, Message[]>>(() =>
Object.fromEntries(CHANNELS.map((c) => [c.id, c.seed]))
);
const [unread, setUnread] = useState<Record<string, number>>(() =>
Object.fromEntries(CHANNELS.map((c) => [c.id, c.unread]))
);
const [draft, setDraft] = useState("");
const [replyingIn, setReplyingIn] = useState<string | null>(null);
const scrollRef = useRef<HTMLDivElement>(null);
// how many follow-ups a channel has already revealed
const followIdx = useRef<Record<string, number>>({});
const active = CHANNELS.find((c) => c.id === activeId) ?? CHANNELS[0];
const messages = threads[activeId] ?? [];
const busy = replyingIn === activeId;
useEffect(() => {
const el = scrollRef.current;
if (el) el.scrollTop = el.scrollHeight;
}, [messages, activeId, replyingIn]);
function selectChannel(id: string) {
setActiveId(id);
setUnread((u) => (u[id] ? { ...u, [id]: 0 } : u));
setDraft("");
}
async function handleSubmit(event: FormEvent<HTMLFormElement>) {
event.preventDefault();
const trimmed = draft.trim();
if (!trimmed || busy) return;
const channelId = activeId;
const channel = CHANNELS.find((c) => c.id === channelId) ?? CHANNELS[0];
const userMsg: Message = { id: newId(), sender: "Du", text: trimmed, time: nowTime(), author: "self" };
setThreads((t) => ({ ...t, [channelId]: [...(t[channelId] ?? []), userMsg] }));
setDraft("");
setReplyingIn(channelId);
// The conversation just continues — reveal the next scripted line (which
// answers the previous thread, not the user's message).
const i = followIdx.current[channelId] ?? 0;
const next =
channel.followups[i] ?? GENERIC[(i - channel.followups.length) % GENERIC.length];
followIdx.current[channelId] = i + 1;
await new Promise((r) => setTimeout(r, 750));
setThreads((t) => ({
...t,
[channelId]: [...(t[channelId] ?? []), { id: newId(), sender: next.sender, text: next.text, time: nowTime(), author: next.author }],
}));
setReplyingIn((prev) => (prev === channelId ? null : prev));
}
return (
<section className="section-full" style={{ background: "var(--surface)", paddingBlock: 80 }}>
{/* Desktop chat workspace */}
<div
className="mx-auto w-full overflow-hidden flex"
style={{
maxWidth: 940,
height: 520,
background: "#FFFFFF",
border: "1px solid var(--border-light)",
borderRadius: 16,
boxShadow: "0 24px 60px -24px rgba(15,23,42,0.28)",
}}
>
{/* Sidebar — clickable channels */}
<aside
className="hidden md:flex flex-col shrink-0"
style={{ width: 240, background: "var(--container-bg)", borderRight: "1px solid var(--border-light)" }}
>
<div className="flex items-center gap-2.5 px-4 shrink-0" style={{ height: 60, borderBottom: "1px solid var(--border-light)" }}>
<span
className="shrink-0 overflow-hidden"
style={{
width: 36,
height: 31, // flat-top hexagon (2:√3), matches the honeycomb cells
clipPath: "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)",
}}
>
<img src="/geerkens-logo.png" alt="Geerkens" className="w-full h-full object-cover" draggable={false} />
</span>
<span className="flex flex-col min-w-0">
<span className="text-[13px] font-bold truncate" style={{ color: "var(--text-primary)" }}>Geerkens GmbH</span>
<span className="text-[11px]" style={{ color: "var(--text-tertiary)" }}>Workspace</span>
</span>
</div>
<div className="flex flex-col gap-0.5 p-2 overflow-hidden">
<span className="px-2 pt-2 pb-1 text-[10px] font-bold uppercase tracking-widest" style={{ color: "var(--text-tertiary)" }}>Projekte</span>
{CHANNELS.map((c) => {
const isActive = c.id === activeId;
const count = unread[c.id] ?? 0;
return (
<button
key={c.id}
type="button"
onClick={() => selectChannel(c.id)}
className="flex items-center gap-2 rounded-lg px-2.5 py-2 text-[13px] text-left transition-colors"
style={{
background: isActive ? "var(--accent-yellow-light)" : "transparent",
color: isActive ? "var(--accent-yellow-dark)" : "var(--text-secondary)",
fontWeight: isActive ? 700 : 500,
}}
onMouseEnter={(e) => { if (!isActive) e.currentTarget.style.background = "rgba(0,0,0,0.035)"; }}
onMouseLeave={(e) => { if (!isActive) e.currentTarget.style.background = "transparent"; }}
>
<Hash size={14} strokeWidth={2.4} className="shrink-0" />
<span className="truncate">{c.name}</span>
{count > 0 && (
<span className="ml-auto grid place-items-center rounded-full text-[10px] font-bold text-white" style={{ minWidth: 18, height: 18, padding: "0 5px", background: "var(--accent-teal)" }}>
{count}
</span>
)}
</button>
);
})}
</div>
</aside>
{/* Main thread */}
<div className="flex flex-col flex-1 min-w-0">
{/* Channel header */}
<div className="flex items-center gap-2.5 px-5 shrink-0" style={{ height: 60, borderBottom: "1px solid var(--border-light)" }}>
<Hash size={18} strokeWidth={2.4} style={{ color: "var(--text-muted)" }} />
<span className="flex flex-col min-w-0">
<span className="text-[15px] font-bold truncate" style={{ color: "var(--text-primary)" }}>{active.name}</span>
<span className="text-[11.5px]" style={{ color: "var(--text-secondary)" }}>{active.meta}</span>
</span>
</div>
{/* Messages */}
<div ref={scrollRef} className="chat-scroll-hidden flex flex-col gap-2.5 flex-1 overflow-y-auto" style={{ background: "hsl(30 17% 96.5%)", padding: "16px 18px" }}>
{messages.map((m) => (
<div key={m.id} className={`flex items-end gap-2.5 ${m.author === "self" ? "justify-end" : "justify-start"}`}>
{m.author !== "self" && (
<span className="grid place-items-center rounded-full shrink-0" style={{ width: 30, height: 30, background: "#E8DDCE" }}>
<UserRound size={14} color="#7F6D58" strokeWidth={2.3} />
</span>
)}
<div
className="text-[14px] leading-snug max-w-[70%]"
style={{
backgroundColor: m.author === "self" ? OWN_BG : OTHER_BG,
borderRadius: m.author === "self" ? "16px 16px 4px 16px" : "16px 16px 16px 4px",
padding: "9px 13px",
color: m.author === "self" ? "#FFFFFF" : "var(--text-primary)",
boxShadow: "0 1px 2px rgba(0,0,0,0.06)",
border: `1px solid ${m.author === "self" ? OWN_BORDER : OTHER_BORDER}`,
}}
>
{m.author !== "self" && (
<p className="mb-0.5 text-[12px] font-semibold" style={{ color: SENDER }}>{m.sender}</p>
)}
{m.text}
<p className="mt-1 text-[10.5px]" style={{ color: m.author === "self" ? "rgba(255,255,255,0.82)" : "#7A726C" }}>{m.time}</p>
</div>
</div>
))}
{busy && (
<div className="flex items-end gap-2.5 justify-start">
<span className="grid place-items-center rounded-full shrink-0" style={{ width: 30, height: 30, background: "#E8DDCE" }}>
<UserRound size={14} color="#7F6D58" strokeWidth={2.3} />
</span>
<div className="flex items-center gap-1" style={{ background: OTHER_BG, borderRadius: "16px 16px 16px 4px", padding: "12px 14px", border: `1px solid ${OTHER_BORDER}` }}>
{[0, 1, 2].map((i) => (
<span key={i} className="rounded-full" style={{ width: 6, height: 6, background: "#B8AC94", animation: `wc-typing 1s ${i * 0.15}s infinite` }} />
))}
</div>
</div>
)}
</div>
{/* Input */}
<form onSubmit={(e) => void handleSubmit(e)} className="flex items-center gap-2.5 shrink-0" style={{ padding: "12px 16px", borderTop: "1px solid var(--border-light)" }}>
<input
value={draft}
onChange={(e) => setDraft(e.target.value)}
placeholder={`Nachricht an #${active.name} …`}
className="flex-1 min-w-0 rounded-full text-[14px]"
style={{ background: "var(--container-bg)", height: 42, padding: "0 18px", color: "#111827", outline: "none", border: "1px solid var(--border-light)" }}
/>
<button
type="submit"
disabled={!draft.trim() || busy}
aria-label="Senden"
className="flex items-center justify-center rounded-full shrink-0 transition-opacity"
style={{ width: 42, height: 42, background: !draft.trim() || busy ? "#DCCFB8" : "var(--accent-yellow)", opacity: !draft.trim() || busy ? 0.8 : 1 }}
>
<SendHorizontal size={17} color="#1A1A1A" />
</button>
</form>
</div>
</div>
<style>{`@keyframes wc-typing{0%,60%,100%{transform:translateY(0);opacity:0.5}30%{transform:translateY(-4px);opacity:1}}@media(prefers-reduced-motion:reduce){[style*="wc-typing"]{animation:none!important}}`}</style>
</section>
);
}
@@ -0,0 +1,867 @@
"use client";
import { useState, useRef, useCallback, useEffect } from "react";
/* ─── SVG Icons ───────────────────────────────────────────────────────── */
const icons: Record<string, (c: string) => React.ReactNode> = {
inbox: (c) => <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><polyline points="22 12 16 12 14 15 10 15 8 12 2 12" /><path d="M5.45 5.11L2 12v6a2 2 0 002 2h16a2 2 0 002-2v-6l-3.45-6.89A2 2 0 0016.76 4H7.24a2 2 0 00-1.79 1.11z" /></svg>,
clipboard: (c) => <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M16 4h2a2 2 0 012 2v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2h2" /><rect x="8" y="2" width="8" height="4" rx="1" ry="1" /></svg>,
user: (c) => <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2" /><circle cx="12" cy="7" r="4" /></svg>,
package: (c) => <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M16.5 9.4l-9-5.19M21 16V8a2 2 0 00-1-1.73l-7-4a2 2 0 00-2 0l-7 4A2 2 0 003 8v8a2 2 0 001 1.73l7 4a2 2 0 002 0l7-4A2 2 0 0021 16z" /><polyline points="3.27 6.96 12 12.01 20.73 6.96" /><line x1="12" y1="22.08" x2="12" y2="12" /></svg>,
calendar: (c) => <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2" /><line x1="16" y1="2" x2="16" y2="6" /><line x1="8" y1="2" x2="8" y2="6" /><line x1="3" y1="10" x2="21" y2="10" /></svg>,
check: (c) => <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M22 11.08V12a10 10 0 11-5.93-9.14" /><polyline points="22 4 12 14.01 9 11.01" /></svg>,
receipt: (c) => <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1z" /><path d="M8 10h8" /><path d="M8 14h4" /></svg>,
zap: (c) => <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" /></svg>,
mail: (c) => <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><rect x="2" y="4" width="20" height="16" rx="2" /><path d="M22 7l-10 7L2 7" /></svg>,
database: (c) => <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke={c} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><ellipse cx="12" cy="5" rx="9" ry="3" /><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3" /><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5" /></svg>,
};
const palette = [
{ icon: "inbox", label: "Anfrage", color: "#4F46E5" },
{ icon: "clipboard", label: "Auftrag", color: "#F1B729" },
{ icon: "user", label: "Zuweisen", color: "#0D6E6E" },
{ icon: "package", label: "Material", color: "#F97316" },
{ icon: "calendar", label: "Termin", color: "#3B82F6" },
{ icon: "check", label: "Erledigt", color: "#22C55E" },
{ icon: "receipt", label: "Rechnung", color: "#8B5CF6" },
{ icon: "zap", label: "Trigger", color: "#EC4899" },
{ icon: "mail", label: "E-Mail", color: "#0EA5E9" },
{ icon: "database", label: "Datenbank", color: "#6366F1" },
];
/* ─── Types ───────────────────────────────────────────────────────────── */
type HandleSide = "top" | "right" | "bottom" | "left";
interface WFNode { id: string; icon: string; label: string; subtitle?: string; color: string; x: number; y: number }
interface WFEdge { id: string; from: string; fromSide: HandleSide; to: string; toSide: HandleSide }
interface CtxMenu { x: number; y: number; type: "node" | "edge" | "canvas"; targetId?: string }
const NODE_W = 220;
const NODE_H = 56;
const HANDLE_R = 6; // handle visual radius
const HANDLE_OFFSET = 14; // how far from handle center the edge endpoint stops
/* ─── Handle position for a node ──────────────────────────────────────── */
function nodeHeight(node: WFNode): number {
return node.subtitle ? 74 : NODE_H;
}
function handlePos(node: WFNode, side: HandleSide): { x: number; y: number } {
const h = nodeHeight(node);
switch (side) {
case "top": return { x: node.x + NODE_W / 2, y: node.y };
case "right": return { x: node.x + NODE_W, y: node.y + h / 2 };
case "bottom": return { x: node.x + NODE_W / 2, y: node.y + h };
case "left": return { x: node.x, y: node.y + h / 2 };
}
}
/* ─── Find nearest handle on a node to a point ────────────────────────── */
function nearestHandle(node: WFNode, px: number, py: number): HandleSide {
const sides: HandleSide[] = ["top", "right", "bottom", "left"];
let best: HandleSide = "right";
let bestDist = Infinity;
for (const s of sides) {
const h = handlePos(node, s);
const d = Math.hypot(h.x - px, h.y - py);
if (d < bestDist) { bestDist = d; best = s; }
}
return best;
}
/* ─── Direction vector for a handle side ──────────────────────────────── */
function sideDir(side: HandleSide): { dx: number; dy: number } {
switch (side) {
case "top": return { dx: 0, dy: -1 };
case "right": return { dx: 1, dy: 0 };
case "bottom": return { dx: 0, dy: 1 };
case "left": return { dx: -1, dy: 0 };
}
}
/* ─── Bezier path with direction-aware control points ─────────────────── */
// Round values that end up in SSR'd SVG attribute strings. Math.hypot (and the
// trig below) are implementation-defined in their last ULP, so Node and the
// browser can serialise a float's last digit differently → hydration mismatch.
// We use Math.sqrt (IEEE correctly-rounded, engine-identical) and round the
// string-bound numbers so server and client produce byte-identical output.
const rnd = (n: number) => Math.round(n * 1000) / 1000;
const dist2 = (dx: number, dy: number) => Math.sqrt(dx * dx + dy * dy);
function edgePath(x1: number, y1: number, s1: HandleSide, x2: number, y2: number, s2: HandleSide): string {
const d1 = sideDir(s1);
const d2 = sideDir(s2);
const dist = Math.max(40, dist2(x2 - x1, y2 - y1) * 0.4);
const cx1 = rnd(x1 + d1.dx * dist);
const cy1 = rnd(y1 + d1.dy * dist);
const cx2 = rnd(x2 + d2.dx * dist);
const cy2 = rnd(y2 + d2.dy * dist);
return `M${x1},${y1} C${cx1},${cy1} ${cx2},${cy2} ${x2},${y2}`;
}
/* ─── Arrow tip offset: move endpoint back so arrow doesn't enter node ── */
function offsetPoint(x: number, y: number, side: HandleSide, amount: number): { x: number; y: number } {
const d = sideDir(side);
return { x: x + d.dx * amount, y: y + d.dy * amount };
}
/* ─── Free-end path (when dragging a new connection) ──────────────────── */
function freePath(x1: number, y1: number, s1: HandleSide, mx: number, my: number): string {
const d = sideDir(s1);
const dist = Math.max(40, dist2(mx - x1, my - y1) * 0.4);
return `M${x1},${y1} C${rnd(x1 + d.dx * dist)},${rnd(y1 + d.dy * dist)} ${mx},${my} ${mx},${my}`;
}
/* ─── Approximate bezier path length (for consistent dot speed) ───────── */
function approxPathLength(x1: number, y1: number, s1: HandleSide, x2: number, y2: number, s2: HandleSide): number {
const d1 = sideDir(s1);
const d2 = sideDir(s2);
const dist = Math.max(40, dist2(x2 - x1, y2 - y1) * 0.4);
const cx1 = x1 + d1.dx * dist, cy1 = y1 + d1.dy * dist;
const cx2 = x2 + d2.dx * dist, cy2 = y2 + d2.dy * dist;
// Subdivide into 10 segments and sum chord lengths
let len = 0;
let px = x1, py = y1;
for (let i = 1; i <= 10; i++) {
const t = i / 10;
const u = 1 - t;
const nx = u*u*u*x1 + 3*u*u*t*cx1 + 3*u*t*t*cx2 + t*t*t*x2;
const ny = u*u*u*y1 + 3*u*u*t*cy1 + 3*u*t*t*cy2 + t*t*t*y2;
len += dist2(nx - px, ny - py);
px = nx; py = ny;
}
return len;
}
/* ─── Defaults — invoice payment flow ─────────────────────────────────── */
const defaultNodes: WFNode[] = [
{ id: "n1", icon: "receipt", label: "Rechnung senden", subtitle: "Template: Standard-Rechnung", color: "#8B5CF6", x: 30, y: 220 },
{ id: "n2", icon: "calendar", label: "2 Wochen warten", color: "#F97316", x: 320, y: 230 },
{ id: "n3", icon: "check", label: "Bezahlt?", color: "#3B82F6", x: 610, y: 230 },
{ id: "n4", icon: "mail", label: "Bestätigung senden", subtitle: "Template: Zahlungseingang", color: "#22C55E", x: 900, y: 80 },
{ id: "n5", icon: "inbox", label: "Mahnung senden", subtitle: "Template: Zahlungserinnerung", color: "#EF4444", x: 900, y: 390 },
];
let _eid = 1;
const eid = () => `e${_eid++}`;
const defaultEdges: WFEdge[] = [
{ id: eid(), from: "n1", fromSide: "right", to: "n2", toSide: "left" },
{ id: eid(), from: "n2", fromSide: "right", to: "n3", toSide: "left" },
{ id: eid(), from: "n3", fromSide: "top", to: "n4", toSide: "left" }, // Ja → Bestätigung
{ id: eid(), from: "n3", fromSide: "bottom", to: "n5", toSide: "left" }, // Nein → Mahnung
{ id: eid(), from: "n5", fromSide: "left", to: "n1", toSide: "bottom" }, // Loop: nochmal
];
/* ─── Connection drag state ───────────────────────────────────────────── */
interface ConnDrag {
/** Are we creating a new edge or reconnecting an existing one? */
mode: "new" | "reconnect";
/** The node+handle we're dragging FROM (the anchored end) */
anchorNode: string;
anchorSide: HandleSide;
/** If reconnecting, the original edge id */
edgeId?: string;
/** Current mouse position */
mx: number;
my: number;
}
/* ─── Component ───────────────────────────────────────────────────────── */
export default function WorkflowEditor({ hideHeader = false }: { hideHeader?: boolean }) {
const [nodes, setNodes] = useState<WFNode[]>(defaultNodes);
const [edges, setEdges] = useState<WFEdge[]>(defaultEdges);
const [selected, setSelected] = useState<string | null>(null);
const [selectedEdge, setSelectedEdge] = useState<string | null>(null);
const [dragging, setDragging] = useState<string | null>(null);
const [connDrag, setConnDrag] = useState<ConnDrag | null>(null);
const [ctxMenu, setCtxMenu] = useState<CtxMenu | null>(null);
const [hoveredHandle, setHoveredHandle] = useState<{ nodeId: string; side: HandleSide } | null>(null);
const [addOpen, setAddOpen] = useState(false);
const [showHint, setShowHint] = useState(false);
const hintDismissed = useRef(false);
const dragOffset = useRef({ dx: 0, dy: 0 });
const canvasRef = useRef<HTMLDivElement>(null);
const idCounter = useRef(defaultNodes.length + 1);
const getPos = useCallback((e: React.PointerEvent | PointerEvent | React.MouseEvent) => {
const r = canvasRef.current?.getBoundingClientRect();
return r ? { x: e.clientX - r.left, y: e.clientY - r.top } : { x: 0, y: 0 };
}, []);
const closeMenu = useCallback(() => setCtxMenu(null), []);
/* ── Find handle near a point (for drop targeting) ──────────────────── */
const findHandleAt = useCallback((px: number, py: number, excludeNodeId?: string): { nodeId: string; side: HandleSide } | null => {
for (const n of nodes) {
if (n.id === excludeNodeId) continue;
for (const s of ["top", "right", "bottom", "left"] as HandleSide[]) {
const h = handlePos(n, s);
if (Math.hypot(h.x - px, h.y - py) < 18) return { nodeId: n.id, side: s };
}
}
return null;
}, [nodes]);
/* ── Node drag ──────────────────────────────────────────────────────── */
const onNodeDown = useCallback((e: React.PointerEvent, id: string) => {
e.stopPropagation();
const p = getPos(e);
const n = nodes.find((n) => n.id === id);
if (!n) return;
dragOffset.current = { dx: p.x - n.x, dy: p.y - n.y };
setDragging(id);
setSelected(id);
setSelectedEdge(null);
setShowHint(false);
hintDismissed.current = true;
closeMenu();
}, [nodes, getPos, closeMenu]);
/* ── Handle pointer down — start new connection ─────────────────────── */
const onHandleDown = useCallback((e: React.PointerEvent, nodeId: string, side: HandleSide) => {
e.stopPropagation();
const p = getPos(e);
setConnDrag({ mode: "new", anchorNode: nodeId, anchorSide: side, mx: p.x, my: p.y });
setSelected(null);
setSelectedEdge(null);
closeMenu();
}, [getPos, closeMenu]);
/* ── Edge endpoint drag — start reconnect ───────────────────────────── */
const onEdgeEndpointDown = useCallback((e: React.PointerEvent, edge: WFEdge, end: "from" | "to") => {
e.stopPropagation();
const p = getPos(e);
// The anchor is the OTHER end (the one that stays)
const anchorNode = end === "to" ? edge.from : edge.to;
const anchorSide = end === "to" ? edge.fromSide : edge.toSide;
setConnDrag({ mode: "reconnect", anchorNode, anchorSide, edgeId: edge.id, mx: p.x, my: p.y });
// Temporarily remove the edge being reconnected
setEdges((prev) => prev.filter((e) => e.id !== edge.id));
setSelectedEdge(null);
closeMenu();
}, [getPos, closeMenu]);
/* ── Pointer move on canvas ─────────────────────────────────────────── */
const onCanvasMove = useCallback((e: React.PointerEvent) => {
const p = getPos(e);
if (dragging) {
setNodes((prev) => prev.map((n) => n.id === dragging ? { ...n, x: Math.max(0, p.x - dragOffset.current.dx), y: Math.max(0, p.y - dragOffset.current.dy) } : n));
}
if (connDrag) {
setConnDrag((prev) => prev ? { ...prev, mx: p.x, my: p.y } : null);
// Update hover handle
const h = findHandleAt(p.x, p.y, connDrag.anchorNode);
setHoveredHandle(h);
}
}, [dragging, connDrag, getPos, findHandleAt]);
/* ── Pointer up on canvas ───────────────────────────────────────────── */
const onCanvasUp = useCallback(() => {
if (connDrag) {
const target = findHandleAt(connDrag.mx, connDrag.my, connDrag.anchorNode);
if (target) {
// Check for duplicate
const exists = edges.some((e) =>
(e.from === connDrag.anchorNode && e.to === target.nodeId) ||
(e.from === target.nodeId && e.to === connDrag.anchorNode)
);
if (!exists) {
setEdges((prev) => [...prev, {
id: eid(),
from: connDrag.anchorNode,
fromSide: connDrag.anchorSide,
to: target.nodeId,
toSide: target.side,
}]);
}
}
// If reconnecting and dropped on nothing, the edge is already removed — gone
setConnDrag(null);
setHoveredHandle(null);
}
setDragging(null);
}, [connDrag, edges, findHandleAt]);
/* ── Canvas background click ────────────────────────────────────────── */
const onCanvasDown = useCallback((e: React.PointerEvent) => {
setSelected(null);
setSelectedEdge(null);
setAddOpen(false);
if (showHint) { setShowHint(false); hintDismissed.current = true; }
closeMenu();
}, [closeMenu, showHint]);
/* ── Edge click ─────────────────────────────────────────────────────── */
const onEdgeClick = useCallback((e: React.MouseEvent, id: string) => {
e.stopPropagation();
setSelectedEdge(id);
setSelected(null);
closeMenu();
}, [closeMenu]);
/* ── Context menus ──────────────────────────────────────────────────── */
const onNodeCtx = useCallback((e: React.MouseEvent, id: string) => {
e.preventDefault(); e.stopPropagation();
setCtxMenu({ x: e.clientX, y: e.clientY, type: "node", targetId: id });
setSelected(id); setSelectedEdge(null);
}, []);
const onEdgeCtx = useCallback((e: React.MouseEvent, id: string) => {
e.preventDefault(); e.stopPropagation();
setCtxMenu({ x: e.clientX, y: e.clientY, type: "edge", targetId: id });
setSelectedEdge(id); setSelected(null);
}, []);
const onCanvasCtx = useCallback((e: React.MouseEvent) => {
e.preventDefault();
setCtxMenu({ x: e.clientX, y: e.clientY, type: "canvas" });
}, []);
/* ── Actions ────────────────────────────────────────────────────────── */
const deleteNode = useCallback((id: string) => {
setNodes((p) => p.filter((n) => n.id !== id));
setEdges((p) => p.filter((e) => e.from !== id && e.to !== id));
if (selected === id) setSelected(null);
closeMenu();
}, [selected, closeMenu]);
const deleteEdge = useCallback((id: string) => {
setEdges((p) => p.filter((e) => e.id !== id));
if (selectedEdge === id) setSelectedEdge(null);
closeMenu();
}, [selectedEdge, closeMenu]);
const addNode = useCallback((t: typeof palette[0]) => {
const id = `n${idCounter.current++}`;
setNodes((p) => [...p, { id, icon: t.icon, label: t.label, color: t.color, x: 80 + Math.random() * 800, y: 60 + Math.random() * 320 }]);
setSelected(id);
closeMenu();
setAddOpen(false);
setShowHint(false);
}, [closeMenu]);
const reset = useCallback(() => {
_eid = 1;
setNodes([
{ id: "n1", icon: "receipt", label: "Rechnung senden", subtitle: "Template: Standard-Rechnung", color: "#8B5CF6", x: 30, y: 220 },
{ id: "n2", icon: "calendar", label: "2 Wochen warten", color: "#F97316", x: 320, y: 230 },
{ id: "n3", icon: "check", label: "Bezahlt?", color: "#3B82F6", x: 610, y: 230 },
{ id: "n4", icon: "mail", label: "Bestätigung senden", subtitle: "Template: Zahlungseingang", color: "#22C55E", x: 900, y: 80 },
{ id: "n5", icon: "inbox", label: "Mahnung senden", subtitle: "Template: Zahlungserinnerung", color: "#EF4444", x: 900, y: 390 },
]);
setEdges([
{ id: eid(), from: "n1", fromSide: "right", to: "n2", toSide: "left" },
{ id: eid(), from: "n2", fromSide: "right", to: "n3", toSide: "left" },
{ id: eid(), from: "n3", fromSide: "top", to: "n4", toSide: "left" },
{ id: eid(), from: "n3", fromSide: "bottom", to: "n5", toSide: "left" },
{ id: eid(), from: "n5", fromSide: "left", to: "n1", toSide: "bottom" },
]);
setSelected(null); setSelectedEdge(null); closeMenu(); setAddOpen(false);
idCounter.current = 6;
}, [closeMenu]);
/* ── Hint: show on scroll into view, dismiss on hover ─────────────── */
useEffect(() => {
if (!canvasRef.current || hintDismissed.current) return;
const observer = new IntersectionObserver(
([entry]) => {
if (entry.isIntersecting && !hintDismissed.current) {
setShowHint(true);
}
},
{ threshold: 0.4 }
);
observer.observe(canvasRef.current);
return () => observer.disconnect();
}, []);
const dismissHint = useCallback(() => {
if (showHint) {
setShowHint(false);
hintDismissed.current = true;
}
}, [showHint]);
/* ── Keyboard ───────────────────────────────────────────────────────── */
useEffect(() => {
const fn = (e: KeyboardEvent) => {
if ((e.target as HTMLElement).tagName === "INPUT") return;
if (e.key === "Delete" || e.key === "Backspace") {
if (selected) deleteNode(selected);
else if (selectedEdge) deleteEdge(selectedEdge);
}
if (e.key === "Escape") closeMenu();
};
window.addEventListener("keydown", fn);
return () => window.removeEventListener("keydown", fn);
}, [selected, selectedEdge, deleteNode, deleteEdge, closeMenu]);
useEffect(() => {
if (!ctxMenu) return;
const fn = () => closeMenu();
window.addEventListener("pointerdown", fn);
return () => window.removeEventListener("pointerdown", fn);
}, [ctxMenu, closeMenu]);
/* ── Render ─────────────────────────────────────────────────────────── */
return (
<section className="section-full" style={{ background: "var(--surface)", paddingBlock: hideHeader ? 40 : 80 }}>
<div className="mx-auto" style={{ maxWidth: "var(--content-width)" }}>
{!hideHeader && (
<div className="flex flex-col items-center gap-4 text-center mb-10">
<span className="text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5" style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}>WORKFLOW EDITOR</span>
<h2 className="text-[32px] md:text-[42px] font-bold leading-[1.15]" style={{ color: "var(--text-primary)" }}>Interaktiver Workflow Builder</h2>
<p className="text-[16px] leading-relaxed max-w-2xl" style={{ color: "var(--text-secondary)" }}>Erstellen Sie automatisierte Abläufe, visuell und ohne Code.</p>
</div>
)}
{/* Canvas — desktop only */}
<div className="relative">
{/* Pop-up hint now inside canvas below */}
<div
ref={canvasRef}
className="relative rounded-2xl select-none hidden xl:block"
style={{
height: 600, background: "#FAFBFD",
border: "1px solid var(--border-light)",
backgroundImage: "radial-gradient(circle, #E5E7EB 1px, transparent 1px)",
backgroundSize: "24px 24px",
cursor: dragging ? "grabbing" : connDrag ? "crosshair" : "default",
overflow: "hidden",
}}
onPointerDown={onCanvasDown}
onPointerMove={onCanvasMove}
onPointerUp={onCanvasUp}
onContextMenu={onCanvasCtx}
>
{/* ── Top-left buttons: + and Reset ──────────────────────── */}
<div className="absolute top-4 left-4 z-[60] flex items-center gap-2" onPointerDown={(e) => e.stopPropagation()}>
<button
onClick={() => setAddOpen((v) => !v)}
className="w-[54px] h-[54px] rounded-2xl flex items-center justify-center transition-transform hover:scale-[1.03] active:scale-95"
style={{
background: addOpen ? "var(--accent-teal)" : "rgba(241,183,41,0.12)",
color: addOpen ? "#FFFFFF" : "#1A1A1A",
border: addOpen ? "none" : "1.5px solid rgba(241,183,41,0.3)",
boxShadow: "0 2px 8px rgba(0,0,0,0.04)",
}}
>
<svg width="20" height="20" viewBox="0 0 18 18" fill="none" style={{ transform: addOpen ? "rotate(45deg)" : "none", transition: "transform 0.2s ease" }}>
<path d="M9 3v12M3 9h12" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
</svg>
</button>
<button
onClick={reset}
className="w-[54px] h-[54px] rounded-2xl flex items-center justify-center transition-transform hover:scale-[1.03] active:scale-95"
style={{
background: "rgba(241,183,41,0.12)",
color: "#1A1A1A",
border: "1.5px solid rgba(241,183,41,0.3)",
boxShadow: "0 2px 8px rgba(0,0,0,0.04)",
}}
>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<polyline points="1 4 1 10 7 10" />
<path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10" />
</svg>
</button>
{/* Dropdown */}
{addOpen && (
<div
className="absolute top-11 left-0 rounded-xl py-2 min-w-[180px]"
style={{
background: "#FFFFFF",
border: "1px solid var(--border-light)",
boxShadow: "0 12px 32px rgba(0,0,0,0.12)",
animation: "wf-dropdown-in 0.2s ease",
}}
>
<style dangerouslySetInnerHTML={{ __html: `
@keyframes wf-dropdown-in {
from { opacity: 0; transform: translateY(-6px) scale(0.96); }
to { opacity: 1; transform: translateY(0) scale(1); }
}
`}} />
{palette.map((t) => (
<button
key={t.icon}
onClick={() => addNode(t)}
className="w-full text-left px-4 py-2 text-[13px] font-medium hover:bg-[var(--bg-muted)] transition-colors flex items-center gap-2.5"
style={{ color: "var(--text-primary)" }}
>
<div className="w-6 h-6 rounded flex items-center justify-center shrink-0" style={{ background: `${t.color}14` }}>
{icons[t.icon]?.(t.color)}
</div>
{t.label}
</button>
))}
</div>
)}
</div>
{/* ── Hint popup — centered in canvas viewport ─────────────── */}
{showHint && (
<div data-canvas-hint className="absolute inset-0 z-[55] flex items-center justify-center" style={{ pointerEvents: "none" }}>
<style dangerouslySetInnerHTML={{ __html: `
@keyframes wf-popup-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes wf-mini-drag { 0%,100% { transform: translate(0,0); } 20% { transform: translate(0,-4px); } 40% { transform: translate(34px,-4px); } 60% { transform: translate(34px,0); } 80% { transform: translate(0,0); } }
@keyframes wf-mini-cursor { 0%,15% { transform: translate(38px,24px); } 20% { transform: translate(22px,16px); } 40%,60% { transform: translate(58px,16px); } 65% { transform: translate(60px,24px); } 80%,100% { transform: translate(38px,24px); } }
`}} />
<div className="relative flex flex-col items-center gap-3 rounded-2xl px-8 py-6" style={{ background: "rgba(255,255,255,0.97)", border: "1px solid var(--border-light)", boxShadow: "0 12px 40px rgba(0,0,0,0.12)", animation: "wf-popup-in 0.3s ease both", pointerEvents: "auto" }}>
{/* X close button */}
<button
onClick={dismissHint}
className="absolute top-2.5 right-2.5 w-6 h-6 rounded-md flex items-center justify-center hover:bg-[var(--bg-muted)] transition-colors"
style={{ color: "var(--text-muted)" }}
>
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round">
<path d="M2 2l8 8M10 2l-8 8" />
</svg>
</button>
{/* Mini animation — large */}
<div className="relative" style={{ width: 90, height: 50 }}>
<div style={{ width: 36, height: 24, borderRadius: 6, border: "2px solid #B0B8C4", background: "#F3F4F6", animation: "wf-mini-drag 3s ease-in-out infinite", position: "absolute", top: 8, left: 6 }} />
<div style={{ width: 36, height: 24, borderRadius: 6, border: "2px solid var(--accent-teal)", background: "var(--accent-teal-light)", position: "absolute", top: 16, left: 44, opacity: 0.45 }} />
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" style={{ position: "absolute", animation: "wf-mini-cursor 3s ease-in-out infinite" }}>
<path d="M5 3l14 8-6 2-4 6z" fill="#1A1A1A" stroke="white" strokeWidth="1.5" />
</svg>
</div>
<span className="text-[15px] font-semibold" style={{ color: "var(--text-primary)" }}>Nodes verschieben & verbinden</span>
<span className="text-[12px]" style={{ color: "var(--text-muted)" }}>Klicke auf einen Node um loszulegen</span>
</div>
</div>
)}
{/* SVG layer */}
<svg className="absolute inset-0 w-full h-full" style={{ zIndex: 1, pointerEvents: "none" }}>
{edges.map((edge) => {
const fn = nodes.find((n) => n.id === edge.from);
const tn = nodes.find((n) => n.id === edge.to);
if (!fn || !tn) return null;
const p1 = offsetPoint(handlePos(fn, edge.fromSide).x, handlePos(fn, edge.fromSide).y, edge.fromSide, HANDLE_OFFSET);
const p2 = offsetPoint(handlePos(tn, edge.toSide).x, handlePos(tn, edge.toSide).y, edge.toSide, HANDLE_OFFSET);
const d = edgePath(p1.x, p1.y, edge.fromSide, p2.x, p2.y, edge.toSide);
const isSel = selectedEdge === edge.id;
const pathLen = approxPathLength(p1.x, p1.y, edge.fromSide, p2.x, p2.y, edge.toSide);
const SPEED = 80; // pixels per second
const dur = rnd(Math.max(1.5, pathLen / SPEED));
return (
<g key={edge.id}>
{/* Hit area */}
<path d={d} fill="none" stroke="transparent" strokeWidth="16" style={{ pointerEvents: "stroke", cursor: "pointer" }} onClick={(e) => onEdgeClick(e, edge.id)} onContextMenu={(e) => onEdgeCtx(e, edge.id)} />
{/* Visible edge — semi-transparent */}
<path d={d} fill="none" stroke={isSel ? "var(--accent-teal)" : "rgba(139,145,154,0.35)"} strokeWidth={isSel ? 2.5 : 1.8} style={{ pointerEvents: "none" }} />
{/* Arrowhead */}
{(() => {
const dir = sideDir(edge.toSide);
const ax = p2.x, ay = p2.y;
const angle = Math.atan2(-dir.dy, -dir.dx);
const size = 6;
const p = [
{ x: ax + Math.cos(angle) * size, y: ay + Math.sin(angle) * size },
{ x: ax + Math.cos(angle + 2.4) * size * 0.7, y: ay + Math.sin(angle + 2.4) * size * 0.7 },
{ x: ax + Math.cos(angle - 2.4) * size * 0.7, y: ay + Math.sin(angle - 2.4) * size * 0.7 },
];
return <polygon points={p.map(pt => `${rnd(pt.x)},${rnd(pt.y)}`).join(" ")} fill={isSel ? "var(--accent-teal)" : "rgba(139,145,154,0.45)"} style={{ pointerEvents: "none" }} />;
})()}
{/* Animated dot */}
{/* Animated flow dots — count based on path length for even spacing */}
{(() => {
const DOT_SPACING_PX = 80; // desired pixel distance between dots
const numDots = Math.max(1, Math.min(3, Math.floor(pathLen / DOT_SPACING_PX)));
const spacing = dur / numDots;
return Array.from({ length: numDots }, (_, di) => (
<circle key={di} r="3" fill="var(--accent-yellow)" opacity="0.55" style={{ pointerEvents: "none", filter: "drop-shadow(0 0 4px rgba(241,183,41,0.8)) drop-shadow(0 0 10px rgba(241,183,41,0.4))" }}>
<animateMotion dur={`${dur}s`} repeatCount="indefinite" begin={`${rnd(di * spacing)}s`} calcMode="linear" path={d} />
</circle>
));
})()}
{/* Draggable endpoint circles (for reconnection) */}
<circle cx={p1.x} cy={p1.y} r="8" fill="transparent" style={{ pointerEvents: "all", cursor: "grab" }} onPointerDown={(e) => { e.stopPropagation(); onEdgeEndpointDown(e as any, edge, "from"); }} />
<circle cx={p2.x} cy={p2.y} r="8" fill="transparent" style={{ pointerEvents: "all", cursor: "grab" }} onPointerDown={(e) => { e.stopPropagation(); onEdgeEndpointDown(e as any, edge, "to"); }} />
</g>
);
})}
{/* Connection being drawn */}
{connDrag && (() => {
const an = nodes.find((n) => n.id === connDrag.anchorNode);
if (!an) return null;
const ap = offsetPoint(handlePos(an, connDrag.anchorSide).x, handlePos(an, connDrag.anchorSide).y, connDrag.anchorSide, HANDLE_OFFSET);
return <path d={freePath(ap.x, ap.y, connDrag.anchorSide, connDrag.mx, connDrag.my)} fill="none" stroke="var(--accent-teal)" strokeWidth="2" strokeDasharray="6 3" opacity={0.7} style={{ pointerEvents: "none" }} />;
})()}
</svg>
{/* Nodes */}
{nodes.map((node) => {
const isSel = selected === node.id;
const isDrag = dragging === node.id;
const hasSub = !!node.subtitle;
const nodeH = hasSub ? 70 : NODE_H;
const sides: HandleSide[] = ["top", "right", "bottom", "left"];
return (
<div
key={node.id}
className="absolute flex items-center gap-2.5"
style={{
left: node.x, top: node.y, width: NODE_W, height: nodeH,
padding: "0 12px 0 16px",
background: "#FFFFFF",
borderRadius: 10,
// neutral 1px card + subtle shadow (colour lives in the accent
// bar, not the whole border) — clean, not "vibecoded"
border: `1px solid ${isSel ? node.color : "var(--border-light)"}`,
boxShadow: isSel
? `0 0 0 3px ${node.color}22, 0 4px 12px rgba(15,23,42,0.10)`
: isDrag
? "0 10px 26px rgba(15,23,42,0.14)"
: "0 1px 2px rgba(15,23,42,0.06)",
cursor: isDrag ? "grabbing" : "grab",
zIndex: isDrag ? 50 : isSel ? 40 : 10,
userSelect: "none",
transition: isDrag ? "none" : "border-color 0.15s, box-shadow 0.15s",
}}
onPointerDown={(e) => onNodeDown(e, node.id)}
onContextMenu={(e) => onNodeCtx(e, node.id)}
>
{/* left accent bar — the node's colour, not the whole border */}
<span className="absolute rounded-r-full" style={{ left: 0, top: 8, bottom: 8, width: 3, background: node.color }} />
{/* 4 handles */}
{sides.map((side) => {
const isHovered = hoveredHandle?.nodeId === node.id && hoveredHandle?.side === side;
const hh = nodeH;
const pos = side === "top" ? { left: "50%", top: -HANDLE_R, transform: "translateX(-50%)" }
: side === "right" ? { right: -HANDLE_R, top: "50%", transform: "translateY(-50%)" }
: side === "bottom" ? { left: "50%", bottom: -HANDLE_R, transform: "translateX(-50%)" }
: { left: -HANDLE_R, top: "50%", transform: "translateY(-50%)" };
return (
<div
key={side}
className="absolute rounded-full border-[2px] border-white transition-transform"
style={{
...pos,
width: HANDLE_R * 2,
height: HANDLE_R * 2,
background: isHovered ? "var(--accent-teal)" : node.color,
zIndex: 20,
cursor: "crosshair",
transform: `${pos.transform ?? ""} ${isHovered ? " scale(1.5)" : ""}`,
} as React.CSSProperties}
onPointerDown={(e) => onHandleDown(e, node.id, side)}
/>
);
})}
{/* Icon */}
<div className="w-8 h-8 rounded-md flex items-center justify-center shrink-0" style={{ background: `${node.color}14` }}>
{icons[node.icon]?.(node.color)}
</div>
{/* Label + optional subtitle */}
<div className="flex flex-col min-w-0">
<span className="text-[12px] font-semibold truncate" style={{ color: "var(--text-primary)" }}>{node.label}</span>
{node.subtitle && (
<span className="text-[10px] truncate" style={{ color: "var(--text-muted)", marginTop: 1 }}>{node.subtitle}</span>
)}
</div>
</div>
);
})}
{nodes.length === 0 && (
<div className="absolute inset-0 flex items-center justify-center">
<p className="text-[14px] font-medium" style={{ color: "var(--text-muted)" }}>Klicke auf einen Node in der Palette um loszulegen.</p>
</div>
)}
</div>
</div>
{/* Mobile fallback — static flow diagram with branching */}
<div className="xl:hidden rounded-2xl overflow-hidden" style={{ background: "#FAFBFD", border: "1px solid var(--border-light)", padding: "24px 20px" }}>
<div className="flex flex-col items-center">
{/* ── Linear flow: Rechnung → 2 Wochen → Bezahlt? ────── */}
{[
{ id: "n1", icon: "receipt", label: "Rechnung senden", subtitle: "Template: Standard-Rechnung", color: "#8B5CF6" },
{ id: "n2", icon: "calendar", label: "2 Wochen warten", subtitle: "Frist für Zahlungseingang", color: "#F97316" },
{ id: "n3", icon: "check", label: "Bezahlt?", subtitle: "Automatische Prüfung", color: "#3B82F6" },
].map((node, i) => (
<div key={node.id} className="flex flex-col items-center w-full" style={{ maxWidth: 280 }}>
{/* Node card */}
<div
className="relative flex items-center gap-3 w-full"
style={{
padding: "12px 16px 12px 18px",
background: "#FFFFFF",
borderRadius: 10,
border: "1px solid var(--border-light)",
boxShadow: "0 1px 2px rgba(15,23,42,0.06)",
}}
>
<span className="absolute rounded-r-full" style={{ left: 0, top: 8, bottom: 8, width: 3, background: node.color }} />
<div className="w-8 h-8 rounded-md flex items-center justify-center shrink-0" style={{ background: `${node.color}14` }}>
{icons[node.icon]?.(node.color)}
</div>
<div className="flex flex-col min-w-0">
<span className="text-[13px] font-semibold" style={{ color: "var(--text-primary)" }}>{node.label}</span>
<span className="text-[10px]" style={{ color: "var(--text-muted)", marginTop: 1 }}>{node.subtitle}</span>
</div>
</div>
{/* Down-arrow connector */}
<div className="flex flex-col items-center py-1">
<svg width="16" height="24" viewBox="0 0 16 24" fill="none">
<path d="M8 0v18" stroke="#D5DBE1" strokeWidth="1.5" />
<path d="M4 16l4 6 4-6" stroke="#D5DBE1" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
</svg>
</div>
</div>
))}
{/* ── Branch: two columns after Bezahlt? ─────────────── */}
<div className="grid grid-cols-2 gap-3 w-full" style={{ maxWidth: 320 }}>
{/* Left branch — Ja → Bestätigung senden */}
<div className="flex flex-col items-center">
{/* Ja label */}
<span className="inline-flex items-center gap-1 text-[10px] font-semibold px-2 py-0.5 rounded-full mb-1.5" style={{ background: "#DCFCE7", color: "#166534" }}>
Ja
<svg width="10" height="10" viewBox="0 0 10 10" fill="none">
<path d="M2 8L8 2" stroke="#166534" strokeWidth="1.5" strokeLinecap="round" />
<path d="M3 2h5v5" stroke="#166534" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
</svg>
</span>
{/* Down arrow */}
<svg width="16" height="20" viewBox="0 0 16 20" fill="none" className="mb-1.5">
<path d="M8 0v14" stroke="#22C55E" strokeWidth="1.5" />
<path d="M4 12l4 6 4-6" stroke="#22C55E" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
</svg>
{/* Bestätigung senden card */}
<div
className="relative flex flex-col gap-1.5 w-full"
style={{
padding: "10px 12px 10px 14px",
background: "#FFFFFF",
borderRadius: 10,
border: "1px solid var(--border-light)",
boxShadow: "0 1px 2px rgba(15,23,42,0.06)",
}}
>
<span className="absolute rounded-r-full" style={{ left: 0, top: 8, bottom: 8, width: 3, background: "#22C55E" }} />
<div className="flex items-center gap-2">
<div className="w-7 h-7 rounded-md flex items-center justify-center shrink-0" style={{ background: "#22C55E14" }}>
{icons.mail("#22C55E")}
</div>
<span className="text-[12px] font-semibold leading-tight" style={{ color: "var(--text-primary)" }}>Bestätigung senden</span>
</div>
<span className="text-[9px]" style={{ color: "var(--text-muted)" }}>Template: Zahlungseingang</span>
</div>
</div>
{/* Right branch — Nein → Mahnung senden */}
<div className="flex flex-col items-center">
{/* Nein label */}
<span className="inline-flex items-center gap-1 text-[10px] font-semibold px-2 py-0.5 rounded-full mb-1.5" style={{ background: "#FEE2E2", color: "#991B1B" }}>
Nein
<svg width="10" height="10" viewBox="0 0 10 10" fill="none">
<path d="M2 2L8 8" stroke="#991B1B" strokeWidth="1.5" strokeLinecap="round" />
<path d="M3 8h5V3" stroke="#991B1B" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
</svg>
</span>
{/* Down arrow */}
<svg width="16" height="20" viewBox="0 0 16 20" fill="none" className="mb-1.5">
<path d="M8 0v14" stroke="#EF4444" strokeWidth="1.5" />
<path d="M4 12l4 6 4-6" stroke="#EF4444" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
</svg>
{/* Mahnung senden card */}
<div
className="relative flex flex-col gap-1.5 w-full"
style={{
padding: "10px 12px 10px 14px",
background: "#FFFFFF",
borderRadius: 10,
border: "1px solid var(--border-light)",
boxShadow: "0 1px 2px rgba(15,23,42,0.06)",
}}
>
<span className="absolute rounded-r-full" style={{ left: 0, top: 8, bottom: 8, width: 3, background: "#EF4444" }} />
<div className="flex items-center gap-2">
<div className="w-7 h-7 rounded-md flex items-center justify-center shrink-0" style={{ background: "#EF444414" }}>
{icons.inbox("#EF4444")}
</div>
<span className="text-[12px] font-semibold leading-tight" style={{ color: "var(--text-primary)" }}>Mahnung senden</span>
</div>
<span className="text-[9px]" style={{ color: "var(--text-muted)" }}>Template: Zahlungserinnerung</span>
</div>
{/* Loop arrow */}
<div className="flex items-center gap-1.5 mt-2">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#D5DBE1" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
<polyline points="1 4 1 10 7 10" />
<path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10" />
</svg>
<span className="text-[9px] font-medium" style={{ color: "var(--text-muted)" }}>Zurück zu Schritt 1</span>
</div>
</div>
</div>
</div>
</div>
</div>
{/* Context menu */}
{ctxMenu && (
<div className="fixed z-[9999] rounded-lg py-1 min-w-[160px]" style={{ left: ctxMenu.x, top: ctxMenu.y, background: "#FFF", border: "1px solid var(--border-light)", boxShadow: "0 8px 24px rgba(0,0,0,0.12)" }} onPointerDown={(e) => e.stopPropagation()}>
{ctxMenu.type === "node" && ctxMenu.targetId && (<>
<button className="w-full text-left px-4 py-2 text-[13px] font-medium hover:bg-[var(--bg-muted)]" style={{ color: "var(--text-primary)" }} onClick={() => { const o = nodes.find(n => n.id === ctxMenu.targetId); if (o) { const id = `n${idCounter.current++}`; setNodes(p => [...p, { ...o, id, x: o.x + 30, y: o.y + 30 }]); } closeMenu(); }}>Duplizieren</button>
<div style={{ height: 1, background: "var(--border-light)", margin: "2px 0" }} />
<button className="w-full text-left px-4 py-2 text-[13px] font-medium hover:bg-red-50" style={{ color: "#EF4444" }} onClick={() => deleteNode(ctxMenu.targetId!)}>Node löschen</button>
</>)}
{ctxMenu.type === "edge" && ctxMenu.targetId && (
<button className="w-full text-left px-4 py-2 text-[13px] font-medium hover:bg-red-50" style={{ color: "#EF4444" }} onClick={() => deleteEdge(ctxMenu.targetId!)}>Verbindung löschen</button>
)}
{ctxMenu.type === "canvas" && (<>
{palette.slice(0, 4).map((t) => (
<button key={t.icon} className="w-full text-left px-4 py-2 text-[13px] font-medium hover:bg-[var(--bg-muted)] flex items-center gap-2" style={{ color: "var(--text-primary)" }} onClick={() => addNode(t)}>{icons[t.icon]?.(t.color)} {t.label} hinzufügen</button>
))}
<div style={{ height: 1, background: "var(--border-light)", margin: "2px 0" }} />
<button className="w-full text-left px-4 py-2 text-[13px] font-medium hover:bg-[var(--bg-muted)]" style={{ color: "var(--text-secondary)" }} onClick={reset}>Alles zurücksetzen</button>
</>)}
</div>
)}
</section>
);
}
@@ -0,0 +1,321 @@
"use client";
/* ─── SVG Node Icons ──────────────────────────────────────────────────── */
function IconInbox({ color = "currentColor", size = 20 }: { color?: string; size?: number }) {
return (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<polyline points="22 12 16 12 14 15 10 15 8 12 2 12" />
<path d="M5.45 5.11L2 12v6a2 2 0 002 2h16a2 2 0 002-2v-6l-3.45-6.89A2 2 0 0016.76 4H7.24a2 2 0 00-1.79 1.11z" />
</svg>
);
}
function IconClipboard({ color = "currentColor", size = 20 }: { color?: string; size?: number }) {
return (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M16 4h2a2 2 0 012 2v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2h2" />
<rect x="8" y="2" width="8" height="4" rx="1" ry="1" />
</svg>
);
}
function IconUser({ color = "currentColor", size = 20 }: { color?: string; size?: number }) {
return (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2" />
<circle cx="12" cy="7" r="4" />
</svg>
);
}
function IconPackage({ color = "currentColor", size = 20 }: { color?: string; size?: number }) {
return (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M16.5 9.4l-9-5.19M21 16V8a2 2 0 00-1-1.73l-7-4a2 2 0 00-2 0l-7 4A2 2 0 003 8v8a2 2 0 001 1.73l7 4a2 2 0 002 0l7-4A2 2 0 0021 16z" />
<polyline points="3.27 6.96 12 12.01 20.73 6.96" />
<line x1="12" y1="22.08" x2="12" y2="12" />
</svg>
);
}
function IconCalendar({ color = "currentColor", size = 20 }: { color?: string; size?: number }) {
return (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<rect x="3" y="4" width="18" height="18" rx="2" ry="2" />
<line x1="16" y1="2" x2="16" y2="6" />
<line x1="8" y1="2" x2="8" y2="6" />
<line x1="3" y1="10" x2="21" y2="10" />
</svg>
);
}
function IconCheckCircle({ color = "currentColor", size = 20 }: { color?: string; size?: number }) {
return (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M22 11.08V12a10 10 0 11-5.93-9.14" />
<polyline points="22 4 12 14.01 9 11.01" />
</svg>
);
}
function IconReceipt({ color = "currentColor", size = 20 }: { color?: string; size?: number }) {
return (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1z" />
<path d="M8 10h8" />
<path d="M8 14h4" />
</svg>
);
}
/* ─── Data ────────────────────────────────────────────────────────────── */
const nodes = [
{ id: "inbox", title: "Anfrage eingeht", desc: "Formular, E-Mail, Telefon", color: "#4F46E5", Icon: IconInbox },
{ id: "order", title: "Auftrag erstellt", desc: "Automatisch aus Anfrage", color: "#F1B729", Icon: IconClipboard },
{ id: "assign", title: "Techniker zuweisen", desc: "Basierend auf Verfügbarkeit", color: "#0D6E6E", Icon: IconUser },
{ id: "material", title: "Material bestellen", desc: "Automatisch reserviert", color: "#F97316", Icon: IconPackage },
{ id: "schedule", title: "Einsatz geplant", desc: "Termin nach Kapazität", color: "#3B82F6", Icon: IconCalendar },
{ id: "done", title: "Arbeit erledigt", desc: "Dokumentiert via App", color: "#22C55E", Icon: IconCheckCircle },
{ id: "invoice", title: "Rechnung versendet", desc: "Automatisch per Mail", color: "#8B5CF6", Icon: IconReceipt },
];
/* ─── Arrow between nodes ─────────────────────────────────────────────── */
function Arrow() {
return (
<div className="hidden lg:flex items-center justify-center shrink-0" style={{ width: 32 }}>
<svg width="32" height="16" viewBox="0 0 32 16" fill="none">
<path d="M0 8h24" stroke="var(--border-neutral)" strokeWidth="1.5" />
<path d="M22 4l6 4-6 4" stroke="var(--border-neutral)" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
</svg>
</div>
);
}
function ArrowDown() {
return (
<div className="flex items-center justify-center" style={{ height: 28 }}>
<svg width="16" height="28" viewBox="0 0 16 28" fill="none">
<path d="M8 0v20" stroke="var(--border-neutral)" strokeWidth="1.5" />
<path d="M4 18l4 6 4-6" stroke="var(--border-neutral)" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
</svg>
</div>
);
}
/* ─── Variant 1: Horizontal Pipeline (n8n style) ─────────────────────── */
function WorkflowVariant1() {
return (
<div className="rounded-2xl" style={{ border: "1px solid var(--border-light)", background: "var(--container-bg)", padding: 32 }}>
<p className="text-[13px] font-semibold mb-6" style={{ color: "var(--text-muted)" }}>Variante 1 — Horizontal Pipeline (n8n-Stil)</p>
<div className="overflow-x-auto">
<div className="flex items-center" style={{ minWidth: 1000 }}>
{nodes.map((node, i) => (
<div key={node.id} className="flex items-center">
{/* Node card */}
<div
className="flex items-center gap-3 rounded-xl shrink-0"
style={{
padding: "14px 18px",
background: "#FFFFFF",
border: `2px solid ${node.color}30`,
boxShadow: `0 2px 8px ${node.color}10, 0 1px 3px rgba(0,0,0,0.06)`,
minWidth: 120,
}}
>
{/* Icon */}
<div
className="w-10 h-10 rounded-lg flex items-center justify-center shrink-0"
style={{ background: `${node.color}14` }}
>
<node.Icon color={node.color} size={18} />
</div>
{/* Text */}
<div className="flex flex-col gap-0.5">
<span className="text-[12px] font-semibold leading-tight" style={{ color: "var(--text-primary)" }}>{node.title}</span>
<span className="text-[10px] leading-snug" style={{ color: "var(--text-secondary)" }}>{node.desc}</span>
</div>
</div>
{/* Arrow */}
{i < nodes.length - 1 && <Arrow />}
</div>
))}
</div>
</div>
</div>
);
}
/* ─── Variant 2: Vertical with connector lines ───────────────────────── */
function WorkflowVariant2() {
return (
<div className="rounded-2xl" style={{ border: "1px solid var(--border-light)", background: "var(--container-bg)", padding: 32 }}>
<p className="text-[13px] font-semibold mb-6" style={{ color: "var(--text-muted)" }}>Variante 2 — Vertikale Node-Kette</p>
<div className="flex flex-col items-center">
{nodes.map((node, i) => (
<div key={node.id} className="flex flex-col items-center">
<div
className="flex items-center gap-4 rounded-xl w-full max-w-[420px]"
style={{
padding: "16px 20px",
background: "#FFFFFF",
border: `2px solid ${node.color}25`,
boxShadow: `0 2px 8px ${node.color}08, 0 1px 3px rgba(0,0,0,0.04)`,
}}
>
{/* Step number */}
<div
className="w-9 h-9 rounded-full flex items-center justify-center shrink-0 text-[12px] font-bold text-white"
style={{ background: node.color }}
>
{i + 1}
</div>
{/* Icon */}
<div className="w-10 h-10 rounded-lg flex items-center justify-center shrink-0" style={{ background: `${node.color}12` }}>
<node.Icon color={node.color} size={18} />
</div>
{/* Text */}
<div className="flex flex-col gap-0.5">
<span className="text-[14px] font-semibold leading-tight" style={{ color: "var(--text-primary)" }}>{node.title}</span>
<span className="text-[11px] leading-snug" style={{ color: "var(--text-secondary)" }}>{node.desc}</span>
</div>
</div>
{i < nodes.length - 1 && <ArrowDown />}
</div>
))}
</div>
</div>
);
}
/* ─── Variant 3: Canvas-style with zigzag ─────────────────────────────── */
function WorkflowVariant3() {
return (
<div className="rounded-2xl" style={{ border: "1px solid var(--border-light)", background: "var(--container-bg)", padding: 32 }}>
<p className="text-[13px] font-semibold mb-6" style={{ color: "var(--text-muted)" }}>Variante 3 — Canvas mit Verbindungen</p>
<div className="relative" style={{ height: 480 }}>
{/* SVG connection paths */}
<svg className="absolute inset-0 w-full h-full pointer-events-none" viewBox="0 0 1100 480" fill="none" preserveAspectRatio="xMidYMid meet">
{/* Row 1: node 0 → 1 → 2 → 3 */}
<path d="M195 70 L280 70" stroke="#D5DBE1" strokeWidth="1.5" strokeDasharray="6 3" />
<path d="M465 70 L550 70" stroke="#D5DBE1" strokeWidth="1.5" strokeDasharray="6 3" />
<path d="M735 70 L820 70" stroke="#D5DBE1" strokeWidth="1.5" strokeDasharray="6 3" />
{/* Down from node 3 to row 2 */}
<path d="M920 110 L920 170" stroke="#D5DBE1" strokeWidth="1.5" strokeDasharray="6 3" />
{/* Row 2 (reversed): node 3 → 4 → 5 → 6 */}
<path d="M820 240 L735 240" stroke="#D5DBE1" strokeWidth="1.5" strokeDasharray="6 3" />
<path d="M550 240 L465 240" stroke="#D5DBE1" strokeWidth="1.5" strokeDasharray="6 3" />
<path d="M280 240 L195 240" stroke="#D5DBE1" strokeWidth="1.5" strokeDasharray="6 3" />
{/* Arrow tips (small circles at endpoints) */}
{[280, 550, 820].map((x) => <circle key={`r1-${x}`} cx={x - 4} cy={70} r="3" fill="#D5DBE1" />)}
<circle cx={920} cy={166} r="3" fill="#D5DBE1" />
{[735, 465, 195].map((x) => <circle key={`r2-${x}`} cx={x + 4} cy={240} r="3" fill="#D5DBE1" />)}
</svg>
{/* Row 1 */}
<div className="absolute flex items-center gap-0" style={{ top: 30, left: 0 }}>
{nodes.slice(0, 4).map((node, i) => (
<div key={node.id} className="absolute" style={{ left: i * 270 }}>
<NodeCard node={node} index={i} />
</div>
))}
</div>
{/* Row 2 — reversed direction */}
<div className="absolute flex items-center" style={{ top: 200, left: 0 }}>
{nodes.slice(4).reverse().map((node, i) => {
const origIdx = nodes.indexOf(node);
return (
<div key={node.id} className="absolute" style={{ left: i * 270 }}>
<NodeCard node={node} index={origIdx} />
</div>
);
})}
</div>
</div>
</div>
);
}
function NodeCard({ node, index }: { node: typeof nodes[0]; index: number }) {
return (
<div
className="flex items-center gap-3 rounded-xl"
style={{
width: 195,
padding: "12px 14px",
background: "#FFFFFF",
border: `2px solid ${node.color}25`,
boxShadow: `0 2px 8px ${node.color}10, 0 1px 3px rgba(0,0,0,0.05)`,
}}
>
<div className="w-10 h-10 rounded-lg flex items-center justify-center shrink-0" style={{ background: `${node.color}14` }}>
<node.Icon color={node.color} size={18} />
</div>
<div className="flex flex-col gap-0.5 min-w-0">
<span className="text-[11px] font-semibold leading-tight truncate" style={{ color: "var(--text-primary)" }}>{node.title}</span>
<span className="text-[9px] leading-snug truncate" style={{ color: "var(--text-secondary)" }}>{node.desc}</span>
</div>
{/* Handle dots — n8n style */}
<div className="absolute -left-[5px] top-1/2 -translate-y-1/2 w-[10px] h-[10px] rounded-full border-2 border-white" style={{ background: node.color }} />
<div className="absolute -right-[5px] top-1/2 -translate-y-1/2 w-[10px] h-[10px] rounded-full border-2 border-white" style={{ background: node.color }} />
</div>
);
}
/* ─── Stats Bar ───────────────────────────────────────────────────────── */
function StatsBar() {
const stats = [
{ num: "7", label: "Automatisierte Schritte", color: "var(--text-primary)" },
{ num: "0", label: "Manuelle Klicks", color: "var(--accent-yellow-dark)" },
{ num: "<2 Min", label: "Durchlaufzeit", color: "var(--accent-teal)" },
{ num: "100%", label: "Dokumentiert", color: "#22C55E" },
];
return (
<div className="flex flex-wrap items-center justify-center gap-8 lg:gap-12 mt-10 pt-10" style={{ borderTop: "1px solid var(--border-light)" }}>
{stats.map((s, i) => (
<div key={s.label} className="flex items-center gap-8 lg:gap-12">
<div className="flex flex-col items-center gap-1">
<span className="text-[32px] md:text-[36px] font-bold tabular-nums" style={{ color: s.color }}>{s.num}</span>
<span className="text-[12px] font-medium" style={{ color: "var(--text-secondary)" }}>{s.label}</span>
</div>
{i < stats.length - 1 && <div className="hidden md:block" style={{ width: 1, height: 48, background: "var(--border-light)" }} />}
</div>
))}
</div>
);
}
/* ─── Main Export ─────────────────────────────────────────────────────── */
export default function WorkflowShowcase() {
return (
<section className="section-full" style={{ background: "var(--surface)", paddingBlock: 80 }}>
<div className="mx-auto" style={{ maxWidth: "var(--content-width)" }}>
<div className="flex flex-col items-center gap-4 text-center mb-16">
<span className="text-[12px] font-semibold tracking-widest chamfer-badge px-2 py-0.5" style={{ background: "var(--accent-yellow-light)", color: "var(--accent-yellow-dark)" }}>WORKFLOW</span>
<h2 className="text-[32px] md:text-[42px] font-bold leading-[1.15]" style={{ color: "var(--text-primary)" }}>Von der Anfrage bis zur Rechnung</h2>
<p className="text-[16px] leading-relaxed max-w-2xl" style={{ color: "var(--text-secondary)" }}>Drei Workflow-Visualisierungen im n8n-Stil. Jeder Node ist ein automatisierter Schritt.</p>
</div>
<div className="flex flex-col gap-8">
<WorkflowVariant1 />
<WorkflowVariant2 />
<WorkflowVariant3 />
</div>
<StatsBar />
</div>
</section>
);
}