'use client'; import { useEffect, useState } from 'react'; import Link from 'next/link'; import { motion } from 'framer-motion'; import { Button } from '@/components/ui/button'; import { clientLogger } from '@/lib/logger-client'; import { RotateCcw, Home, LayoutDashboard, Copy, Check, ChevronDown, ChevronUp, ArrowLeft, AlertTriangle } from 'lucide-react'; interface ErrorProps { error: Error & { digest?: string }; reset: () => void; } export default function RootError({ error, reset }: ErrorProps) { const [showStack, setShowStack] = useState(false); const [copied, setCopied] = useState(false); useEffect(() => { console.error('Root Application Error Boundary caught:', error); if (error.stack) { clientLogger.error(error.stack); } }, [error]); const handleCopyDigest = async () => { if (!error.digest) return; try { await navigator.clipboard.writeText(error.digest); setCopied(true); setTimeout(() => setCopied(false), 2000); } catch { // ignore clipboard errors } }; return (
{/* Elevated Error Card */}
{/* Header with Crafted Warning Beacon */}
500

Unexpected Application Error

We encountered an issue while processing your request. The system has automatically recorded the incident.

{/* Error Summary Box */}
Error Summary {error.digest && ( )}

{error.message || 'An unexpected runtime error occurred.'}

{/* Developer Stack Trace Accordion */} {error.stack && (
{showStack && (
{error.stack}
)}
)} {/* Primary & Secondary Action Controls */}
{/* Footer Brand Note */}

H.A.T.s • HIS Attendance Task System

); }