120 lines
4.1 KiB
TypeScript
120 lines
4.1 KiB
TypeScript
'use client';
|
|
|
|
import React, { useEffect } from 'react';
|
|
import Link from 'next/link';
|
|
import { Button } from '@/components/ui/Button';
|
|
|
|
export default function Error({
|
|
error,
|
|
reset,
|
|
}: {
|
|
error: Error & { digest?: string };
|
|
reset: () => void;
|
|
}) {
|
|
useEffect(() => {
|
|
// Log the error to an error reporting service
|
|
console.error('Error:', error);
|
|
}, [error]);
|
|
|
|
return (
|
|
<div className="min-h-screen bg-white flex items-center justify-center px-4">
|
|
<div className="max-w-2xl w-full text-center">
|
|
{/* Error Icon */}
|
|
<div className="mb-8">
|
|
<div className="inline-flex items-center justify-center w-24 h-24 bg-red-100 rounded-full mb-6">
|
|
<svg
|
|
className="w-12 h-12 text-red-600"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
viewBox="0 0 24 24"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
<path
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
strokeWidth={2}
|
|
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
|
|
{/* Error Text */}
|
|
<h1 className="text-6xl md:text-8xl font-bold text-gray-900 mb-4">500</h1>
|
|
<h2 className="text-2xl md:text-3xl font-semibold text-gray-700 mb-4">
|
|
Something Went Wrong
|
|
</h2>
|
|
<p className="text-lg text-gray-600 mb-8 max-w-md mx-auto">
|
|
We're sorry, but something unexpected happened. Our team has been notified and is working on a fix.
|
|
</p>
|
|
|
|
{/* Error Details (only in development) */}
|
|
{process.env.NODE_ENV === 'development' && error.message && (
|
|
<div className="mb-8 p-4 bg-red-50 border border-red-200 rounded-lg text-left">
|
|
<p className="text-sm font-mono text-red-800 break-all">
|
|
<strong>Error:</strong> {error.message}
|
|
</p>
|
|
{error.digest && (
|
|
<p className="text-sm font-mono text-red-600 mt-2">
|
|
<strong>Digest:</strong> {error.digest}
|
|
</p>
|
|
)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/* Action Buttons */}
|
|
<div className="flex flex-col sm:flex-row gap-4 justify-center items-center">
|
|
<Button size="lg" onClick={reset}>
|
|
<svg
|
|
className="w-5 h-5 mr-2"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
viewBox="0 0 24 24"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
<path
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
strokeWidth={2}
|
|
d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
|
|
/>
|
|
</svg>
|
|
Try Again
|
|
</Button>
|
|
|
|
<Link href="/">
|
|
<Button variant="outline" size="lg">
|
|
<svg
|
|
className="w-5 h-5 mr-2"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
viewBox="0 0 24 24"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
<path
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
strokeWidth={2}
|
|
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
|
|
/>
|
|
</svg>
|
|
Go Home
|
|
</Button>
|
|
</Link>
|
|
</div>
|
|
|
|
{/* Help Text */}
|
|
<div className="mt-12 pt-8 border-t border-gray-200">
|
|
<p className="text-sm text-gray-500">
|
|
If this problem persists, please{' '}
|
|
<Link href="/#faq" className="text-primary-600 hover:text-primary-700 font-medium">
|
|
check our FAQ
|
|
</Link>
|
|
{' '}or contact support.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|