"use client"; import { useState, useEffect } from "react"; interface PersonalInfo { name: string; title: string; email: string; phone: string; location: string; linkedin: string; website: string; } interface Experience { id: string; title: string; company: string; location: string; startDate: string; endDate: string; bullets: string[]; } interface Education { id: string; degree: string; school: string; location: string; graduationDate: string; gpa: string; honors: string; } export default function ResumePage() { const [activeTab, setActiveTab] = useState<"edit" | "preview">("edit"); const [personal, setPersonal] = useState({ name: "Your Name", title: "Your Professional Title", email: "your.email@email.com", phone: "+1 (555) 000-0000", location: "City, State", linkedin: "linkedin.com/in/yourprofile", website: "yourwebsite.com" }); const [experiences, setExperiences] = useState([ { id: "1", title: "Job Title", company: "Company Name", location: "City, State", startDate: "Jan 2020", endDate: "Present", bullets: [ "Key achievement or responsibility with measurable impact", "Another accomplishment that demonstrates your skills", "Additional relevant contribution" ] } ]); const [education, setEducation] = useState([ { id: "1", degree: "Bachelor of Science in Computer Science", school: "University Name", location: "City, State", graduationDate: "May 2016", gpa: "3.8/4.0", honors: "Magna Cum Laude" } ]); const [skills, setSkills] = useState([ "JavaScript/TypeScript", "React/Next.js", "Node.js", "Python", "AWS/Cloud Services", "Database Management", "Agile/Scrum", "Git" ]); const [languages, setLanguages] = useState<{name: string, level: string}[]>([ { name: "English", level: "Native" }, { name: "Spanish", level: "Professional" }, { name: "Arabic", level: "Native" } ]); const [certifications, setCertifications] = useState([ "AWS Solutions Architect", "Google Cloud Professional" ]); useEffect(() => { const saved = localStorage.getItem("haitham_resume_v2"); if (saved) { try { const data = JSON.parse(saved); if (data.personal) setPersonal(data.personal); if (data.experiences) setExperiences(data.experiences); if (data.education) setEducation(data.education); if (data.skills) setSkills(data.skills); if (data.languages) setLanguages(data.languages); if (data.certifications) setCertifications(data.certifications); } catch (e) {} } }, []); useEffect(() => { localStorage.setItem("haitham_resume_v2", JSON.stringify({ personal, experiences, education, skills, languages, certifications })); }, [personal, experiences, education, skills, languages, certifications]); const addExperience = () => { setExperiences([...experiences, { id: Date.now().toString(), title: "", company: "", location: "", startDate: "", endDate: "", bullets: [""] }]); }; const updateExperience = (id: string, field: keyof Experience, value: any) => { setExperiences(experiences.map(e => e.id === id ? { ...e, [field]: value } : e)); }; const addBullet = (id: string) => { setExperiences(experiences.map(e => e.id === id ? { ...e, bullets: [...e.bullets, ""] } : e )); }; const updateBullet = (expId: string, index: number, value: string) => { setExperiences(experiences.map(e => e.id === expId ? { ...e, bullets: e.bullets.map((b, i) => i === index ? value : b) } : e )); }; const removeBullet = (expId: string, index: number) => { setExperiences(experiences.map(e => e.id === expId ? { ...e, bullets: e.bullets.filter((_, i) => i !== index) } : e )); }; const addEducation = () => { setEducation([...education, { id: Date.now().toString(), degree: "", school: "", location: "", graduationDate: "", gpa: "", honors: "" }]); }; const updateEducation = (id: string, field: keyof Education, value: string) => { setEducation(education.map(e => e.id === id ? { ...e, [field]: value } : e)); }; const handlePrint = () => { setActiveTab("preview"); setTimeout(() => window.print(), 100); }; const inputClass = "w-full bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-white text-sm focus:outline-none focus:border-blue-500"; const labelClass = "block text-slate-400 text-xs mb-1 font-medium"; return (
{/* Header */}

📝 Professional Resume

Edit • Preview • Download PDF

{activeTab === "edit" ? (
{/* Personal Info */}

👤 Personal Information

setPersonal({...personal, name: e.target.value})} className={inputClass} />
setPersonal({...personal, title: e.target.value})} className={inputClass} />
setPersonal({...personal, email: e.target.value})} className={inputClass} />
setPersonal({...personal, phone: e.target.value})} className={inputClass} />
setPersonal({...personal, location: e.target.value})} className={inputClass} />
setPersonal({...personal, linkedin: e.target.value})} className={inputClass} />
{/* Experience */}

