diff options
| author | 2026-01-29 10:15:55 +0800 | |
|---|---|---|
| committer | 2026-01-29 10:15:55 +0800 | |
| commit | c309904c5ab5394938e92bb139fc0c40d87de055 (patch) | |
| tree | e13349d0cf894979e6eaab0c47d7f05baec2c295 /packages/docs/app | |
| parent | a87268d575ec98d6986d6bc80bc8c41cf27e11c0 (diff) | |
| download | DropOut-c309904c5ab5394938e92bb139fc0c40d87de055.tar.gz DropOut-c309904c5ab5394938e92bb139fc0c40d87de055.zip | |
feat(docs): enhance error boundary UI and add 404 page
Diffstat (limited to 'packages/docs/app')
| -rw-r--r-- | packages/docs/app/root.tsx | 27 | ||||
| -rw-r--r-- | packages/docs/app/routes.ts | 1 | ||||
| -rw-r--r-- | packages/docs/app/routes/not-found.tsx | 7 |
3 files changed, 29 insertions, 6 deletions
diff --git a/packages/docs/app/root.tsx b/packages/docs/app/root.tsx index 08b8aa8..a6c807e 100644 --- a/packages/docs/app/root.tsx +++ b/packages/docs/app/root.tsx @@ -1,5 +1,6 @@ import { isRouteErrorResponse, + Link, Links, Meta, Outlet, @@ -60,13 +61,27 @@ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) { } return ( - <main className="pt-16 p-4 w-full max-w-[1400px] mx-auto"> - <h1>{message}</h1> - <p>{details}</p> + <main className="flex-1 flex flex-col items-center p-4 mt-40 text-center"> + <h1 className="text-9xl font-black mb-4 bg-gradient-to-r from-blue-600 to-cyan-500 bg-clip-text text-transparent opacity-50"> + {message} + </h1> + <p className="text-2xl font-semibold mb-2">{details}</p> + <p className="text-fd-muted-foreground mb-8 max-w-md"> + Sorry, we couldn't find the page you're looking for. It might have been moved or deleted. + </p> + <Link + to="/" + className="bg-blue-600 hover:bg-blue-700 text-white font-bold rounded-full px-8 py-3 shadow-lg shadow-blue-500/30 transition-all hover:scale-105 active:scale-95" + > + Return Home / 返回首页 + </Link> {stack && ( - <pre className="w-full p-4 overflow-x-auto"> - <code>{stack}</code> - </pre> + <div className="mt-12 w-full max-w-2xl text-left"> + <p className="text-xs font-mono text-fd-muted-foreground mb-2 uppercase tracking-widest">Error Stack</p> + <pre className="p-4 overflow-x-auto text-sm bg-fd-muted rounded-xl border border-fd-border font-mono whitespace-pre-wrap break-all shadow-inner"> + <code>{stack}</code> + </pre> + </div> )} </main> ); diff --git a/packages/docs/app/routes.ts b/packages/docs/app/routes.ts index 677030a..9acc429 100644 --- a/packages/docs/app/routes.ts +++ b/packages/docs/app/routes.ts @@ -5,4 +5,5 @@ export default [ route('docs', 'routes/docs.tsx'), route('docs/*', 'docs/page.tsx'), route('api/search', 'docs/search.ts'), + route('*', 'routes/not-found.tsx'), ] satisfies RouteConfig; diff --git a/packages/docs/app/routes/not-found.tsx b/packages/docs/app/routes/not-found.tsx new file mode 100644 index 0000000..1d9e041 --- /dev/null +++ b/packages/docs/app/routes/not-found.tsx @@ -0,0 +1,7 @@ +export function loader() { + throw new Response('Not Found', { status: 404 }); +} + +export default function NotFound() { + return null; +} |