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
@@ -1,26 +1,12 @@
|
||||
import { useState } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
|
||||
import { PageHeader } from "../design-system/index.ts";
|
||||
import { useSession } from "../providers/session-provider.tsx";
|
||||
import {
|
||||
useSession,
|
||||
useSessionAction,
|
||||
} from "../providers/session-provider.tsx";
|
||||
|
||||
export default function AuthExamplePage() {
|
||||
const location = useLocation();
|
||||
const { sessionState, beginSignIn, signOut, recover } = useSession();
|
||||
const [pending, setPending] = useState(false);
|
||||
const [failed, setFailed] = useState(false);
|
||||
|
||||
async function execute(action: () => Promise<unknown>): Promise<void> {
|
||||
setPending(true);
|
||||
setFailed(false);
|
||||
try {
|
||||
await action();
|
||||
} catch {
|
||||
setFailed(true);
|
||||
} finally {
|
||||
setPending(false);
|
||||
}
|
||||
}
|
||||
const { sessionState } = useSession();
|
||||
const { pending, failed, run } = useSessionAction();
|
||||
|
||||
return (
|
||||
<section className="ui-page">
|
||||
@@ -41,11 +27,7 @@ export default function AuthExamplePage() {
|
||||
className="ui-button"
|
||||
type="button"
|
||||
disabled={pending || sessionState === "integration-failed"}
|
||||
onClick={() =>
|
||||
void execute(() =>
|
||||
beginSignIn(`${location.pathname}${location.search}`),
|
||||
)
|
||||
}
|
||||
onClick={() => run("sign-in")}
|
||||
>
|
||||
로그인 시작
|
||||
</button>
|
||||
@@ -53,7 +35,7 @@ export default function AuthExamplePage() {
|
||||
className="ui-button ui-button--secondary"
|
||||
type="button"
|
||||
disabled={pending || sessionState !== "authenticated"}
|
||||
onClick={() => void execute(signOut)}
|
||||
onClick={() => run("sign-out")}
|
||||
>
|
||||
로그아웃
|
||||
</button>
|
||||
@@ -61,7 +43,7 @@ export default function AuthExamplePage() {
|
||||
className="ui-button ui-button--secondary"
|
||||
type="button"
|
||||
disabled={pending || sessionState !== "recovery-pending"}
|
||||
onClick={() => void execute(recover)}
|
||||
onClick={() => run("recover")}
|
||||
>
|
||||
세션 복구
|
||||
</button>
|
||||
|
||||
@@ -281,14 +281,19 @@ function buildOperationRows(): readonly OperationRow[] {
|
||||
export default function PlatformOverviewPage() {
|
||||
const runtime = useApplicationRuntime();
|
||||
const [release, setRelease] = useState<
|
||||
Awaited<ReturnType<typeof runtime.getReleaseSummary>> | null
|
||||
Awaited<ReturnType<typeof runtime.getReleaseSummary>> | "failed" | null
|
||||
>(null);
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
void runtime.getReleaseSummary().then((summary) => {
|
||||
if (active) setRelease(summary);
|
||||
});
|
||||
runtime.getReleaseSummary().then(
|
||||
(summary) => {
|
||||
if (active) setRelease(summary);
|
||||
},
|
||||
() => {
|
||||
if (active) setRelease("failed");
|
||||
},
|
||||
);
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
@@ -325,7 +330,9 @@ export default function PlatformOverviewPage() {
|
||||
</p>
|
||||
</header>
|
||||
<dl className="platform-metric-grid" aria-live="polite">
|
||||
{release ? (
|
||||
{release === "failed" ? (
|
||||
<Metric label="상태" value="런타임 정보를 확인하지 못했습니다." />
|
||||
) : release ? (
|
||||
<>
|
||||
<Metric label="빌드" value={release.buildId} />
|
||||
<Metric label="릴리스" value={release.releaseId} />
|
||||
|
||||
Reference in New Issue
Block a user