This commit is contained in:
@ -41,6 +41,12 @@ interface ResumeData {
|
||||
position: string;
|
||||
date: string;
|
||||
}[];
|
||||
awards: {
|
||||
title: string;
|
||||
organization: string;
|
||||
date: string;
|
||||
description?: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
const generateResumeHTML = (data: ResumeData): string => {
|
||||
@ -128,6 +134,23 @@ const generateResumeHTML = (data: ResumeData): string => {
|
||||
})
|
||||
.join("") || "";
|
||||
|
||||
const awardsHTML =
|
||||
data.awards
|
||||
?.map((award) => {
|
||||
return `
|
||||
<div class="mb-2 pl-2 border-l-2 border-yellow-600">
|
||||
<h3 class="text-xs font-semibold text-gray-900 mb-1">${award.title}</h3>
|
||||
<div class="text-xs text-gray-600 mb-1">
|
||||
<span class="font-medium">${award.organization}</span>
|
||||
<span class="mx-1">•</span>
|
||||
<span>${award.date}</span>
|
||||
</div>
|
||||
${award.description ? `<div class="text-xs text-gray-700 leading-tight">${award.description}</div>` : ""}
|
||||
</div>
|
||||
`;
|
||||
})
|
||||
.join("") || "";
|
||||
|
||||
return `
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@ -217,6 +240,23 @@ const generateResumeHTML = (data: ResumeData): string => {
|
||||
`
|
||||
: ""
|
||||
}
|
||||
|
||||
${
|
||||
data.awards &&
|
||||
data.awards.length > 0 &&
|
||||
resumeConfig.sections.awards?.enabled
|
||||
? `
|
||||
<section>
|
||||
<h2 class="text-sm font-semibold text-gray-900 mb-2 pb-1 border-b border-gray-300">
|
||||
${resumeConfig.sections.awards.title || "Awards & Recognition"}
|
||||
</h2>
|
||||
<div class="space-y-2">
|
||||
${awardsHTML}
|
||||
</div>
|
||||
</section>
|
||||
`
|
||||
: ""
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
@ -263,14 +303,14 @@ const generateResumeHTML = (data: ResumeData): string => {
|
||||
|
||||
export const GET: APIRoute = async ({ request }) => {
|
||||
try {
|
||||
if (!siteConfig.resume.jsonFile || !siteConfig.resume.jsonFile.trim()) {
|
||||
if (!siteConfig.resume.tomlFile || !siteConfig.resume.tomlFile.trim()) {
|
||||
return new Response("Resume not configured", { status: 404 });
|
||||
}
|
||||
|
||||
const url = new URL(request.url);
|
||||
const baseUrl = `${url.protocol}//${url.host}`;
|
||||
|
||||
const response = await fetch(`${baseUrl}${siteConfig.resume.jsonFile}`);
|
||||
const response = await fetch(`${baseUrl}${siteConfig.resume.tomlFile}`);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
@ -279,7 +319,9 @@ export const GET: APIRoute = async ({ request }) => {
|
||||
}
|
||||
|
||||
const tomlContent = await response.text();
|
||||
const resumeData: ResumeData = TOML.parse(tomlContent) as unknown as ResumeData;
|
||||
const resumeData: ResumeData = TOML.parse(
|
||||
tomlContent,
|
||||
) as unknown as ResumeData;
|
||||
|
||||
const htmlContent = generateResumeHTML(resumeData);
|
||||
|
||||
|
Reference in New Issue
Block a user