'use client' import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog" import { Separator } from "@/components/ui/separator" import { ArrowLeft, Building2, Users, Info, AlertCircle, Copy } from "lucide-react" import Link from "next/link" import { useRouter } from "next/navigation" import { useState, useEffect } from "react" import { toast } from "sonner" // 에러 정보 타입 interface ErrorInfo { timestamp: string; url: string; userAgent: string; platform: string; language: string; cookieEnabled: boolean; onLine: boolean; screen: { width: number; height: number; colorDepth: number; }; viewport: { width: number; height: number; }; referrer: string; localStorage: boolean; sessionStorage: boolean; } export default function NotFound() { const router = useRouter() const [errorInfo, setErrorInfo] = useState(null) useEffect(() => { // 브라우저 환경 정보 수집 const collectErrorInfo = () => { const info: ErrorInfo = { timestamp: new Date().toISOString(), url: window.location.href, userAgent: navigator.userAgent, platform: navigator.platform, language: navigator.language, cookieEnabled: navigator.cookieEnabled, onLine: navigator.onLine, screen: { width: screen.width, height: screen.height, colorDepth: screen.colorDepth, }, viewport: { width: window.innerWidth, height: window.innerHeight, }, referrer: document.referrer || '직접 접근', localStorage: typeof Storage !== 'undefined', sessionStorage: typeof Storage !== 'undefined', } setErrorInfo(info) } collectErrorInfo() }, []) const copyToClipboard = (text: string) => { navigator.clipboard.writeText(text).then(() => { toast.success("클립보드에 복사되었습니다") }).catch(() => { toast.error("복사에 실패했습니다") }) } const copyErrorInfo = () => { if (!errorInfo) return const errorText = ` === 404 에러 정보 === 시간: ${errorInfo.timestamp} URL: ${errorInfo.url} 리퍼러: ${errorInfo.referrer} 브라우저: ${errorInfo.userAgent} 플랫폼: ${errorInfo.platform} 언어: ${errorInfo.language} 화면 해상도: ${errorInfo.screen.width}x${errorInfo.screen.height} 뷰포트: ${errorInfo.viewport.width}x${errorInfo.viewport.height} 온라인 상태: ${errorInfo.onLine ? '온라인' : '오프라인'} 쿠키 활성화: ${errorInfo.cookieEnabled ? '예' : '아니오'} `.trim() copyToClipboard(errorText) } return (
404
이 페이지는 개발중이거나, 잘못된 URL 입니다. THIS PAGE IS UNDER DEVELOPMENT OR INVALID URL.
아래 버튼을 통해 원하는 페이지로 이동하세요
{/* SHI 사용자 홈 */} {/* 벤더 홈 */} {/* 뒤로 가기 */}
{/* 에러 정보 다이얼로그 */} 에러 상세 정보 기술 지원을 위한 상세 환경 정보입니다. {errorInfo && (
{errorInfo.timestamp}
{errorInfo.url}
{errorInfo.referrer}
{errorInfo.userAgent}
{errorInfo.platform}
{errorInfo.language}
{errorInfo.screen.width} × {errorInfo.screen.height}
{errorInfo.viewport.width} × {errorInfo.viewport.height}
{errorInfo.onLine ? '온라인' : '오프라인'}
{errorInfo.cookieEnabled ? '예' : '아니오'}
{errorInfo.screen.colorDepth}bit
)}
) }