Add error and loading pages, remove experimental SSR

This commit is contained in:
2025-12-03 01:31:16 +00:00
parent f3c1599a11
commit 8432eb1cc0
3 changed files with 23 additions and 55 deletions

View File

@@ -1,8 +1,5 @@
'use client'
import { useEffect } from 'react'
import { AlertTriangle } from 'lucide-react'
export default function Error({
error,
reset,
@@ -10,37 +7,20 @@ export default function Error({
error: Error & { digest?: string }
reset: () => void
}) {
useEffect(() => {
console.error('Page error:', error)
}, [error])
return (
<div className="min-h-screen flex items-center justify-center p-4 bg-gray-50">
<div className="max-w-md w-full bg-white rounded-lg shadow-lg p-6 sm:p-8">
<div className="flex items-center justify-center w-12 h-12 sm:w-16 sm:h-16 bg-red-100 rounded-full mx-auto mb-4">
<AlertTriangle className="w-6 h-6 sm:w-8 sm:h-8 text-red-600" />
</div>
<h2 className="text-xl sm:text-2xl font-bold text-gray-900 text-center mb-2">
Something went wrong
</h2>
<p className="text-sm sm:text-base text-gray-600 text-center mb-6">
{error.message || 'We encountered an unexpected error. Please try again.'}
<div className="min-h-screen flex items-center justify-center bg-gray-50">
<div className="max-w-md w-full bg-white rounded-lg shadow-md p-6">
<h2 className="text-xl font-semibold text-gray-900 mb-4">Something went wrong!</h2>
<p className="text-gray-600 mb-4">
There was an error loading this page. Please try again.
</p>
<div className="flex flex-col sm:flex-row gap-3">
<button
onClick={reset}
className="flex-1 px-4 py-3 bg-blue-500 hover:bg-blue-600 active:bg-blue-700 text-white rounded-lg transition-colors font-medium text-sm sm:text-base tap-target"
>
Try Again
</button>
<button
onClick={() => window.location.href = '/'}
className="flex-1 px-4 py-3 bg-gray-200 hover:bg-gray-300 active:bg-gray-400 text-gray-700 rounded-lg transition-colors font-medium text-sm sm:text-base tap-target"
>
Go Home
</button>
</div>
<button
onClick={reset}
className="w-full bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition-colors"
>
Try again
</button>
</div>
</div>
)
}
}