Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -0,0 +1,53 @@
import { vi, describe, it, expect } from "vitest";
import "@testing-library/jest-dom";
import { render } from "@testing-library/react";
import { BrowserRouter as Router } from "react-router";
import { CreateWorkspacePage, type CreateWorkspacePageProps } from "./CreateWorkspacePage";
vi.mock("react-i18next", () => ({
useTranslation: () => ({ t: (str: string) => str, i18n: { language: "de" } }),
}));
function baseProps(overrides: Partial<CreateWorkspacePageProps> = {}): CreateWorkspacePageProps {
return {
csrf: "csrf-token",
error: undefined,
backHref: "/select-tenant",
...overrides,
};
}
describe("CreateWorkspacePage (interim-UI)", () => {
it("renders the create surface + form/name/submit/back markers and the csrf field", () => {
const { container } = render(
<Router>
<CreateWorkspacePage {...baseProps()} />
</Router>,
);
expect(container.querySelector('[data-ui-id="ui.account.create.page"]')).toBeInTheDocument();
expect(container.querySelector('[data-ui-id="ui.account.create.form"]')).toBeInTheDocument();
expect(container.querySelector('[data-ui-id="ui.account.create.name"]')).toBeInTheDocument();
expect(container.querySelector('[data-ui-id="ui.account.create.submit"]')).toBeInTheDocument();
expect(container.querySelector('[data-ui-id="ui.account.create.back"]')).toBeInTheDocument();
expect(container.querySelector('input[type="hidden"][name="csrf"][value="csrf-token"]')).toBeInTheDocument();
});
it("renders the error alert with its marker when an error is passed", () => {
const { container } = render(
<Router>
<CreateWorkspacePage {...baseProps({ error: "Something went wrong" })} />
</Router>,
);
expect(container.querySelector('[data-ui-id="ui.account.create.error"]')).toBeInTheDocument();
});
it("omits the error alert when there is no error", () => {
const { container } = render(
<Router>
<CreateWorkspacePage {...baseProps()} />
</Router>,
);
expect(container.querySelector('[data-ui-id="ui.account.create.error"]')).not.toBeInTheDocument();
});
});
@@ -0,0 +1,58 @@
// R-P2a Interim-UI (AD-28) — Create-workspace ("ohne Tenant") preview screen composed from ~/ui.
// Presentational: the form posts to the /new-account route action (server-driven tenant create);
// the route injects the csrf token, the idle-gated error message and the back target. No
// useLoaderData / server imports here. Final Subframe optics land as a tracked design-nachzug
// once David's D-P2 delta ships.
import { useTranslation } from "react-i18next";
import { FeatherArrowLeft } from "@subframe/core";
import { AuthShell } from "~/components/auth/AuthShell";
import { Alert } from "~/ui/components/Alert";
import { Button } from "~/ui/components/Button";
import { LinkButton } from "~/ui/components/LinkButton";
import { TextInput } from "~/ui/components/TextInput";
export type CreateWorkspacePageProps = {
/** CSRF token for the server-driven create action. */
csrf: string;
/** Error message from the last failed submit (route passes it only while idle). */
error?: string;
/** Back target: the tenant picker when the user already has workspaces, else login. */
backHref: string;
};
export function CreateWorkspacePage({ csrf, error, backHref }: CreateWorkspacePageProps) {
const { t } = useTranslation();
return (
<AuthShell
title={t("app.tenants.create.title")}
subtitle={t("app.tenants.create.headline")}
titleAlign="start"
dataUiId="ui.account.create.page"
footer={
<a href={backHref} className="no-underline" data-ui-id="ui.account.create.back">
<LinkButton size="small" icon={<FeatherArrowLeft />}>
{t("shared.goBack")}
</LinkButton>
</a>
}
>
<form method="post" className="flex w-full flex-col gap-4" data-ui-id="ui.account.create.form">
{/* The action intent is vestigial (the /new-account action reads only name+csrf) but stays
in the wire payload as a stable contract other consumers/tests assert. */}
<input type="hidden" name="action" value="create" readOnly />
<input type="hidden" name="csrf" value={csrf} readOnly />
<TextInput className="h-auto w-full flex-none" fillContainer showLabel label={t("shared.name")}>
<TextInput.Input name="name" required placeholder={t("shared.name")} data-ui-id="ui.account.create.name" />
</TextInput>
{error ? <Alert variant="error" notDismissible title={error} data-ui-id="ui.account.create.error" /> : null}
<Button type="submit" className="h-9 w-full flex-none" data-ui-id="ui.account.create.submit">
{t("shared.create")}
</Button>
</form>
</AuthShell>
);
}