mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
A render failure on `/c/<token>` previously fell through to the full-app error screen, which carries app chrome the public share view never wants. Add a route-scoped, chrome-free error boundary that shows a localised, stack-free message and a single retry. Add the matching copy across all six locales.
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
"use client";
|
|
|
|
/**
|
|
* Error boundary for the public clinician share route (`/c/<token>`).
|
|
*
|
|
* The share view carries no app chrome and no session, so a render failure must
|
|
* not fall through to the full-app error screen. This renders a clean, locale-
|
|
* aware, stack-free message and offers a single retry. No record data, no
|
|
* digest, no stack — a probe learns nothing from a failed render.
|
|
*/
|
|
import { useTranslations } from "@/lib/i18n/context";
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
export default function ClinicianShareError({
|
|
reset,
|
|
}: {
|
|
error: Error & { digest?: string };
|
|
reset: () => void;
|
|
}) {
|
|
const { t } = useTranslations();
|
|
|
|
return (
|
|
<main className="mx-auto flex min-h-screen max-w-md flex-col justify-center px-4">
|
|
<div className="border-border bg-card space-y-4 rounded-lg border p-6 text-center">
|
|
<h1 className="text-lg font-semibold">
|
|
{t("clinicianView.loadError.title")}
|
|
</h1>
|
|
<p className="text-muted-foreground text-sm">
|
|
{t("clinicianView.loadError.description")}
|
|
</p>
|
|
<Button
|
|
onClick={() => reset()}
|
|
className="min-h-11 w-full sm:min-h-9"
|
|
variant="outline"
|
|
>
|
|
{t("clinicianView.loadError.retry")}
|
|
</Button>
|
|
</div>
|
|
</main>
|
|
);
|
|
}
|