| 'use client' | |
| import { useEffect } from 'react' | |
| export default function Error({ | |
| error, | |
| reset, | |
| }: { | |
| error: Error & { digest?: string } | |
| reset: () => void | |
| }) { | |
| useEffect(() => { | |
| console.error(error) | |
| }, [error]) | |
| return ( | |
| <div className="min-h-[60vh] flex items-center justify-center px-4"> | |
| <div className="max-w-sm w-full text-center"> | |
| <div className="text-4xl mb-4">⚠️</div> | |
| <h2 className="text-xl font-bold text-gray-900 mb-2">Bir hata oluştu</h2> | |
| <p className="text-gray-600 mb-4 text-sm"> | |
| Sayfa yüklenirken beklenmeyen bir sorun oluştu. | |
| </p> | |
| {error?.digest && ( | |
| <p className="text-xs text-gray-400 mb-3">Kod: {error.digest}</p> | |
| )} | |
| <button | |
| onClick={reset} | |
| className="px-5 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors text-sm font-medium" | |
| > | |
| Tekrar Dene | |
| </button> | |
| </div> | |
| </div> | |
| ) | |
| } | |