mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-19 08:12:52 +00:00
The strip is new this release and had not been checked against the design standards. It carried the shape §11 names as the anti-pattern: a centred flex-wrap row whose gap-y drops the action onto its own line once the name is long enough. The maintainership strip is the sibling that already had an action and already had the right shape, so the two now read the same — sentence on min-w-0 flex-1, way out on shrink-0, beside it rather than under it. The exit control was a 32px tap target. Leaving somebody else's record on a phone is the one interaction in the whole banner stack, and it now carries the standard's floor (min-h-11 sm:min-h-9). The three strips also spell their icon size three ways for identical CSS; they all use size-3.5 now. Text tiers are unchanged and were already right: the person's name is foreground because it is content, the read-only qualifier is muted because it is meta.
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
"use client";
|
|
|
|
import { FlaskConical } from "lucide-react";
|
|
|
|
import { useTranslations } from "@/lib/i18n/context";
|
|
|
|
/**
|
|
* Slim persistent banner shown while the instance runs with
|
|
* `DEMO_MODE=true`. The proxy already blocks every mutation outside a
|
|
* small allowlist (`src/proxy.ts`), but pre-banner the only feedback a
|
|
* demo visitor got was an English API error after submitting a form.
|
|
* This strip tells the visitor up front that nothing they change will
|
|
* persist.
|
|
*
|
|
* Mount strategy mirrors `<OfflineBanner>`: rendered once inside
|
|
* `<AuthShell>` so every routed page inherits it. The flag itself is a
|
|
* server-only env var, so the root layout (a server component) reads
|
|
* `process.env.DEMO_MODE` and threads the boolean through the
|
|
* `demoMode` prop on `<AuthShell>` — no client-side detection, no
|
|
* extra request.
|
|
*
|
|
* Copy lives in `messages/*.json` under `demoBanner.message`; all six
|
|
* locales ship together.
|
|
*/
|
|
export function DemoBanner() {
|
|
const { t } = useTranslations();
|
|
|
|
return (
|
|
<div
|
|
role="status"
|
|
data-slot="demo-banner"
|
|
className="bg-primary/10 border-primary/30 text-foreground flex items-center justify-center gap-2 border-b px-3 py-2 text-xs"
|
|
>
|
|
<FlaskConical className="size-3.5 shrink-0" aria-hidden="true" />
|
|
<span className="text-center">{t("demoBanner.message")}</span>
|
|
</div>
|
|
);
|
|
}
|