💼 Work Experience

{experiences.map((exp) => (
updateExperience(exp.id, "title", e.target.value)} className={inputClass} />
updateExperience(exp.id, "company", e.target.value)} className={inputClass} />
updateExperience(exp.id, "location", e.target.value)} className={inputClass} />
updateExperience(exp.id, "startDate", e.target.value)} className={inputClass} placeholder="Jan 2020" />
updateExperience(exp.id, "endDate", e.target.value)} className={inputClass} placeholder="Present" />
{exp.bullets.map((bullet, i) => (
updateBullet(exp.id, i, e.target.value)} className={inputClass} placeholder={`Achievement ${i + 1}`} /> {exp.bullets.length > 1 && ( )}
))}
))}
{/* Education */}

🎓 Education

{education.map((edu) => (
updateEducation(edu.id, "degree", e.target.value)} className={inputClass} />
updateEducation(edu.id, "school", e.target.value)} className={inputClass} />
updateEducation(edu.id, "location", e.target.value)} className={inputClass} />
updateEducation(edu.id, "graduationDate", e.target.value)} className={inputClass} />
updateEducation(edu.id, "gpa", e.target.value)} className={inputClass} />
updateEducation(edu.id, "honors", e.target.value)} className={inputClass} placeholder="Magna Cum Laude" />
))}
{/* Skills */}

🛠️ Technical Skills

{skills.map((skill, i) => (
{ const newSkills = [...skills]; newSkills[i] = e.target.value; setSkills(newSkills); }} className="bg-transparent text-white text-sm w-24 focus:outline-none" />
))}
{/* Languages */}

🌍 Languages

{languages.map((lang, i) => (
{ const newLangs = [...languages]; newLangs[i].name = e.target.value; setLanguages(newLangs); }} className="bg-transparent text-white text-sm w-24 focus:outline-none" /> { const newLangs = [...languages]; newLangs[i].level = e.target.value; setLanguages(newLangs); }} className="bg-transparent text-slate-400 text-sm w-20 focus:outline-none" />
))}
{/* Certifications */}

📜 Certifications

{certifications.map((cert, i) => (
{ const newCerts = [...certifications]; newCerts[i] = e.target.value; setCertifications(newCerts); }} className="bg-transparent text-white text-sm w-40 focus:outline-none" />
))}
) : ( /* PREVIEW - Professional Resume Template */
{/* Header - Dark Blue Professional */}

{personal.name || "Your Name"}

{personal.title || "Professional Title"}
{personal.email && ✉️ {personal.email}} {personal.phone && 📱 {personal.phone}} {personal.location && 📍 {personal.location}} {personal.linkedin && 💼 {personal.linkedin}}
{/* Body */}
{/* Summary */}
Professional Summary

Results-driven professional with proven expertise in delivering high-impact solutions. Skilled in modern technologies and best practices. Demonstrated ability to lead projects, optimize processes, and achieve organizational goals.

{/* Experience */}
Work Experience
{experiences.filter(e => e.title || e.company).map((exp) => (
{exp.title || "Job Title"} | {exp.company || "Company"}
{exp.startDate} - {exp.endDate}
{exp.location &&
{exp.location}
}
    {exp.bullets.filter(b => b).map((bullet, i) => (
  • {bullet}
  • ))}
))}
{/* Education */}
Education
{education.filter(e => e.degree || e.school).map((edu) => (
{edu.degree || "Degree"} {edu.honors && ({edu.honors})}
{edu.graduationDate}
{edu.school}{edu.location && `, ${edu.location}`}
{edu.gpa &&
GPA: {edu.gpa}
}
))}
{/* Skills */}
Technical Skills
{skills.filter(s => s).map((skill, i) => ( {skill} ))}
{/* Languages & Certs */}
Languages
{languages.filter(l => l.name).map((lang, i) => (
{lang.name} - {lang.level}
))}
Certifications
{certifications.filter(c => c).map((cert, i) => (
{cert}
))}
)}
); }