From a8a5523dd49df96dc0644bde6546d548419a8319 Mon Sep 17 00:00:00 2001 From: Deco Vander Date: Thu, 3 Jul 2025 01:32:28 -0400 Subject: [PATCH] Show 'Persistent' in table view for persistent reports - Updated getTimeRemaining() to return 'Persistent' for persistent reports - Modified getRemainingClass() to handle persistent report styling - Table view now clearly indicates which reports are persistent vs. expiring - Maintains color coding for non-persistent reports based on time remaining --- public/app-mapbox.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/public/app-mapbox.js b/public/app-mapbox.js index bb109a2..db9a451 100644 --- a/public/app-mapbox.js +++ b/public/app-mapbox.js @@ -112,8 +112,8 @@ document.addEventListener('DOMContentLoaded', async () => { const tableHTML = sortedLocations.map(location => { const timeAgo = getTimeAgo(location.created_at); - const timeRemaining = getTimeRemaining(location.created_at); - const remainingClass = getRemainingClass(location.created_at); + const timeRemaining = getTimeRemaining(location.created_at, location.persistent); + const remainingClass = getRemainingClass(location.created_at, location.persistent); const reportedTime = new Date(location.created_at).toLocaleString(); return ` @@ -133,7 +133,11 @@ document.addEventListener('DOMContentLoaded', async () => { }; // Calculate time remaining until 24-hour expiration - const getTimeRemaining = (timestamp) => { + const getTimeRemaining = (timestamp, persistent = false) => { + if (persistent) { + return 'Persistent'; + } + const now = new Date(); const reportTime = new Date(timestamp); const expirationTime = new Date(reportTime.getTime() + 24 * 60 * 60 * 1000); @@ -152,7 +156,11 @@ document.addEventListener('DOMContentLoaded', async () => { }; // Get CSS class for time remaining - const getRemainingClass = (timestamp) => { + const getRemainingClass = (timestamp, persistent = false) => { + if (persistent) { + return 'normal'; // Use normal styling for persistent reports + } + const now = new Date(); const reportTime = new Date(timestamp); const expirationTime = new Date(reportTime.getTime() + 24 * 60 * 60 * 1000);