'use client' import Link from 'next/link' import Image from 'next/image' import { Menu, X } from 'lucide-react' import { useState, useEffect, useRef } from 'react' import { useTerminal } from '@/lib/TerminalContext' import { useLanguage } from '@/lib/LanguageContext' import { CIStatusIndicator } from './CIStatusIndicator' export default function Header() { const [open, setOpen] = useState(false) const [skillsOpen, setSkillsOpen] = useState(false) const [contactOpen, setContactOpen] = useState(false) const [educationOpen, setEducationOpen] = useState(false) const { isOpen: terminalOpen, setIsOpen: setTerminalOpen } = useTerminal() const { lang, setLang, t } = useLanguage() const [copied, setCopied] = useState(null) const handleCopy = (text: string, label: string) => { navigator.clipboard.writeText(text) setCopied(label) setTimeout(() => setCopied(null), 2000) } const toggleLang = () => { setLang(lang === 'en' ? 'zh' : 'en') } const skillsRef = useRef(null) const contactRef = useRef(null) const educationRef = useRef(null) useEffect(() => { const handleClickOutside = (e: MouseEvent) => { if (skillsRef.current && !skillsRef.current.contains(e.target as Node)) setSkillsOpen(false) if (contactRef.current && !contactRef.current.contains(e.target as Node)) setContactOpen(false) if (educationRef.current && !educationRef.current.contains(e.target as Node)) setEducationOpen(false) } document.addEventListener('mousedown', handleClickOutside) return () => document.removeEventListener('mousedown', handleClickOutside) }, []) return (
Profile
{t.header.title}
{t.header.subtitle}
{/* Mobile Language Toggle */}
{open && (
{skillsOpen && (
{Object.entries(t.header.skills).map(([key, category]) => (
{(category as {title: string}).title}
{(category as {items: string[]}).items.map((skill) => ( {skill} ))}
))}
)} {contactOpen && (
{t.header.contact.portfolio}
{t.header.contact.github}
{t.header.contact.privateGithub}
{t.header.contact.linkedin}
{t.header.contact.email}
)}
{t.header.experience}
{t.header.experienceValue}
{educationOpen && (

{t.header.educationDetails.bachelor.school}

{t.header.educationDetails.bachelor.degree}

{t.header.educationDetails.bachelor.period}

{t.header.educationDetails.master.school}

{t.header.educationDetails.master.degree}

{t.header.educationDetails.master.period}

)}
)}
) }