diff --git a/src/pages/apply.astro b/src/pages/apply.astro index 89dd3f4..5ff61c8 100644 --- a/src/pages/apply.astro +++ b/src/pages/apply.astro @@ -151,24 +151,27 @@ import '../styles/apply.scss'; const successMsg = document.getElementById('success-message'); // --- STEP 1: CHECK GOOGLE SHEET STATUS --- - fetch(SCRIPT_URL) - .then(response => response.json()) - .then(data => { - loadingStatus.style.display = 'none'; // Hide the spinner - - // Look at the B1 cell value from the Google Sheet - if (data.status === 'OPEN') { - registrationContent.style.display = 'block'; // Reveal the portal! - } else { - closedMessage.style.display = 'block'; // Show the closed message - } - }) - .catch(error => { - // If the internet is down or script fails, fail gracefully by showing closed - loadingStatus.style.display = 'none'; - closedMessage.style.display = 'block'; - }); - + // Added the protective if-statement here! + if (loadingStatus && closedMessage && registrationContent) { + fetch(SCRIPT_URL) + .then(response => response.json()) + .then(data => { + loadingStatus.style.display = 'none'; // Hide the spinner + + // Look at the B1 cell value from the Google Sheet + if (data.status === 'OPEN') { + registrationContent.style.display = 'block'; // Reveal the portal! + } else { + closedMessage.style.display = 'block'; // Show the closed message + } + }) + .catch(error => { + console.error("Status check failed:", error); // Added this to clear the warning + // If the internet is down or script fails, fail gracefully by showing closed + loadingStatus.style.display = 'none'; + closedMessage.style.display = 'block'; + }); + } // --- ELIGIBILITY LOGIC --- if (checkBtn && eligibilitySection && ineligibleMsg && mainForm) { @@ -246,6 +249,7 @@ import '../styles/apply.scss'; } }) .catch(error => { + console.error("Form submission failed:", error); // Added this to clear the warning alert('A network error occurred. Please try again.'); submitBtn.disabled = false; submitBtn.style.display = 'block'; diff --git a/src/styles/apply.scss b/src/styles/apply.scss index ef2efd5..9ae094e 100644 --- a/src/styles/apply.scss +++ b/src/styles/apply.scss @@ -1,4 +1,5 @@ -@import './variables.scss'; +@use './variables.scss' as *; +@use "sass:color"; /* Add this line! */ .registration-section { padding-block: 8rem; @@ -195,7 +196,9 @@ transition: background-color 0.2s ease; &:hover { - background-color: darken($primary, 10%); + /* Old way: background-color: darken($primary, 10%); */ + /* New way: */ + background-color: color.adjust($primary, $lightness: -10%); } } }