--- import { Icon } from "astro-icon/components"; import Layout from "../layouts/Layout.astro"; import ResumeSkills from "../components/ResumeSkills"; import { siteConfig } from "../config/data"; import "../styles/global.css"; 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; }[]; }; }; } let resumeData: ResumeData | undefined = undefined; let fetchError: string | null = null; // Check if resume JSON file is configured before attempting to fetch if (!siteConfig.resume.jsonFile || !siteConfig.resume.jsonFile.trim()) { return Astro.redirect('/'); } try { // Get the base URL const baseUrl = Astro.url.origin; // Fetch the JSON file from the public directory const response = await fetch(`${baseUrl}${siteConfig.resume.jsonFile}`); if (!response.ok) { throw new Error( `Failed to fetch resume: ${response.status} ${response.statusText}`, ); } resumeData = await response.json(); if (resumeData && resumeData.sections && resumeData.sections.skills) { const resumeSkills = resumeData.sections.skills; if (resumeSkills.items) { const tsSkill = resumeSkills.items.find( (s) => s.name === "Typescrpt", ); if (tsSkill) { tsSkill.name = "Typescript"; } } } } catch (error) { console.error("Error loading resume data:", error); // Return to home page when resume data cannot be loaded return Astro.redirect('/'); } const data = resumeData; const resumeConfig = siteConfig.resume; // At this point, data is guaranteed to exist since we redirect on error if (!data) { return Astro.redirect('/'); } ---

{data.basics.name}

{resumeConfig.pdfFile?.path && ( )} {data.sections.summary && resumeConfig.sections.summary?.enabled && (

{resumeConfig.sections.summary.title || data.sections.summary.name || "Summary"}

)} {data.sections.profiles && data.sections.profiles.items && data.sections.profiles.items.length > 0 && resumeConfig.sections.profiles?.enabled && (

{resumeConfig.sections.profiles.title || data.sections.profiles.name || "Profiles"}

{data.sections.profiles.items.map( (profile) => { // Use Simple Icons directly based on network name // Convert network name to lowercase and use simple-icons format const iconName = `simple-icons:${profile.network.toLowerCase()}`; return ( {profile.network} ); }, )}
)} {data.sections.skills && data.sections.skills.items && data.sections.skills.items.length > 0 && resumeConfig.sections.skills?.enabled && (

{resumeConfig.sections.skills.title || data.sections.skills.name || "Skills"}

)} {data.sections.experience && data.sections.experience.items && data.sections.experience.items.length > 0 && resumeConfig.sections.experience?.enabled && (

{resumeConfig.sections.experience.title || data.sections.experience.name || "Experience"}

{data.sections.experience.items.map( (experience) => (

{experience.position}

{experience.company} {experience.date} {experience.location}
{experience.url && experience.url.href && ( Company Website )}
), )}
)} {data.sections.education && data.sections.education.items && data.sections.education.items.length > 0 && resumeConfig.sections.education?.enabled && (

{resumeConfig.sections.education.title || data.sections.education.name || "Education"}

{data.sections.education.items.map( (education) => (

{education.institution}

{education.studyType} in{" "} {education.area} {education.date}
{education.summary && (
)}
), )}
)} {data.sections.volunteer && data.sections.volunteer.items && data.sections.volunteer.items.length > 0 && resumeConfig.sections.volunteer?.enabled && (

{resumeConfig.sections.volunteer.title || data.sections.volunteer.name || "Volunteer Work"}

{data.sections.volunteer.items.map( (volunteer) => (

{volunteer.organization}

{volunteer.position} {volunteer.date}
), )}
)}