76349f0dcf
图片资源接入: - OG/Twitter 社交分享元数据 (og-image.png) - 错误页插画替换图标 (error-robot.png) - EmptyState 组件支持 image prop,空状态页面接入插画 - 餐厅图片 fallback 改用 restaurant-fallback.png - 极速救场/周末契约页面添加 hero 装饰图 - 分享卡片添加背景图层 (share-bg-*.png),通过 base64 预加载 - 更新 App 图标 (apple-touch-icon, icon-192/512) Bug 修复: - SwipeDeck: swipe action 从 "nope" 改为 "pass",匹配 API 预期 - SwipeDeck: 用 ref 读取 currentIndex 避免竞态重置(本地滑动后 被服务端旧 swipeCounts 立即清零) - SwipeDeck: 卡片 key 加入 isTop 标识,强制 remount 解决 framer-motion drag 手势在 isTop 切换时不重新初始化的问题 - SwipeableCard: initial 统一为背景位置,确保晋升为顶部卡片时 有一致的放大动画 - useRoomPolling: roomId 为空时跳过 SWR 和 EventSource - room page: joinRoom 前 guard roomId,消除退房时 404 - layout: 添加 metadataBase 消除 Next.js OG 图片警告
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
"use client";
|
||
|
||
import { useEffect } from "react";
|
||
import { motion } from "framer-motion";
|
||
import { RotateCcw, Home } from "lucide-react";
|
||
import Button from "@/components/Button";
|
||
|
||
export default function Error({
|
||
error,
|
||
reset,
|
||
}: {
|
||
error: Error & { digest?: string };
|
||
reset: () => void;
|
||
}) {
|
||
useEffect(() => {
|
||
console.error("[ErrorBoundary]", error);
|
||
}, [error]);
|
||
|
||
return (
|
||
<div className="flex min-h-dvh flex-col items-center justify-center bg-background px-6">
|
||
<motion.div
|
||
className="flex flex-col items-center text-center"
|
||
initial={{ opacity: 0, y: 20 }}
|
||
animate={{ opacity: 1, y: 0 }}
|
||
>
|
||
<motion.img
|
||
src="/error-robot.png"
|
||
alt="错误"
|
||
className="h-28 w-28"
|
||
animate={{ y: [0, -4, 0] }}
|
||
transition={{ duration: 2.5, repeat: Infinity, ease: "easeInOut" }}
|
||
/>
|
||
|
||
<h1 className="mt-6 text-xl font-bold text-heading">出了点问题</h1>
|
||
<p className="mt-2 max-w-xs text-sm text-muted">
|
||
页面遇到了意外错误,请重试或返回首页
|
||
</p>
|
||
|
||
<div className="mt-8 flex gap-3">
|
||
<Button onClick={reset} variant="danger" icon={<RotateCcw size={15} />}>
|
||
重试
|
||
</Button>
|
||
<Button onClick={() => window.location.href = "/"} variant="secondary" icon={<Home size={15} />}>
|
||
首页
|
||
</Button>
|
||
</div>
|
||
</motion.div>
|
||
</div>
|
||
);
|
||
}
|