Resume system overhaul :)
All checks were successful
Docker Deploy / build-and-push (push) Successful in 3m54s

This commit is contained in:
2025-07-18 12:14:23 -06:00
parent 26c0862b3e
commit 528060b85a
13 changed files with 951 additions and 360 deletions

View File

@@ -3,6 +3,7 @@ import { Icon } from "astro-icon/components";
import Layout from "../layouts/Layout.astro";
import ResumeSkills from "../components/ResumeSkills";
import ResumeDownloadButton from "../components/ResumeDownloadButton";
import ResumeSettingsModal from "../components/ResumeSettingsModal";
import { siteConfig } from "../config/data";
import "../styles/global.css";
import * as TOML from "@iarna/toml";
@@ -56,44 +57,48 @@ interface ResumeData {
let resumeData: ResumeData | undefined = undefined;
let fetchError: string | null = null;
// Check if resume TOML file is configured before attempting to fetch
if (!siteConfig.resume.tomlFile || !siteConfig.resume.tomlFile.trim()) {
return Astro.redirect("/");
}
try {
// Get the base URL
const baseUrl = Astro.url.origin;
let tomlContent: string;
// Fetch the TOML file from the public directory
const response = await fetch(`${baseUrl}${siteConfig.resume.tomlFile}`);
if (siteConfig.resume.tomlFile.startsWith("/")) {
const baseUrl = Astro.url.origin;
const response = await fetch(`${baseUrl}${siteConfig.resume.tomlFile}`);
if (!response.ok) {
throw new Error(
`Failed to fetch resume: ${response.status} ${response.statusText}`,
);
if (!response.ok) {
throw new Error(
`Failed to fetch resume: ${response.status} ${response.statusText}`,
);
}
tomlContent = await response.text();
} else {
tomlContent = siteConfig.resume.tomlFile;
}
const tomlContent = await response.text();
resumeData = TOML.parse(tomlContent) as unknown as ResumeData;
} 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("/");
}
---
<Layout title="Resume">
<ResumeSettingsModal client:load />
<div class="container mx-auto p-4 sm:p-6 lg:p-8 max-w-4xl w-full">
<h1 class="text-3xl sm:text-4xl font-bold text-primary mb-4 sm:mb-6 text-center">
<h1
class="text-3xl sm:text-4xl font-bold text-primary mb-4 sm:mb-6 text-center"
>
{data.basics.name}
</h1>