refactor(presentation): route status screens share one surface family (Q-6.8-10)
Route-level loading (Suspense fallback, context gateway, chunk check) now renders LoadingSurface, which gains optional visible copy; route-level auth-required, integration-required, invalid-address, disabled-feature, failure and 404 screens render StatusPage, which gains an optional `surface` marker and children slot. Visible copy, h1 headings, data-surface markers and alerts are unchanged; the 404 home link is a router link. The unlabelled context gateway loading now has an accessible name. Session buttons in the shell, the auth-required screen and the auth example share useSessionAction: one pending/failed state and sign-in returns to the current URL including its hash (the auth example dropped the hash). PageActionBar keys actions by position so a pending label does not remount the pressed button. The home and platform overview release loaders now handle a rejected summary instead of showing "checking" forever. Pinned first with tests/component/route-status-surfaces.test.tsx (RED: auth example hash and both loaders; loading, auth-required, shell session and 404 link characterized before the change), plus the lane gates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a535db6ea1
commit
38db97a564
@@ -6,9 +6,13 @@ import { useLocale } from "../i18n/index.ts";
|
||||
import { errorMessage } from "./error-copy.ts";
|
||||
import { Button } from "./ui/button.ts";
|
||||
|
||||
export function LoadingSurface({ label }: Readonly<{ label?: string }>) {
|
||||
export function LoadingSurface({
|
||||
label,
|
||||
description,
|
||||
}: Readonly<{ label?: string; description?: string }>) {
|
||||
const { message } = useLocale();
|
||||
const accessibleLabel = label ?? message("async.loading");
|
||||
// Visible copy doubles as the name unless a separate label is given.
|
||||
const accessibleLabel = label ?? description ?? message("async.loading");
|
||||
return (
|
||||
<section
|
||||
className="state-surface state-surface--loading"
|
||||
@@ -18,7 +22,10 @@ export function LoadingSurface({ label }: Readonly<{ label?: string }>) {
|
||||
aria-atomic="true"
|
||||
>
|
||||
<div className="ui-skeleton" aria-hidden="true" />
|
||||
<span className="visually-hidden">{accessibleLabel}</span>
|
||||
{description ? <p>{description}</p> : null}
|
||||
{accessibleLabel === description ? null : (
|
||||
<span className="visually-hidden">{accessibleLabel}</span>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user