Files
hackerspace.sh/app/global-error.tsx
T
v0andMoheeb Zara f5697f577f feat: comprehensive application audit and fixes
Audited codebase, fixed input validation, OAuth, error handling, type casts, and security hardening

Co-authored-by: Moheeb Zara <[email protected]>
2026-03-11 08:18:57 +00:00

63 lines
1.9 KiB
TypeScript

'use client'
import { useEffect } from 'react'
export default function GlobalError({
error,
reset,
}: {
error: Error & { digest?: string }
reset: () => void
}) {
useEffect(() => {
console.error('[Global Error]', error)
}, [error])
return (
<html lang="en">
<body className="font-sans antialiased">
<div className="min-h-screen bg-[#111] flex items-center justify-center p-4">
<div className="max-w-md w-full text-center">
<div className="w-16 h-16 rounded-full bg-red-500/20 flex items-center justify-center mx-auto mb-6">
<svg
className="w-8 h-8 text-red-500"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<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>
<h1 className="text-2xl font-bold text-white mb-2 font-mono">
Critical Error
</h1>
<p className="text-zinc-400 mb-6">
A critical error occurred. Please refresh the page or try again later.
</p>
{error.digest && (
<p className="text-xs text-zinc-600 font-mono mb-6">
Error ID: {error.digest}
</p>
)}
<button
onClick={reset}
className="inline-flex items-center justify-center gap-2 px-6 py-3 rounded-md bg-white text-black font-medium text-sm hover:bg-zinc-200 transition-colors"
>
Try again
</button>
</div>
</div>
</body>
</html>
)
}