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
@@ -1,12 +1,33 @@
|
||||
import { ActionFunction, LoaderFunctionArgs, MetaFunction } from "react-router";
|
||||
import { Link, useActionData, useLoaderData } from "react-router";
|
||||
import Logo from "~/components/brand/Logo";
|
||||
import { Form, Link, useActionData, useLoaderData, useNavigation } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FeatherArrowLeft, FeatherCheckCircle, FeatherInfo, FeatherRefreshCw } from "@subframe/core";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import type { Registration } from "@toolctrl/db/prisma-browser";
|
||||
import type { Registration } from "@hivegrid/db/prisma-browser";
|
||||
import { getRegistrationByToken } from "~/utils/db/registration.db.server";
|
||||
import { RegisterForm } from "~/modules/users/components/RegisterForm";
|
||||
import AuthService from "~/modules/users/services/AuthService";
|
||||
import { useRootData } from "~/utils/data/useRootData";
|
||||
import { AuthShell } from "~/components/auth/AuthShell";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
import { Card } from "~/ui/components/Card";
|
||||
import { IconWithBackground } from "~/ui/components/IconWithBackground";
|
||||
import { LinkButton } from "~/ui/components/LinkButton";
|
||||
import { Loader } from "~/ui/components/Loader";
|
||||
import { Logo } from "~/ui/components/Logo";
|
||||
import { TextInput } from "~/ui/components/TextInput";
|
||||
|
||||
// E-Mail-Bestaetigung -> nach Davids Subframe-"S02 Signup erfolgreich / Workspace wird vorbereitet".
|
||||
//
|
||||
// Davids S02 ist input-los und auto-provisioniert. Die bestehende Backend-Kette verlangt aber, dass der
|
||||
// Nutzer hier ein Passwort setzt (das Registration-Modell hat KEINE Passwort-Spalte, das Passwort wird also
|
||||
// erst beim Verify gesammelt) und provisioniert SYNCHRON in der Action (kein Job/Polling). Deshalb:
|
||||
// - vor dem Absenden: kompakte Abschluss-Card (Passwort -> "Workspace einrichten"); restliche Stammdaten
|
||||
// kommen aus der Registration als hidden-Felder (kein erneutes Tippen).
|
||||
// - waehrend des Absendens: Davids S02 "Workspace wird vorbereitet" (Checkliste + Loader) als der
|
||||
// Provisionierungs-Moment; bei Erfolg leitet die Action auf das Dashboard weiter.
|
||||
// [Backend-Flags] Davids reines Auto-S02 braucht: Passwort-Spalte auf Registration (Erfassung schon in S01),
|
||||
// asynchrone Provisionierung + Polling/Live-Checkliste. Davids "Erneut versuchen"/"Support kontaktieren"
|
||||
// sind hier weggelassen (synchroner Flow, keine echten Ziele).
|
||||
|
||||
export const meta: MetaFunction<typeof loader> = ({ data }) => [{ title: data?.title }];
|
||||
|
||||
@@ -48,52 +69,119 @@ export default function RegisterRoute() {
|
||||
const data = useLoaderData<LoaderData>();
|
||||
const actionData = useActionData<ActionData>();
|
||||
const { t } = useTranslation();
|
||||
const { csrf } = useRootData();
|
||||
const navigation = useNavigation();
|
||||
const isSubmitting = navigation.state !== "idle";
|
||||
const registration = data.registration;
|
||||
const canComplete = Boolean(registration && !registration.createdTenantId);
|
||||
|
||||
return (
|
||||
<div className="bg-background">
|
||||
<div className="flex min-h-screen items-center justify-center px-4 py-12 sm:px-6 lg:px-8">
|
||||
<div className="w-full max-w-md space-y-8">
|
||||
<Logo className="mx-auto h-12 w-auto" />
|
||||
|
||||
{data.registration && !data.registration.createdTenantId ? (
|
||||
<>
|
||||
<div>
|
||||
<h1 className="text-foreground mt-6 text-center text-lg font-bold leading-9 dark:text-slate-200">{t("account.verify.title")}</h1>
|
||||
<p className="max-w text-foreground mt-2 text-center text-sm leading-5 dark:text-slate-200">
|
||||
{t("account.register.alreadyRegistered")}{" "}
|
||||
<span className="text-primary font-medium hover:underline">
|
||||
<Link to="/login">{t("account.register.clickHereToLogin")}</Link>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<RegisterForm
|
||||
isVerifyingEmail
|
||||
data={{
|
||||
company: actionData?.fields?.company ?? data.registration?.company ?? "",
|
||||
firstName: actionData?.fields?.firstName ?? data.registration?.firstName,
|
||||
lastName: actionData?.fields?.lastName ?? data.registration?.lastName,
|
||||
email: actionData?.fields?.email ?? data.registration?.email,
|
||||
slug: actionData?.fields?.slug ?? data.registration?.slug ?? "",
|
||||
}}
|
||||
error={actionData?.error}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<div>
|
||||
<div className="sm:mx-auto sm:w-full sm:max-w-md">
|
||||
<div className="mx-auto mb-4 w-full max-w-md rounded-sm px-8 pb-8">
|
||||
<div className="text-xl font-black">
|
||||
<h1 className="mt-6 text-center text-lg font-extrabold">{t("account.verify.title")}</h1>
|
||||
</div>
|
||||
<div className="my-4 leading-tight">
|
||||
<p className="max-w mt-2 text-center text-sm leading-5">{t("account.verify.invalidLink")}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
// S02 "Workspace wird vorbereitet" — Provisionierungs-Moment waehrend des Absendens.
|
||||
if (canComplete && isSubmitting) {
|
||||
return (
|
||||
<div
|
||||
className="flex min-h-screen w-full flex-col items-center justify-center gap-8 bg-surface-neutral-primary px-4 py-12 mobile:gap-6 mobile:py-6"
|
||||
data-ui-id="ui.auth.verify.preparing"
|
||||
>
|
||||
<Logo size="64" />
|
||||
<Card size="medium" variant="default" className="max-w-[448px]">
|
||||
<div className="flex w-full flex-col items-center gap-6">
|
||||
<IconWithBackground size="large" round={true} icon={<FeatherRefreshCw />} />
|
||||
<div className="flex w-full flex-col items-center gap-2">
|
||||
<span className="text-heading- font-heading- text-text-neutral-primary text-center">{t("account.verify.preparingTitle")}</span>
|
||||
<span className="w-full text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary text-center">{t("account.verify.preparingBody")}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex w-full flex-col items-start gap-3 rounded-md border border-solid border-border-default bg-surface-neutral-primary px-4 py-4">
|
||||
<div className="flex w-full items-center gap-3">
|
||||
<FeatherCheckCircle className="text-body-default-regular-150 font-body-default-regular-150 text-text-feedback-positive" />
|
||||
<span className="grow shrink-0 basis-0 text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">{t("account.verify.stepAccountCreated")}</span>
|
||||
</div>
|
||||
<div className="flex w-full items-center gap-3">
|
||||
<FeatherCheckCircle className="text-body-default-regular-150 font-body-default-regular-150 text-text-feedback-positive" />
|
||||
<span className="grow shrink-0 basis-0 text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">{t("account.verify.stepEmailConfirmed")}</span>
|
||||
</div>
|
||||
<div className="flex w-full items-center gap-3">
|
||||
<Loader className="text-text-neutral-tertiary" size="small" />
|
||||
<span className="grow shrink-0 basis-0 text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-primary">{t("account.verify.stepWorkspaceConfiguring")}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex w-full items-center justify-center gap-2">
|
||||
<FeatherInfo className="text-body-small-regular-150 font-body-small-regular-150 text-icon-neutral-tertiary" />
|
||||
<span className="text-body-extra-small-regular-150 font-body-extra-small-regular-150 text-text-neutral-tertiary text-center">{t("account.verify.autoRedirectNote")}</span>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Abschluss-Card: Passwort setzen -> Workspace einrichten (Backend sammelt das Passwort erst hier).
|
||||
if (canComplete) {
|
||||
return (
|
||||
<AuthShell
|
||||
title={t("account.verify.title")}
|
||||
subtitle={t("account.verify.completeSubtitle")}
|
||||
cardSize="medium"
|
||||
cardClassName="max-w-[448px]"
|
||||
logoIconOnly={false}
|
||||
dataUiId="ui.auth.verify.page"
|
||||
>
|
||||
<Form method="post" noValidate className="flex w-full flex-col gap-4" data-ui-id="ui.auth.verify.form">
|
||||
<input type="hidden" name="csrf" value={csrf} readOnly />
|
||||
<input type="hidden" name="email" value={registration?.email ?? ""} readOnly />
|
||||
<input type="hidden" name="company" value={registration?.company ?? ""} readOnly />
|
||||
<input type="hidden" name="first-name" value={registration?.firstName ?? ""} readOnly />
|
||||
<input type="hidden" name="last-name" value={registration?.lastName ?? ""} readOnly />
|
||||
|
||||
<div className="flex w-full flex-col items-center gap-2 rounded-md border border-solid border-border-default bg-surface-neutral-primary px-4 py-3">
|
||||
<span className="text-body-extra-small-medium-150 font-body-extra-small-medium-150 text-text-neutral-tertiary">{t("account.verify.linkSentTo")}</span>
|
||||
<span className="w-full text-body-default-semibold-0 font-body-default-semibold-0 text-text-neutral-primary text-center">{registration?.email}</span>
|
||||
</div>
|
||||
|
||||
<TextInput
|
||||
className="h-auto w-full flex-none"
|
||||
fillContainer
|
||||
showLabel
|
||||
label={t("account.shared.password")}
|
||||
helpText={actionData?.fieldErrors?.password ?? ""}
|
||||
error={Boolean(actionData?.fieldErrors?.password)}
|
||||
type="password"
|
||||
>
|
||||
<TextInput.Input
|
||||
name="password"
|
||||
type="password"
|
||||
required
|
||||
autoComplete="new-password"
|
||||
autoFocus
|
||||
placeholder={t("account.register.passwordChoosePlaceholder")}
|
||||
disabled={isSubmitting}
|
||||
data-ui-id="ui.auth.verify.password"
|
||||
/>
|
||||
</TextInput>
|
||||
|
||||
<Button type="submit" className="h-9 w-full flex-none" loading={isSubmitting} disabled={isSubmitting} data-ui-id="ui.auth.verify.submit">
|
||||
{t("account.verify.setupWorkspace")}
|
||||
</Button>
|
||||
|
||||
{actionData?.error && navigation.state === "idle" ? (
|
||||
<p className="text-center text-body-small-regular-0 font-body-small-regular-0 text-text-feedback-negative" role="alert">
|
||||
{actionData.error}
|
||||
</p>
|
||||
) : null}
|
||||
</Form>
|
||||
</AuthShell>
|
||||
);
|
||||
}
|
||||
|
||||
// Ungueltiger / bereits eingeloester Link.
|
||||
return (
|
||||
<AuthShell title={t("account.verify.title")} subtitle={t("account.verify.invalidLink")} cardSize="medium" cardClassName="max-w-[448px]" logoIconOnly={false} dataUiId="ui.auth.verify.invalid">
|
||||
<div className="flex w-full items-center justify-center gap-1" data-ui-id="ui.auth.verify.toLogin">
|
||||
<Link to="/login" className="no-underline">
|
||||
<LinkButton size="small" icon={<FeatherArrowLeft />}>
|
||||
{t("account.verify.toLogin")}
|
||||
</LinkButton>
|
||||
</Link>
|
||||
</div>
|
||||
</AuthShell>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user