From abb8eb23e5cb4c8db9916462baf0909822b05dfc Mon Sep 17 00:00:00 2001 From: twotalesanimation <80506065+twotalesanimation@users.noreply.github.com> Date: Mon, 8 Dec 2025 11:47:01 +0200 Subject: [PATCH] Add updates modal to homepage with session-based display and Jan 1 2026 expiry --- index.php | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) diff --git a/index.php b/index.php index 3e717e22..e79bfc52 100644 --- a/index.php +++ b/index.php @@ -4,6 +4,21 @@ $headerStyle = 'dark'; include_once($rootPath . '/header.php'); $indemnityPending = false; +// Set session flag for updates modal - only show once per session and before Jan 1, 2026 +if (!isset($_SESSION['updates_modal_shown'])) { + $currentDate = new DateTime(); + $endDate = new DateTime('2026-01-01'); + + if ($currentDate < $endDate) { + $_SESSION['updates_modal_shown'] = true; + $showUpdatesModal = true; + } else { + $showUpdatesModal = false; + } +} else { + $showUpdatesModal = false; +} + if (isset($_SESSION['user_id']) && isset($conn) && $conn !== null) { $userId = $_SESSION['user_id']; $stmt = $conn->prepare("SELECT user_id FROM membership_application WHERE user_id = ? AND accept_indemnity = 0 LIMIT 1"); @@ -636,8 +651,199 @@ if (countUpcomingTrips() > 0) { ?> updateCountdown(); // initial call setInterval(updateCountdown, 1000); + + // Show updates modal on page load + document.addEventListener('DOMContentLoaded', function() { + const modal = document.getElementById('updatesModal'); + const closeBtn = document.querySelector('.updates-modal-close'); + const showModal = ; + + if (showModal) { + // Show modal after a short delay for better UX + setTimeout(function() { + modal.style.display = 'flex'; + }, 500); + } + + // Close modal when X is clicked + closeBtn.addEventListener('click', function() { + modal.style.display = 'none'; + }); + + // Close modal when clicking outside the modal content + modal.addEventListener('click', function(event) { + if (event.target === modal) { + modal.style.display = 'none'; + } + }); + }); + +