Add email verification, personal calendar feed, and full SEO implementation
- Customer accounts now require email verification (hashed, single-use, time-limited tokens) before they can request/confirm bookings, with resend flows on login/account/booking widget and rate limiting. - Admins get a private, rotatable iCalendar (ICS) subscription feed of their confirmed bookings and public events, timezone-correct for Europe/Berlin including DST, never exposing meeting passwords. - Adds a full SEO layer: per-page canonical/OG/Twitter metadata with CMS-editable overrides and content-derived fallbacks, a dynamic sitemap.xml and robots.txt driven by real published content, JSON-LD (Organization/LocalBusiness, WebSite, WebPage, BreadcrumbList, Service, Event, BlogPosting) that never fabricates data, and a CMS-managed redirect table for changed slugs. - Global ANOUMA-naming audit: the brand name is never used to label personal account/calendar areas anywhere in the app, CMS, or emails. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { AdminViewServerProps } from "payload";
|
||||
import { getAdminCalendarItems, type AdminCalendarItem } from "@/lib/booking/adminCalendar";
|
||||
import { CalendarFeedPanel } from "./CalendarFeedPanel";
|
||||
import styles from "./AdminCalendarView.module.css";
|
||||
|
||||
const WEEKDAY_LABELS = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"];
|
||||
@@ -58,6 +59,12 @@ export async function AdminCalendarView({ initPageResult }: AdminViewServerProps
|
||||
rangeEnd.setDate(rangeEnd.getDate() + 41); // 6 full weeks
|
||||
|
||||
const items = await getAdminCalendarItems(req.payload, { from: rangeStart, to: rangeEnd });
|
||||
|
||||
// Local API (overrideAccess: true by default) so this can see
|
||||
// calendarFeedTokenHash despite its field-level access being locked to
|
||||
// "nobody" for every real API path — see collections/Users.ts.
|
||||
const currentUser = req.user ? await req.payload.findByID({ collection: "users", id: req.user.id, req }) : null;
|
||||
const calendarFeedConfigured = Boolean((currentUser as { calendarFeedTokenHash?: string | null } | null)?.calendarFeedTokenHash);
|
||||
const itemsByDay = new Map<string, AdminCalendarItem[]>();
|
||||
for (const item of items) {
|
||||
const key = dateKey(new Date(item.date));
|
||||
@@ -134,6 +141,8 @@ export async function AdminCalendarView({ initPageResult }: AdminViewServerProps
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<CalendarFeedPanel initiallyConfigured={calendarFeedConfigured} />
|
||||
</div>
|
||||
|
||||
<div className={styles.schedule}>
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
.panel {
|
||||
margin-top: 28px;
|
||||
border: 1px solid #e6e6e6;
|
||||
border-radius: 12px;
|
||||
padding: 20px 22px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
}
|
||||
|
||||
.heading {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin: 0 0 4px;
|
||||
color: #1f1f1f;
|
||||
}
|
||||
|
||||
.hint {
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
margin: 0 0 14px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.status {
|
||||
font-size: 13px;
|
||||
color: #555;
|
||||
margin: 0 0 14px;
|
||||
}
|
||||
|
||||
.button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
border: none;
|
||||
border-radius: 999px;
|
||||
background: #8b616d;
|
||||
color: #fff;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
padding: 9px 18px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.button:hover {
|
||||
background: #66505f;
|
||||
}
|
||||
.button:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.secondaryButton {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
border-radius: 999px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
padding: 9px 18px;
|
||||
cursor: pointer;
|
||||
background: transparent;
|
||||
color: #8b616d;
|
||||
border: 1px solid #8b616d;
|
||||
}
|
||||
.secondaryButton:hover {
|
||||
background: #f7f0f2;
|
||||
}
|
||||
.secondaryButton:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.result {
|
||||
margin-top: 16px;
|
||||
border-radius: 10px;
|
||||
background: #f7f4f1;
|
||||
padding: 14px 16px;
|
||||
}
|
||||
|
||||
.resultWarning {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #7a2020;
|
||||
margin: 0 0 8px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
|
||||
.urlRow {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.urlInput {
|
||||
flex: 1;
|
||||
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
|
||||
font-size: 12px;
|
||||
padding: 8px 10px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #dcdcdc;
|
||||
background: #fff;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.copied {
|
||||
font-size: 12px;
|
||||
color: #3a4f30;
|
||||
margin: 8px 0 0;
|
||||
}
|
||||
|
||||
.error {
|
||||
font-size: 13px;
|
||||
color: #7a2020;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.instructions {
|
||||
margin-top: 18px;
|
||||
font-size: 12px;
|
||||
color: #777;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.instructions strong {
|
||||
color: #444;
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import styles from "./CalendarFeedPanel.module.css";
|
||||
|
||||
export function CalendarFeedPanel({ initiallyConfigured }: { initiallyConfigured: boolean }) {
|
||||
const [configured, setConfigured] = useState(initiallyConfigured);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [url, setUrl] = useState<string | null>(null);
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
async function generate() {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
setCopied(false);
|
||||
try {
|
||||
const res = await fetch("/api/admin/calendar-feed/regenerate", { method: "POST", credentials: "include" });
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok) {
|
||||
setError(data.error || "Der Kalender-Link konnte nicht erzeugt werden.");
|
||||
return;
|
||||
}
|
||||
setUrl(data.url);
|
||||
setConfigured(true);
|
||||
} catch {
|
||||
setError("Verbindung fehlgeschlagen.");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function copy() {
|
||||
if (!url) return;
|
||||
try {
|
||||
await navigator.clipboard.writeText(url);
|
||||
setCopied(true);
|
||||
} catch {
|
||||
// Clipboard API can be unavailable (e.g. insecure context) — the
|
||||
// input is still selectable/copyable by hand in that case.
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.panel}>
|
||||
<h2 className={styles.heading}>Kalender synchronisieren</h2>
|
||||
<p className={styles.hint}>
|
||||
Abonniere deinen persönlichen Kalender in Apple Kalender, Google Kalender, Outlook, Thunderbird oder einer
|
||||
anderen iCalendar-kompatiblen App. Der Link enthält ein geheimes Zugriffstoken — teile ihn nicht.
|
||||
</p>
|
||||
|
||||
{!url && (
|
||||
<p className={styles.status}>
|
||||
{configured ? "Ein Kalender-Link ist eingerichtet." : "Es ist noch kein Kalender-Link eingerichtet."}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{!url && (
|
||||
<button type="button" className={styles.button} onClick={generate} disabled={loading}>
|
||||
{loading ? "Wird erzeugt …" : configured ? "Kalender-Link neu generieren" : "Kalender-Link generieren"}
|
||||
</button>
|
||||
)}
|
||||
|
||||
{error && <p className={styles.error}>{error}</p>}
|
||||
|
||||
{url && (
|
||||
<div className={styles.result}>
|
||||
<p className={styles.resultWarning}>Wird nur jetzt einmal angezeigt — bitte gleich kopieren.</p>
|
||||
<div className={styles.urlRow}>
|
||||
<input className={styles.urlInput} type="text" readOnly value={url} onFocus={(e) => e.currentTarget.select()} />
|
||||
<button type="button" className={styles.secondaryButton} onClick={copy}>
|
||||
Kopieren
|
||||
</button>
|
||||
</div>
|
||||
{copied && <p className={styles.copied}>In die Zwischenablage kopiert.</p>}
|
||||
<button type="button" className={styles.secondaryButton} style={{ marginTop: 12 }} onClick={generate} disabled={loading}>
|
||||
{loading ? "Wird erzeugt …" : "Kalender-Link neu generieren"}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<p className={styles.instructions}>
|
||||
<strong>Apple Kalender:</strong> Ablage → Neues Kalenderabonnement → Link einfügen.
|
||||
<br />
|
||||
<strong>Google Kalender:</strong> Weitere Kalender „+“ → Per URL → Link einfügen.
|
||||
<br />
|
||||
<strong>Outlook:</strong> Kalender hinzufügen → Aus dem Internet abonnieren → Link einfügen.
|
||||
<br />
|
||||
<strong>Thunderbird:</strong> Kalender → Neuer Kalender → Im Netzwerk → Link einfügen.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user