feat: try to fix the prod deployment

This commit is contained in:
Barrett Ruth 2025-05-22 16:57:29 -05:00
parent ca70d878fb
commit 63fc4373b2
4 changed files with 40 additions and 5 deletions

View file

@ -2,8 +2,11 @@
const path = Astro.url.pathname;
const isHome = path === "/" || path === "/index.html";
// Determine topic from path
function getTopic() {
if (path.startsWith("/about")) {
return "/about";
}
const pathname = path.split("/");
if (pathname.length === 2 && pathname[1].endsWith(".html")) {
@ -28,16 +31,14 @@ const promptText = topic ? `barrett@ruth:~$ ${topic}` : "barrett@ruth:~$";
<div class="header-links">
<a target="_blank" href="/resume.pdf">resume</a>
<a target="_blank" href="/transcript.pdf">transcript</a>
<a href="/about">about</a>
<a href="/about/">about</a>
</div>
</header>
<script>
// Terminal functionality
const TERMINAL_PROMPT = "barrett@ruth:~$ ";
let clearing = false;
// Clear the terminal prompt with animation
function clearPrompt(delay, callback) {
if (clearing) return;
clearing = true;
@ -71,6 +72,26 @@ const promptText = topic ? `barrett@ruth:~$ ${topic}` : "barrett@ruth:~$";
clearPrompt(500, () => (window.location.href = "/"));
}
function goToAbout(e) {
e.preventDefault();
const terminalPrompt = document.querySelector(".terminal-prompt");
const terminalText = " /about";
const delay = 500;
clearPrompt(delay, () => {
let i = 0;
function typechar() {
if (i < terminalText.length) {
terminalPrompt.innerHTML += terminalText.charAt(i++);
setTimeout(typechar, delay / terminalText.length);
} else {
window.location.href = "/about/";
}
}
typechar();
});
}
document.addEventListener("DOMContentLoaded", () => {
window.TERMINAL_PROMPT = TERMINAL_PROMPT;
window.clearPrompt = clearPrompt;
@ -96,6 +117,16 @@ const promptText = topic ? `barrett@ruth:~$ ${topic}` : "barrett@ruth:~$";
homeLink.addEventListener("click", goHome);
}
}
const aboutLink = document.querySelector('header a[href="/about/"]');
if (aboutLink) {
const path = window.location.pathname;
const isHome = path === "/" || path === "/index.html";
if (isHome) {
aboutLink.addEventListener("click", goToAbout);
}
}
});
</script>