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,21 +1,18 @@
|
||||
import { useActionData, useLoaderData, useNavigate, useNavigation } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useActionData, useLoaderData, useNavigation } from "react-router";
|
||||
import { ActionFunction, LoaderFunctionArgs, redirect } from "react-router";
|
||||
import { TenantUserType } from "~/application/enums/tenants/TenantUserType";
|
||||
import TenantNew from "~/components/core/settings/tenant/TenantNew";
|
||||
import { CreateWorkspacePage } from "~/components/screens/auth/CreateWorkspacePage";
|
||||
import { getAllRoles } from "~/utils/db/permissions/roles.db.server";
|
||||
import { createTenantUser, getMyTenants, TenantSimple } from "~/utils/db/tenants.db.server";
|
||||
import { getUser } from "~/utils/db/users.db.server";
|
||||
import { getUserInfo, validateCSRFToken } from "~/utils/session.server";
|
||||
import { EntityWithDetails, findEntityByName } from "~/utils/db/entities/entities.db.server";
|
||||
import { TenantsApi } from "~/utils/api/.server/TenantsApi";
|
||||
import Logo from "~/components/brand/Logo";
|
||||
import { useRootData } from "~/utils/data/useRootData";
|
||||
import { withMetrics } from "~/lib/metrics/ssr";
|
||||
import { appPath } from "~/utils/app/CanonicalUrlUtils";
|
||||
|
||||
type LoaderData = {
|
||||
myTenants: TenantSimple[];
|
||||
tenantSettingsEntity: EntityWithDetails | null;
|
||||
};
|
||||
|
||||
export const loader = withMetrics("new-account", async ({ request }: LoaderFunctionArgs) => {
|
||||
@@ -25,10 +22,8 @@ export const loader = withMetrics("new-account", async ({ request }: LoaderFunct
|
||||
throw redirect(`/login`);
|
||||
}
|
||||
const myTenants = await getMyTenants(userInfo.userId);
|
||||
const tenantSettingsEntity = await findEntityByName({ tenantId: null, name: "tenantSettings" });
|
||||
const data: LoaderData = {
|
||||
myTenants,
|
||||
tenantSettingsEntity,
|
||||
};
|
||||
return data;
|
||||
});
|
||||
@@ -46,7 +41,7 @@ export const action: ActionFunction = async ({ request }) => {
|
||||
const form = await request.formData();
|
||||
const name = form.get("name")?.toString() ?? "";
|
||||
const slug = form.get("slug")?.toString();
|
||||
const { tenant, user } = await TenantsApi.create({ request, form, name, slug });
|
||||
const { tenant, user } = await TenantsApi.create({ request, name, slug });
|
||||
const roles = await getAllRoles("app");
|
||||
await createTenantUser(
|
||||
{
|
||||
@@ -62,43 +57,16 @@ export const action: ActionFunction = async ({ request }) => {
|
||||
}
|
||||
};
|
||||
|
||||
// Interim-UI (AD-28): renders the ~/ui preview screen behind the stable loader/action boundary;
|
||||
// final Subframe optics land as a tracked design-nachzug once David's D-P2 delta ships.
|
||||
export default function AppNewAccountRoute() {
|
||||
const { t } = useTranslation();
|
||||
const data = useLoaderData<LoaderData>();
|
||||
const navigate = useNavigate();
|
||||
const { myTenants } = useLoaderData<LoaderData>();
|
||||
const actionData = useActionData<ActionData>();
|
||||
const navigation = useNavigation();
|
||||
const { csrf } = useRootData();
|
||||
// Back target: return to the tenant picker when the user already has workspaces, else login.
|
||||
const backHref = myTenants.length > 0 ? "/select-tenant" : "/login";
|
||||
return (
|
||||
<div className="h-screen overflow-auto py-20" data-ui-id="ui.account.create.page">
|
||||
<div className="mx-auto max-w-7xl px-4 pt-2 sm:px-6 lg:px-8">
|
||||
<div className="flex shrink-0 justify-center">
|
||||
<Logo className="inline-flex" />
|
||||
</div>
|
||||
<div className="sm:align-center sm:flex sm:flex-col">
|
||||
<div className="relative mx-auto w-full max-w-xl overflow-hidden px-2 py-12 sm:py-6">
|
||||
<div className="text-center">
|
||||
<h1 className="text-3xl font-extrabold tracking-tight sm:text-4xl">{t("app.tenants.create.title")}</h1>
|
||||
<p className="text-muted-foreground mt-4 text-lg leading-6">{t("app.tenants.create.headline")}</p>
|
||||
</div>
|
||||
<div className="mt-12">
|
||||
<TenantNew tenantSettingsEntity={data.tenantSettingsEntity} />
|
||||
<div id="form-error-message">
|
||||
{actionData?.error && navigation.state === "idle" ? (
|
||||
<p className="py-2 text-xs text-rose-600" role="alert" data-ui-id="ui.account.create.error">
|
||||
{actionData.error}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<div className="mt-4 flex">
|
||||
<button type="button" onClick={() => navigate(-1)} className="text-primary hover:text-primary/90 w-full text-center text-sm font-medium">
|
||||
<span aria-hidden="true"> ←</span> {t("shared.goBack")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<CreateWorkspacePage csrf={csrf ?? ""} error={navigation.state === "idle" ? actionData?.error : undefined} backHref={backHref} />
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user