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
This commit is contained in:
Deco Vander 2025-07-03 01:32:28 -04:00
parent 12fd378e8c
commit a8a5523dd4

View file

@ -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);