Files
SweetHome/app/error.js
Claw AI c14c28141f
All checks were successful
Build frontend / build (push) Successful in 40s
Add loading.js and error.js for all routes, secure admin page with 404
- Added loading.js (dark/light variants) for all 14 routes
- Added error.js (dark/light variants) for all 14 routes
- Added global not-found.js and loading.js at root
- Admin page shows 404 illustration for non-admin users instead of redirecting
2026-03-28 16:12:21 +00:00

40 lines
1.5 KiB
JavaScript

'use client';
import { motion } from 'framer-motion';
import { AlertTriangle, RefreshCw, Home } from 'lucide-react';
import Link from 'next/link';
export default function GlobalError({ error, reset }) {
return (
<div className="min-h-screen bg-gray-50 flex items-center justify-center p-4">
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
className="text-center max-w-md"
>
<div className="w-24 h-24 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-6">
<AlertTriangle className="w-12 h-12 text-red-500" />
</div>
<h2 className="text-2xl font-bold text-gray-900 mb-2">حدث خطأ غير متوقع</h2>
<p className="text-gray-500 mb-8">نعتذر عن هذا الإزعاج، يرجى المحاولة مرة أخرى</p>
<div className="flex gap-3 justify-center">
<button
onClick={reset}
className="flex items-center gap-2 bg-amber-500 text-white px-6 py-3 rounded-xl font-medium hover:bg-amber-600 transition-colors"
>
<RefreshCw className="w-5 h-5" />
إعادة المحاولة
</button>
<Link
href="/"
className="flex items-center gap-2 bg-gray-200 text-gray-700 px-6 py-3 rounded-xl font-medium hover:bg-gray-300 transition-colors"
>
<Home className="w-5 h-5" />
الرئيسية
</Link>
</div>
</motion.div>
</div>
);
}