Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+1
-1
@@ -38,7 +38,7 @@ vi.mock("react-i18next", () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("~/components/brand/Logo", () => ({ default: () => <div data-testid="logo">Logo</div> }));
|
||||
vi.mock("~/ui/components/Logo", () => ({ Logo: () => <div data-testid="logo">Logo</div> }));
|
||||
vi.mock("~/components/public/PublicFooter", () => ({ default: () => <footer data-testid="public-footer">Footer</footer> }));
|
||||
|
||||
describe("ErrorPage a11y", () => {
|
||||
|
||||
+9
-1
@@ -50,7 +50,7 @@ vi.mock("react-i18next", () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("~/components/brand/Logo", () => ({ default: () => <div data-testid="logo">Logo</div> }));
|
||||
vi.mock("~/ui/components/Logo", () => ({ Logo: () => <div data-testid="logo">Logo</div> }));
|
||||
vi.mock("~/components/public/PublicFooter", () => ({ default: () => <footer data-testid="public-footer">Footer</footer> }));
|
||||
|
||||
function renderErrorPage(status: ErrorStatus, props: Partial<React.ComponentProps<typeof ErrorPage>> = {}) {
|
||||
@@ -74,9 +74,17 @@ describe("ErrorPage", () => {
|
||||
expect(screen.getByRole("heading", { name: copy.title })).toBeInTheDocument();
|
||||
expect(screen.getByText(copy.description)).toBeInTheDocument();
|
||||
expect(screen.getByTestId("logo")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("error-page-logo")).toHaveAttribute("href", "/");
|
||||
expect(screen.getByTestId("public-footer")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("keeps long error copy inside a constrained content column", () => {
|
||||
renderErrorPage(500);
|
||||
|
||||
expect(screen.getByRole("heading", { name: expectedErrorCopy[500].title }).parentElement).toHaveClass("max-w-2xl");
|
||||
expect(screen.getByText(expectedErrorCopy[500].description)).toHaveClass("max-w-xl");
|
||||
});
|
||||
|
||||
it("omits footer and back controls when disabled", () => {
|
||||
renderErrorPage(404, { withFooter: false, withGoBack: false });
|
||||
|
||||
|
||||
+28
-31
@@ -1,7 +1,7 @@
|
||||
import { useNavigate } from "react-router";
|
||||
import { Link, useNavigate } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import Logo from "~/components/brand/Logo";
|
||||
import PublicFooter from "~/components/public/PublicFooter";
|
||||
import { Logo } from "~/ui/components/Logo";
|
||||
|
||||
export type ErrorStatus = 401 | 403 | 404 | 500 | 503;
|
||||
|
||||
@@ -72,40 +72,37 @@ export function ErrorPage({
|
||||
const resolvedEyebrow = eyebrow ?? t(preset.eyebrowKey);
|
||||
const resolvedTitle = title ?? t(preset.titleKey);
|
||||
const resolvedDescription = description ?? t(preset.descriptionKey);
|
||||
const logoLabel = t("shared.logo", { ns: "translations" });
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="" data-error-status={status} data-testid="error-page">
|
||||
<div className="flex min-h-full flex-col pt-16 pb-12">
|
||||
<main className="mx-auto flex w-full max-w-7xl min-w-0 grow flex-col justify-center px-4 sm:px-6 lg:px-8">
|
||||
{withLogo && (
|
||||
<div className="flex shrink-0 justify-center">
|
||||
{logo ? <img className="h-9 w-auto" src={logo} alt={t("shared.logo", { ns: "translations" })} /> : <Logo />}
|
||||
<div className="flex min-h-screen flex-col" data-error-status={status} data-testid="error-page">
|
||||
<main className="mx-auto flex w-full max-w-3xl min-w-0 grow flex-col items-center justify-center px-4 py-16 sm:px-6 lg:px-8">
|
||||
{withLogo && (
|
||||
<Link to="/" aria-label={logoLabel} className="flex shrink-0 justify-center" data-testid="error-page-logo">
|
||||
{logo ? <img className="h-8 max-w-[min(16rem,80vw)] w-auto object-contain" src={logo} alt={logoLabel} /> : <Logo size="32" />}
|
||||
</Link>
|
||||
)}
|
||||
<div className="w-full py-12 sm:py-16">
|
||||
<div className="mx-auto min-w-0 max-w-2xl text-center [overflow-wrap:anywhere]">
|
||||
<p className="text-brand-brand-surface-solid-default text-sm font-semibold tracking-wide uppercase">{resolvedEyebrow}</p>
|
||||
<h1 className="mt-2 text-3xl font-extrabold tracking-tight sm:text-5xl">{resolvedTitle}</h1>
|
||||
<p className="text-text-neutral-tertiary mx-auto mt-3 max-w-xl text-base leading-6">{resolvedDescription}</p>
|
||||
{(withGoBack || customBackButton || actionSlot) && (
|
||||
<div className="mt-6 min-w-0">
|
||||
{customBackButton}
|
||||
{!customBackButton && withGoBack && (
|
||||
<button type="button" onClick={() => navigate(-1)} className="text-brand-brand-surface-solid-default hover:text-brand-brand-surface-solid-hover w-full text-center text-sm font-medium">
|
||||
<span aria-hidden="true"> ←</span> {t("goBack")}
|
||||
</button>
|
||||
)}
|
||||
{actionSlot}
|
||||
</div>
|
||||
)}
|
||||
<div className="py-16">
|
||||
<div className="min-w-0 text-center [overflow-wrap:anywhere]">
|
||||
<p className="text-brand-brand-surface-solid-default text-sm font-semibold tracking-wide uppercase">{resolvedEyebrow}</p>
|
||||
<h1 className="mt-2 text-4xl font-extrabold tracking-tight sm:text-5xl">{resolvedTitle}</h1>
|
||||
<p className="text-text-neutral-tertiary mt-2 text-base">{resolvedDescription}</p>
|
||||
{(withGoBack || customBackButton || actionSlot) && (
|
||||
<div className="mt-4 min-w-0">
|
||||
{customBackButton}
|
||||
{!customBackButton && withGoBack && (
|
||||
<button type="button" onClick={() => navigate(-1)} className="text-brand-brand-surface-solid-default hover:text-brand-brand-surface-solid-hover w-full text-center text-sm font-medium">
|
||||
<span aria-hidden="true"> ←</span> {t("goBack")}
|
||||
</button>
|
||||
)}
|
||||
{actionSlot}
|
||||
</div>
|
||||
)}
|
||||
{diagnosticChildren && <div className="mt-6 text-left">{diagnosticChildren}</div>}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
{diagnosticChildren && <div className="mt-6 text-left">{diagnosticChildren}</div>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
{withFooter && <PublicFooter />}
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+1
-1
@@ -55,7 +55,7 @@ vi.mock("i18next", () => ({
|
||||
t: (key: string) => errorMessages[key] ?? key,
|
||||
}));
|
||||
|
||||
vi.mock("~/components/brand/Logo", () => ({ default: () => <div data-testid="logo">Logo</div> }));
|
||||
vi.mock("~/ui/components/Logo", () => ({ Logo: () => <div data-testid="logo">Logo</div> }));
|
||||
vi.mock("~/components/public/PublicFooter", () => ({ default: () => <footer data-testid="public-footer">Footer</footer> }));
|
||||
|
||||
function renderServerError(error: unknown) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { isRouteErrorResponse, useRouteError } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { ErrorPage, type ErrorStatus } from "~/components/ui/errors/ErrorPage";
|
||||
|
||||
type KnownErrorCopy = { title: string; description?: string };
|
||||
|
||||
Reference in new issue
Block a user