mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-07 19:50:20 +00:00
fixed elapsed timer on clue page cannot fix it on admin page. I am done. now to move on to the styling to match UI
This commit is contained in:
1 parent
4cd449c0cf
commit
8fd2cabbe0
10 files changed
+226
-136
No files matched your search
+25
-2
@@ -154,18 +154,41 @@ export const syncTimerWithServer = async () => {
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log("Timer sync: Server returned data:", data);
|
||||
|
||||
// Don't change timer if we already have it and server confirms it's active
|
||||
const existingTimer = getHuntTimer();
|
||||
if (existingTimer && existingTimer.startTime && data.active) {
|
||||
console.log("Timer sync: Using existing timer data, confirmed by server");
|
||||
return {
|
||||
success: true,
|
||||
data: {
|
||||
startTime: existingTimer.startTime,
|
||||
endTime: existingTimer.endTime || data.endTime,
|
||||
active: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
if (data.active && data.startTime) {
|
||||
setHuntTimer(data.startTime, data.endTime);
|
||||
console.log(
|
||||
"Timer sync: Setting timer with startTime:",
|
||||
new Date(data.startTime).toISOString()
|
||||
);
|
||||
|
||||
// Ensure isActive is explicitly true
|
||||
setHuntTimer(data.startTime, data.endTime, true);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: {
|
||||
startTime: data.startTime,
|
||||
endTime: data.endTime,
|
||||
active: data.active,
|
||||
active: true,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
console.log("Timer sync: Clearing timer as server reports inactive");
|
||||
clearHuntTimer();
|
||||
return { success: true, data: null };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user