Files

202 lines
9.3 KiB
TypeScript

"use client";
import { useCallback, useEffect, useRef, useState, type ReactNode } from "react";
import Link from "next/link";
import {
ChatCircleDots,
PaperPlaneTilt,
Kanban,
FlowArrow,
ClipboardText,
ArrowRight,
CaretLeft,
CaretRight,
} from "@phosphor-icons/react/ssr";
import type { Icon as PhosphorIcon } from "@phosphor-icons/react";
import { CHAMFER } from "@/lib/chamfer";
import WebChatDemo from "@/components/sections/WebChatDemo";
import EmailBuilder from "@/components/sections/EmailBuilder";
import KanbanBoard from "@/components/sections/KanbanBoard";
import WorkflowEditor from "@/components/sections/WorkflowEditor";
import ApprovalInbox from "@/components/sections/ApprovalInbox";
const HEX = "polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)";
type Module = { name: string; blurb: string; href: string; Icon: PhosphorIcon; demo: ReactNode };
// The real interactive product modules — shown here display-only (see the
// `inert` embed below) with a CTA to the subpage where they're interactive.
// Vertriebspipelines is intentionally excluded.
const MODULES: Module[] = [
{ name: "Team-Chat", blurb: "Projektkanäle und Aufgaben direkt aus dem Chat.", href: "/produkt/chat", Icon: ChatCircleDots, demo: <WebChatDemo /> },
{ name: "E-Mail-Baukasten", blurb: "Kampagnen per Drag-and-drop selbst gebaut.", href: "/produkt/email-marketing", Icon: PaperPlaneTilt, demo: <EmailBuilder hideHeader /> },
{ name: "Kanban-Board", blurb: "Projekte und Baustellen im Blick.", href: "/produkt/projektmanagement", Icon: Kanban, demo: <KanbanBoard hideHeader /> },
{ name: "Workflow-Editor", blurb: "Abläufe visuell und ohne Code.", href: "/produkt/workflow-engine", Icon: FlowArrow, demo: <WorkflowEditor hideHeader /> },
{ name: "Freigaben", blurb: "Anträge freigeben oder ablehnen, in Sekunden.", href: "/produkt/mitarbeitermanagement", Icon: ClipboardText, demo: <ApprovalInbox hideHeader /> },
];
export default function WaitlistModules() {
const trackRef = useRef<HTMLDivElement>(null);
const [active, setActive] = useState(0);
const goTo = useCallback((i: number) => {
const track = trackRef.current;
if (!track) return;
const clamped = Math.max(0, Math.min(MODULES.length - 1, i));
track.scrollTo({ left: clamped * track.clientWidth, behavior: "smooth" });
}, []);
// Make the embedded demos truly non-interactive: `inert` also drops them out
// of the tab order (pointer-events:none only blocks the mouse). Set via DOM
// property so it works regardless of React's attribute handling.
useEffect(() => {
trackRef.current?.querySelectorAll<HTMLElement>(".demo-embed").forEach((el) => {
el.inert = true;
});
}, []);
// Keep the active dot/arrows in sync with native (swipe) scrolling.
useEffect(() => {
const track = trackRef.current;
if (!track) return;
let raf = 0;
const onScroll = () => {
cancelAnimationFrame(raf);
raf = requestAnimationFrame(() => {
setActive(Math.round(track.scrollLeft / track.clientWidth));
});
};
track.addEventListener("scroll", onScroll, { passive: true });
return () => {
track.removeEventListener("scroll", onScroll);
cancelAnimationFrame(raf);
};
}, []);
return (
<section className="section-full wl-modules" style={{ background: "var(--bg-primary)", paddingBlock: 96 }}>
<style>{`
.wl-modules .demo-embed .section-full{ padding:14px 14px 0 !important; background:transparent !important; width:100% !important; min-height:0 !important; }
.wl-modules .no-scrollbar{ scrollbar-width:none; -ms-overflow-style:none; }
.wl-modules .no-scrollbar::-webkit-scrollbar{ display:none; }
/* the modules' onboarding hint popups make no sense in a display-only preview */
.wl-modules [data-canvas-hint]{ display:none !important; }
`}</style>
<div className="mx-auto flex flex-col items-center" style={{ maxWidth: "var(--content-width)" }}>
{/* transition from the timeline into "what you actually get" */}
<div className="flex flex-col items-center gap-3 text-center mb-20 md:mb-24">
<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)" }}
>
DAS BEKOMMST DU
</span>
<h2 className="text-[28px] md:text-[38px] font-bold leading-[1.15]" style={{ color: "var(--text-primary)" }}>
Ein Blick in deinen künftigen Betrieb.
</h2>
<p className="text-[16px] md:text-[17px] max-w-[580px]" style={{ color: "var(--text-secondary)" }}>
Von Team-Chat bis Rechnungs-Automatik: die Module, mit denen dein Betrieb
bald läuft. Wisch dich durch und probier jedes live auf seiner Seite aus.
</p>
</div>
<div className="relative w-full">
{/* arrows (desktop) */}
<button
type="button"
aria-label="Vorheriges Modul"
onClick={() => goTo(active - 1)}
disabled={active === 0}
className="hidden md:grid place-items-center absolute left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 z-20 w-11 h-11 rounded-full transition disabled:opacity-0"
style={{ background: "#fff", color: "var(--text-primary)", boxShadow: "0 8px 24px -8px rgba(15,23,42,0.35)" }}
>
<CaretLeft size={20} weight="bold" />
</button>
<button
type="button"
aria-label="Nächstes Modul"
onClick={() => goTo(active + 1)}
disabled={active === MODULES.length - 1}
className="hidden md:grid place-items-center absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 z-20 w-11 h-11 rounded-full transition disabled:opacity-0"
style={{ background: "#fff", color: "var(--text-primary)", boxShadow: "0 8px 24px -8px rgba(15,23,42,0.35)" }}
>
<CaretRight size={20} weight="bold" />
</button>
{/* track */}
<div
ref={trackRef}
className="no-scrollbar"
style={{ display: "flex", overflowX: "auto", scrollSnapType: "x mandatory", scrollBehavior: "smooth" }}
>
{MODULES.map((m) => (
<div
key={m.name}
className="px-1 md:px-8"
style={{ flex: "0 0 100%", minWidth: 0, scrollSnapAlign: "center" }}
>
{/* caption */}
<div className="flex items-center justify-center gap-3 mb-4">
<span className="grid place-items-center shrink-0" style={{ width: 40, height: 35, clipPath: HEX, background: "var(--accent-yellow-light)" }}>
<m.Icon size={20} weight="duotone" style={{ color: "var(--accent-yellow-dark)" }} />
</span>
<div className="text-left">
<h3 className="text-[17px] md:text-[19px] font-bold leading-tight" style={{ color: "var(--text-primary)" }}>{m.name}</h3>
<p className="text-[13.5px] leading-tight" style={{ color: "var(--text-secondary)" }}>{m.blurb}</p>
</div>
</div>
{/* preview frame — display-only module + fade + CTA */}
<div
className="relative overflow-hidden mx-auto"
style={{ background: "#fff", clipPath: CHAMFER, height: "clamp(420px, 60vh, 520px)", filter: "drop-shadow(0 24px 44px rgba(15,23,42,0.14))" }}
>
<div className="demo-embed absolute inset-0" style={{ pointerEvents: "none" }} aria-hidden>
{m.demo}
</div>
{/* bottom fade so the clipped module reads as a peek, not a cut */}
<div
className="absolute inset-x-0 bottom-0 pointer-events-none"
style={{ height: 150, background: "linear-gradient(to bottom, rgba(255,255,255,0) 0%, #fff 82%)" }}
aria-hidden
/>
<Link
href={m.href}
className="absolute left-1/2 bottom-6 -translate-x-1/2 z-10 inline-flex items-center gap-2 rounded-[var(--radius-button)] font-semibold text-[15px] px-5 py-2.5 transition-transform hover:-translate-y-0.5"
style={{ background: "var(--accent-yellow)", color: "var(--text-primary)", boxShadow: "0 10px 24px -6px rgba(241,183,41,0.6)" }}
>
Live ausprobieren
<ArrowRight size={17} weight="bold" />
</Link>
</div>
</div>
))}
</div>
{/* dots */}
<div className="flex items-center justify-center gap-2.5 mt-8">
{MODULES.map((m, i) => (
<button
key={m.name}
type="button"
aria-label={`Zu ${m.name}`}
aria-current={i === active}
onClick={() => goTo(i)}
className="rounded-full transition-all"
style={{
width: i === active ? 26 : 9,
height: 9,
background: i === active ? "var(--accent-yellow)" : "var(--border-light)",
}}
/>
))}
</div>
</div>
</div>
</section>
);
}