feat(web): 前端共享基础(focusRing/proseBody/text-2xs + useBodyScrollLock + Toast撤销 + error/not-found/loading路由边界)

This commit is contained in:
Yaojia Wang
2026-06-30 08:35:52 +02:00
parent 69f3c2a29b
commit a22a16c9c4
9 changed files with 245 additions and 23 deletions

37
apps/web/app/error.tsx Normal file
View File

@@ -0,0 +1,37 @@
"use client";
import Link from "next/link";
import { TriangleAlert } from "lucide-react";
import { EmptyState } from "@/components/ui/EmptyState";
import { Button } from "@/components/ui/Button";
import { buttonClass } from "@/lib/ui/variants";
interface ErrorBoundaryProps {
error: Error & { digest?: string };
reset: () => void;
}
export default function Error({ reset }: ErrorBoundaryProps) {
return (
<main className="flex min-h-screen items-center justify-center bg-bg px-6 py-16">
<div className="w-full max-w-md">
<EmptyState
icon={TriangleAlert}
title="出错了"
description="刚才的操作没能完成。可以重试,或先回到作品库。"
action={
<div className="flex items-center justify-center gap-2">
<Button variant="primary" onClick={reset}>
</Button>
<Link href="/" className={buttonClass({ variant: "secondary" })}>
</Link>
</div>
}
/>
</div>
</main>
);
}