borsa / nextjs-app /src /app /profiles /error.tsx
veteroner's picture
fix: complete US market cleanup and smoke-test fixes
a2a8336
'use client'
import { useEffect } from 'react'
import { useMarket } from '@/contexts/MarketContext'
export default function Error({
error,
reset,
}: {
error: Error & { digest?: string }
reset: () => void
}) {
const { market } = useMarket()
const isUS = market === 'us'
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">{isUS ? 'Something went wrong' : 'Bir hata oluştu'}</h2>
<p className="text-gray-600 mb-4 text-sm">
{isUS ? 'An unexpected problem occurred while loading the page.' : 'Sayfa yüklenirken beklenmeyen bir sorun oluştu.'}
</p>
{error?.digest && (
<p className="text-xs text-gray-400 mb-3">{isUS ? 'Code' : '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"
>
{isUS ? 'Try Again' : 'Tekrar Dene'}
</button>
</div>
</div>
)
}