Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+89
@@ -0,0 +1,89 @@
|
||||
// AK-P16b · booking-page editor UI (M06 Block E.2 + H). Minimal FUNCTIONAL form
|
||||
// (bespoke polish follows D-P16): grunddata + providers + confirmation template +
|
||||
// publish toggle, and the public-URL + iframe embed-code generator with copy buttons.
|
||||
|
||||
import { Form, useActionData, useLoaderData } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useRootData } from "~/utils/data/useRootData";
|
||||
import type { BookingPageEditorLoaderData, BookingPageEditorActionData } from "../routes/BookingPageEditor.server";
|
||||
|
||||
function CopyField({ label, value }: { label: string; value: string }): JSX.Element {
|
||||
return (
|
||||
<div className="mt-2">
|
||||
<span className="text-muted-foreground text-xs">{label}</span>
|
||||
<div className="flex gap-2">
|
||||
<input readOnly value={value} className="w-full rounded border px-2 py-1 text-xs" data-ui-id="ui.booking.pages.embed.value" />
|
||||
<button type="button" className="rounded border px-2 py-1 text-xs" onClick={() => navigator.clipboard?.writeText(value)}>
|
||||
⧉
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function BookingPageEditorRoute(): JSX.Element {
|
||||
const { t } = useTranslation();
|
||||
const vm = useLoaderData<BookingPageEditorLoaderData>();
|
||||
const actionData = useActionData<BookingPageEditorActionData>();
|
||||
const rootData = useRootData();
|
||||
const page = vm.page;
|
||||
|
||||
return (
|
||||
<main className="mx-auto max-w-2xl px-4 py-10" data-ui-id="ui.booking.pages.editor">
|
||||
<h1 className="text-foreground text-xl font-semibold">{t("bookings.pages.editor.title")}</h1>
|
||||
|
||||
{actionData && !actionData.ok ? (
|
||||
<p role="alert" className="mt-4 text-red-600" data-ui-id="ui.booking.pages.editor.error">
|
||||
{t(actionData.errorKey)}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
<Form method="post" className="mt-6 space-y-3">
|
||||
{rootData.csrf && <input type="hidden" name="csrf" value={rootData.csrf} />}
|
||||
<label className="block">
|
||||
<span className="text-sm">{t("bookings.pages.editor.slug")}</span>
|
||||
<input name="slug" defaultValue={page?.slug ?? ""} required className="w-full rounded border px-2 py-1" />
|
||||
</label>
|
||||
<label className="block">
|
||||
<span className="text-sm">{t("bookings.pages.editor.pageTitle")}</span>
|
||||
<input name="title" defaultValue={page?.title ?? ""} required className="w-full rounded border px-2 py-1" />
|
||||
</label>
|
||||
<label className="block">
|
||||
<span className="text-sm">{t("bookings.pages.editor.description")}</span>
|
||||
<textarea name="description" defaultValue={page?.description ?? ""} className="w-full rounded border px-2 py-1" />
|
||||
</label>
|
||||
<label className="block">
|
||||
<span className="text-sm">{t("bookings.pages.editor.duration")}</span>
|
||||
<input name="durationMinutes" type="number" defaultValue={page?.durationMinutes ?? 30} className="w-full rounded border px-2 py-1" />
|
||||
</label>
|
||||
<label className="block">
|
||||
<span className="text-sm">{t("bookings.pages.editor.providers")}</span>
|
||||
<input name="providers" defaultValue={page?.providerUserIds.join(",") ?? ""} placeholder="userId1,userId2" className="w-full rounded border px-2 py-1" />
|
||||
</label>
|
||||
<label className="block">
|
||||
<span className="text-sm">{t("bookings.pages.editor.confirmationSubject")}</span>
|
||||
<input name="confirmationEmailSubject" defaultValue={page?.confirmationEmailSubject ?? ""} className="w-full rounded border px-2 py-1" />
|
||||
</label>
|
||||
<label className="block">
|
||||
<span className="text-sm">{t("bookings.pages.editor.confirmationBody")}</span>
|
||||
<textarea name="confirmationEmailBody" defaultValue={page?.confirmationEmailBody ?? ""} className="w-full rounded border px-2 py-1" />
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-sm">
|
||||
<input type="checkbox" name="isPublished" defaultChecked={page?.isPublished ?? false} />
|
||||
{t("bookings.pages.editor.publishToggle")}
|
||||
</label>
|
||||
<button type="submit" className="rounded bg-primary px-4 py-2 text-primary-foreground" data-ui-id="ui.booking.pages.editor.save">
|
||||
{t("bookings.pages.editor.save")}
|
||||
</button>
|
||||
</Form>
|
||||
|
||||
{vm.publicUrl && vm.embedCode ? (
|
||||
<section className="mt-8" data-ui-id="ui.booking.pages.embed">
|
||||
<h2 className="font-medium">{t("bookings.pages.embedCode")}</h2>
|
||||
<CopyField label={t("bookings.pages.publicUrl")} value={vm.publicUrl} />
|
||||
<CopyField label={t("bookings.pages.embedCode")} value={vm.embedCode} />
|
||||
</section>
|
||||
) : null}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
// AK-P16b · public booking page (M06 Block G) — minimal FUNCTIONAL UI (reachable +
|
||||
// i18n + states), NOT the bespoke Calendly-polish screen (that waits on David D-P16).
|
||||
// Single-page flow: pick a slot → fill the mini-form (GDPR required) → confirmation
|
||||
// with an "add to calendar" (.ics) download. The component reads route-injected data
|
||||
// only (no DB import); it is in apps/web so useLoaderData is allowed here.
|
||||
|
||||
import { Form, useActionData, useLoaderData, useNavigation } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import type { PublicBookingLoaderData, PublicBookingActionData } from "../routes/PublicBooking.server";
|
||||
|
||||
export default function PublicBookingRoute(): JSX.Element {
|
||||
const vm = useLoaderData<PublicBookingLoaderData>();
|
||||
const actionData = useActionData<PublicBookingActionData>();
|
||||
const navigation = useNavigation();
|
||||
const { t } = useTranslation();
|
||||
const submitting = navigation.state === "submitting";
|
||||
|
||||
if (actionData?.ok) {
|
||||
const icsHref = `data:text/calendar;base64,${actionData.icsBase64}`;
|
||||
return (
|
||||
<main data-ui-id="ui.booking.public" className={vm.isEmbed ? "p-4" : "mx-auto max-w-xl p-6"}>
|
||||
<h1 className="text-xl font-semibold">{t("bookings.public.confirmedHeadline")}</h1>
|
||||
<p className="mt-2">
|
||||
{t("bookings.public.confirmedBody", { title: actionData.titleLabel, date: actionData.dateLabel, time: actionData.timeLabel })}
|
||||
</p>
|
||||
<a data-ui-id="ui.booking.public.ics" href={icsHref} download="termin.ics" className="mt-4 inline-block underline">
|
||||
{t("bookings.public.addToCalendar")}
|
||||
</a>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<main data-ui-id="ui.booking.public" className={vm.isEmbed ? "p-4" : "mx-auto max-w-xl p-6"}>
|
||||
<header>
|
||||
<p className="text-sm text-muted-foreground">{vm.tenantName}</p>
|
||||
<h1 className="text-xl font-semibold">{vm.title}</h1>
|
||||
{vm.description ? <p className="mt-1 text-muted-foreground">{vm.description}</p> : null}
|
||||
<p className="mt-1 text-sm">{t("bookings.public.duration", { minutes: vm.durationMinutes })}</p>
|
||||
</header>
|
||||
|
||||
{actionData && !actionData.ok ? (
|
||||
<p data-ui-id="ui.booking.public.error" role="alert" className="mt-4 text-red-600">
|
||||
{t(actionData.errorKey)}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
{vm.slots.length === 0 ? (
|
||||
<p data-ui-id="ui.booking.public.empty" className="mt-6">
|
||||
{t("bookings.public.noSlots")}
|
||||
</p>
|
||||
) : (
|
||||
<Form method="post" className="mt-6 space-y-4" data-ui-id="ui.booking.public.form">
|
||||
<input type="hidden" name="date" value={vm.date} />
|
||||
<input type="hidden" name="tz" value={vm.timezone} />
|
||||
{/* Honeypot — hidden from real users (M06 abuse guard). */}
|
||||
<input type="text" name="company" tabIndex={-1} autoComplete="off" className="hidden" aria-hidden="true" />
|
||||
|
||||
<fieldset>
|
||||
<legend className="text-sm font-medium">{t("bookings.public.chooseSlot", { date: vm.date })}</legend>
|
||||
<div className="mt-2 flex flex-wrap gap-2">
|
||||
{vm.slots.map((slot, index) => (
|
||||
<label key={slot.startAtIso} className="cursor-pointer rounded border px-3 py-1">
|
||||
<input type="radio" name="startAt" value={slot.startAtIso} defaultChecked={index === 0} className="mr-1" />
|
||||
{slot.label}
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<input name="vorname" placeholder={t("bookings.public.firstName")} className="rounded border px-3 py-2" required />
|
||||
<input name="nachname" placeholder={t("bookings.public.lastName")} className="rounded border px-3 py-2" required />
|
||||
</div>
|
||||
<input name="email" type="email" placeholder={t("bookings.public.email")} className="w-full rounded border px-3 py-2" required />
|
||||
<input name="telefon" placeholder={t("bookings.public.phone")} className="w-full rounded border px-3 py-2" />
|
||||
|
||||
<label className="flex items-start gap-2 text-sm">
|
||||
<input type="checkbox" name="gdpr" required className="mt-1" />
|
||||
<span>{t("bookings.public.gdpr")}</span>
|
||||
</label>
|
||||
|
||||
<button type="submit" disabled={submitting} data-ui-id="ui.booking.public.submit" className="rounded bg-primary px-4 py-2 text-primary-foreground disabled:opacity-50">
|
||||
{submitting ? t("bookings.public.submitting") : t("bookings.public.submit")}
|
||||
</button>
|
||||
</Form>
|
||||
)}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user