import { Head } from "$fresh/runtime.ts"; import { Handlers, PageProps } from "$fresh/server.ts"; import { LuMail, LuGithub, LuLinkedin, LuGlobe, LuGitBranch, LuDownload, } from "@preact-icons/lu"; interface ResumeData { basics: { name: string; email: string; url?: { href: string }; }; sections: { summary: { name: string; content: string }; profiles: { name: string; items: { network: string; username: string; url: { href: string } }[] }; skills: { name: string; items: { id: string; name: string; level: number }[] }; experience: { name: string; items: { id: string; company: string; position: string; date: string; location: string; summary: string; url?: { href: string } }[] }; education: { name: string; items: { id: string; institution: string; studyType: string; area: string; date: string; summary: string }[] }; volunteer: { name: string; items: { id: string; organization: string; position: string; date: string /* No summary here */ }[] }; }; } export const handler: Handlers = { async GET(_req, ctx) { try { const resp = await fetch(new URL("/files/resume.json", ctx.url).href); if (!resp.ok) { console.error(`Error fetching resume.json: ${resp.status} ${resp.statusText}`); return ctx.render(undefined); } const resumeData: ResumeData = await resp.json(); const skillsSection = resumeData.sections.skills; if (skillsSection && skillsSection.items) { const tsSkill = skillsSection.items.find(s => s.name === "Typescrpt"); if (tsSkill) { tsSkill.name = "Typescript"; } } return ctx.render(resumeData); } catch (error) { console.error("Error processing resume data:", error); return ctx.render(undefined); } }, }; export default function ResumePage({ data }: PageProps) { if (!data) { return ( <> Error Loading Resume

Error loading resume data.

Please try refreshing the page.

); } const { basics, sections } = data; const { summary, profiles, skills, experience, education, volunteer } = sections; return ( <> {basics.name} - Resume

{basics.name}

{/* Contact Info */} {/* Download Resume Button */} {/* Summary Card */} {summary && (

{summary.name || "Summary"}

)} {/* Profiles Card */} {profiles && profiles.items && profiles.items.length > 0 && (

{profiles.name || "Profiles"}

{profiles.items.map((profile) => { let IconComponent = LuGlobe; const networkLower = profile.network.toLowerCase(); if (networkLower === "github") IconComponent = LuGithub; else if (networkLower === "linkedin") IconComponent = LuLinkedin; else if (networkLower === "forgejo") IconComponent = LuGitBranch; return ( {profile.network} ({profile.username}) ); })}
)} {/* Skills Card */} {skills && skills.items && skills.items.length > 0 && (

{skills.name || "Skills"}

{skills.items.map((skill) => (
))}
)} {/* Experience Card */} {experience && experience.items && experience.items.length > 0 && (

{experience.name || "Experience"}

{experience.items.map((exp, index) => (
{exp.position} at {exp.company} ({exp.date}) {exp.location && ( {exp.location} )}
{exp.url && exp.url.href && ( {exp.url.href} )}
))}
)} {/* Education Card */} {education && education.items && education.items.length > 0 && (

{education.name || "Education"}

{education.items.map((edu, index) => (

{edu.institution}

{edu.studyType} - {edu.area} ({edu.date})

{edu.summary && (
)}
))}
)} {/* Volunteering Card */} {volunteer && volunteer.items && volunteer.items.length > 0 && (

{volunteer.name || "Volunteering"}

{volunteer.items.map((vol, index) => (

{vol.organization}

{vol.position} ({vol.date})

))}
)}
); }