fixing map timing errors and still trying to make leaderboard and clues pages.

Grey = cant click
Red = current
Green = complete
blue = skipped?

Need to add Clue page Need to fix Leaderboard.
This commit is contained in:
bobbert committed 2025-03-15 16:52:50 +00:00
1 parent 16319f1333
commit 30d88407a0
8 files changed
+597 -169

No files matched your search

+29 -3
View File
@@ -19,26 +19,52 @@ export const clearHuntTimer = () => {
localStorage.removeItem("teamHuntStartTime"); // Remove legacy timer as well
};
// Get the current hunt timer data
// Get the current hunt timer data with improved error handling
export const getHuntTimer = () => {
try {
// First try to get timer data from localStorage
const timerData = localStorage.getItem("huntTimerData");
if (!timerData) {
// Try to migrate from old format if exists
const legacyStartTime = localStorage.getItem("teamHuntStartTime");
if (legacyStartTime) {
return {
console.log("Using legacy team hunt start time");
const migratedData = {
startTime: legacyStartTime,
endTime: null,
isActive: true,
lastUpdated: new Date().toISOString(),
};
// Save the migrated data for future use
localStorage.setItem("huntTimerData", JSON.stringify(migratedData));
return migratedData;
}
console.log("No hunt timer data found");
return null;
}
return JSON.parse(timerData);
// Parse the timer data
const parsedData = JSON.parse(timerData);
// Validate the data has required fields
if (!parsedData || !parsedData.startTime) {
console.log("Invalid hunt timer data", parsedData);
return null;
}
return parsedData;
} catch (error) {
console.error("Error parsing hunt timer data:", error);
// Try to recover by clearing corrupt data
try {
localStorage.removeItem("huntTimerData");
} catch (e) {
// Ignore errors when trying to clean up
}
return null;
}
};