fixing navbar

Adding Svg files and fixing appearance of navbar to look like the design pages
This commit is contained in:
bobbert committed 2025-03-23 12:54:05 +00:00
1 parent 5a20899808
commit c496b08d52
13 files changed
+438 -631

No files matched your search

+2 -25
View File
@@ -4,6 +4,7 @@ import { useSearchParams } from "next/navigation";
import { useRouter } from "next/navigation";
import { useSession } from "next-auth/react";
import Link from "next/link";
import NavBar from "@/components/NavBar";
export default function LeaderboardPage() {
const [teams, setTeams] = useState([]);
@@ -160,31 +161,7 @@ export default function LeaderboardPage() {
{/* Only show navigation bar when the hunt hasn't ended */}
{!huntJustEnded && (
<div className="nav-bar">
<Link href="/map" className="nav-item">
<div className="nav-icon">🗺️</div>
<div className="nav-label">Map</div>
</Link>
<Link href="/stats" className="nav-item">
<div className="nav-icon">📊</div>
<div className="nav-label">Stats</div>
</Link>
<Link
href={
session?.user?.teamId
? `/${session.user.teamId}`
: "/team-selection"
}
className="nav-item"
>
<div className="nav-icon">👥</div>
<div className="nav-label">Team</div>
</Link>
<Link href="/leaderboard" className="nav-item active">
<div className="nav-icon">🏆</div>
<div className="nav-label">Leaderboard</div>
</Link>
</div>
<NavBar activeLink="leaderboard" teamData={{ id: session?.user?.teamId }} />
)}
{/* Add a "back to home" button when the hunt has ended */}
+77 -382
View File
@@ -1,52 +1,68 @@
/* eslint-disable @next/next/no-img-element */
"use client";
import { useState, useEffect, useRef, useCallback } from "react";
import { useState, useEffect, useRef } from "react";
import { useSession } from "next-auth/react";
import { useRouter } from "next/navigation";
import Link from "next/link";
import Image from "next/image";
import styles from "./map.module.css";
import {
getHuntTimer,
setHuntTimer,
clearHuntTimer,
formatElapsedTime,
syncTimerWithServer,
} from "@/utils/timerService";
import NavBar from "@/components/NavBar";
export default function MapPage() {
const { data: session, status } = useSession();
const [loading, setLoading] = useState(true);
const [mapError, setMapError] = useState(false);
const [error, setError] = useState(null);
const [teamData, setTeamData] = useState(null);
const [elapsedTime, setElapsedTime] = useState("00:00:00");
const [clues, setClues] = useState([]);
const mapContainerRef = useRef(null);
const router = useRouter();
const isMounted = useRef(true);
// Add local state for hunt active status
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [mapLoaded, setMapLoaded] = useState(false);
const [huntActive, setHuntActive] = useState(null);
// Add previous hunt state to detect when hunt ends
const [previousHuntState, setPreviousHuntState] = useState(null);
const router = useRouter();
const mapRef = useRef(null);
// Use useCallback for functions called in useEffect to avoid dependency issues
const softRedirect = useCallback(
(url) => {
if (isMounted.current) {
router.push(url);
useEffect(() => {
// Redirect to login if not authenticated
if (status === "unauthenticated") {
router.push("/login");
return;
}
if (status === "authenticated") {
checkHuntStatus();
fetchTeamData();
}
}, [status, router]);
const checkHuntStatus = async () => {
try {
const timestamp = Date.now();
const response = await fetch(`/api/hunt-status?t=${timestamp}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-store, no-cache, must-revalidate",
Pragma: "no-cache",
},
[router]
);
credentials: "include",
});
// Hard redirect function (for when a full page reload is needed)
const hardRedirect = useCallback((url) => {
window.location.href = url;
}, []);
if (response.ok) {
const data = await response.json();
setHuntActive(data.active);
// Enhanced fetchTeamData function
const fetchTeamData = useCallback(async () => {
// Redirect to waiting page if hunt is not active
if (!data.active) {
router.push("/waiting");
return;
}
} else {
throw new Error("Failed to check hunt status");
}
} catch (err) {
console.error("Failed to check hunt status:", err);
setError("Failed to check if hunt is active. Please try again.");
setLoading(false);
}
};
const fetchTeamData = async () => {
try {
const response = await fetch("/api/user/team", {
method: "GET",
@@ -59,12 +75,12 @@ export default function MapPage() {
});
if (response.status === 401) {
softRedirect("/login");
router.push("/login");
return null;
}
if (response.status === 404) {
softRedirect("/team-selection");
router.push("/team-selection");
return null;
}
@@ -81,233 +97,17 @@ export default function MapPage() {
setError(err.message);
return null;
}
}, [softRedirect]);
// Fetch all clues with their status
const fetchClues = useCallback(async () => {
try {
const response = await fetch("/api/clues", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-cache, no-store, must-revalidate",
Pragma: "no-cache",
},
credentials: "include",
});
if (!response.ok) {
// Extract the error message from the response if possible
const errorData = await response.json().catch(() => ({}));
console.error("API response details:", {
status: response.status,
statusText: response.statusText,
errorData,
});
throw new Error(
errorData.error ||
`Failed to fetch clues: ${response.status} ${response.statusText}`
);
}
const data = await response.json();
// Process the clues to determine which are available
// A clue is available if it's either found already or the next in sequence
const processedClues = data.map((clue) => {
// The API now returns clues with availability already determined
return {
...clue,
available: clue.available || clue.found || clue.skipped,
};
});
setClues(processedClues);
setLoading(false); // Set loading to false after clues are fetched
return processedClues;
} catch (err) {
console.error("Failed to fetch clues:", err);
setError(err.message); // Make sure we set the error state
setLoading(false);
return [];
}
}, []);
// Handle clue button click
const handleClueClick = useCallback(
(clueId, isAvailable, isFound) => {
if (isFound || isAvailable) {
router.push(`/clue/${clueId}`);
} else {
alert("Complete previous clues to unlock this one!");
}
},
[router]
);
// Size and position the overlay to match the map image
const setupOverlay = useCallback(() => {
const overlay = document.getElementById("map-overlay-container");
const mapImg = document.getElementById("treasure-map-img");
if (overlay && mapImg) {
// Wait for the image to load to get its dimensions
mapImg.onload = () => {
const mapRect = mapImg.getBoundingClientRect();
overlay.style.width = `${mapRect.width}px`;
overlay.style.height = `${mapRect.height}px`;
};
// Handle resize events
const resizeOverlay = () => {
const mapRect = mapImg.getBoundingClientRect();
overlay.style.width = `${mapRect.width}px`;
overlay.style.height = `${mapRect.height}px`;
const handleMapLoad = () => {
setMapLoaded(true);
};
// Initial resize and listen for window resize
setTimeout(resizeOverlay, 300);
window.addEventListener("resize", resizeOverlay);
return () => {
window.removeEventListener("resize", resizeOverlay);
};
}
}, []);
// Add this useEffect to coordinate loading the map and clues
useEffect(() => {
if (status === "authenticated") {
fetchClues();
fetchTeamData();
} else if (status === "unauthenticated") {
softRedirect("/login");
}
// Setup cleanup function for component unmount
return () => {
isMounted.current = false;
};
}, [status, fetchClues, fetchTeamData, softRedirect]);
// Setup the overlay when the component is mounted
useEffect(() => {
if (!loading && clues.length > 0) {
return setupOverlay();
}
}, [loading, clues.length, setupOverlay]);
// Function to check hunt status and timer
async function checkHuntAndTimer() {
try {
const response = await fetch("/api/hunt-status", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-cache, no-store, must-revalidate",
Pragma: "no-cache",
},
credentials: "include",
});
if (response.ok) {
const data = await response.json();
setHuntActive(data.active);
// If hunt is active, ensure we have timer data
if (data.active && data.startTime) {
setHuntTimer(data.startTime);
}
}
} catch (err) {
console.error("Failed to check hunt status:", err);
}
}
// Add this function before it's used in initializeTimer
async function fetchTeamHuntStartTime() {
try {
// First try to get any existing timer data
const timerData = getHuntTimer();
if (timerData && timerData.startTime) {
return true;
}
// If no timer data exists, sync with server
const result = await syncTimerWithServer();
return result.success;
} catch (err) {
console.error("Error fetching team hunt start time:", err);
return false;
}
}
// Use team hunt start time for elapsed time calculation
useEffect(() => {
let timerId;
// Initialize timer
async function initializeTimer() {
// First ensure we have timer data
await fetchTeamHuntStartTime();
// Set up timer updates
const updateTimer = () => {
const timerData = getHuntTimer();
if (timerData && timerData.startTime) {
setElapsedTime(formatElapsedTime(timerData.startTime));
}
const handleMapError = () => {
setError("Failed to load the map. Please try again.");
};
// Initial update
updateTimer();
// Update every second
timerId = setInterval(updateTimer, 1000);
}
initializeTimer();
// Clean up interval on unmount
return () => {
if (timerId) clearInterval(timerId);
};
}, []);
// Check hunt status every 10 seconds to ensure immediate updates
useEffect(() => {
// Initial check
checkHuntAndTimer();
// Set up interval to check hunt status
const huntStatusInterval = setInterval(checkHuntAndTimer, 10000);
return () => {
clearInterval(huntStatusInterval);
};
}, [softRedirect, hardRedirect]);
// Add useEffect to load team data
useEffect(() => {
if (status === "authenticated") {
fetchTeamData();
}
}, [status, fetchTeamData]);
// Add this useEffect to detect when hunt ends
useEffect(() => {
// If previous state was active but current state is not active, the hunt just ended
if (previousHuntState === true && huntActive === false) {
console.log("Hunt has ended! Redirecting to leaderboard...");
router.push("/leaderboard?huntEnded=true");
}
// Update previous state after checking
setPreviousHuntState(huntActive);
}, [huntActive, previousHuntState, router]);
if (status === "loading" || loading) {
if (loading) {
return (
<div className={styles["loading-container"]}>
<div className={styles["loading-spinner"]}></div>
@@ -316,22 +116,6 @@ export default function MapPage() {
);
}
// Remove or modify this conditional block since we're now handling hunt ending differently
// Instead of showing an error message, we'll redirect in the useEffect
if (huntActive === false && previousHuntState === null) {
// Only show this if we just landed on the page and hunt is inactive
// (not when the hunt just ended)
return (
<div className={styles["map-error"]}>
<h2>Hunt Not Active</h2>
<p>The treasure hunt has not started yet.</p>
<button onClick={() => softRedirect("/waiting")}>
Go to Waiting Room
</button>
</div>
);
}
if (error) {
return (
<div className={styles["map-error"]}>
@@ -342,126 +126,37 @@ export default function MapPage() {
);
}
if (mapError) {
return (
<div className={styles["map-error"]}>
<h2>Error Loading Map</h2>
<p>We couldn't load the treasure map. Please try again.</p>
<button onClick={fetchClues}>Retry</button>
<div className={styles.mapPage}>
<div className={styles.mapHeader}>
<div className={styles.teamInfo}>
<h1 className={styles.teamName}>
{teamData?.team ? teamData.team.name : "Loading..."}
</h1>
<div className={styles.teamProgress}>
{teamData?.progress !== undefined
? `${teamData.progress}% Complete`
: "..."}
</div>
);
}
// Function to determine clue button class based on status
const getClueButtonClass = (clue) => {
if (clue.found) return `${styles["clue-button"]} ${styles["clue-found"]}`;
if (clue.skipped)
return `${styles["clue-button"]} ${styles["clue-skipped"]}`;
if (clue.available)
return `${styles["clue-button"]} ${styles["clue-available"]}`;
return `${styles["clue-button"]} ${styles["clue-locked"]}`;
};
// Get the first clue if it exists
const firstClue = clues.length > 0 ? clues[0] : null;
// Render a clue button only if the clue exists
const renderClueButton = (index, position) => {
if (index >= clues.length) return null; // Don't render if clue doesn't exist
const clue = clues[index];
return (
<button
key={clue.id}
className={getClueButtonClass(clue)}
onClick={() => handleClueClick(clue.id, clue.available, clue.found)}
style={{
left: position.left,
top: position.top,
}}
></button>
);
};
return (
<div className={styles["map-page"]}>
{/* Map Banner with team info and timer */}
<div className={styles["map-banner"]}>
<div className={styles["team-name"]}>
Team Name: {teamData?.team?.name || "Loading..."}
</div>
<div className={styles["elapsed-time"]}>
<span className={styles["time-value"]}>{elapsedTime}</span>
</div>
<div className={styles["team-code"]}>{teamData?.team?.code || ""}</div>
</div>
{/* Main map content area */}
<div className={styles["map-container"]} ref={mapContainerRef}>
<div className={styles["treasure-map"]}>
{/* Simpler map implementation using an img element */}
<div className={styles["map-image-container"]}>
<img
id="treasure-map-img"
<div className={styles.mapContainer}>
<div className={styles.treasureMap}>
<Image
src="/images/map.svg"
alt="Treasure Map"
className={styles["map-image"]}
layout="fill"
objectFit="contain"
onLoad={handleMapLoad}
onError={handleMapError}
ref={mapRef}
/>
<div id="map-overlay-container" className={styles["map-overlay"]}>
{/* Render clue buttons conditionally */}
{renderClueButton(0, { left: "230px", top: "212px" })}
{renderClueButton(1, { left: "320px", top: "285px" })}
{renderClueButton(2, { left: "265px", top: "400px" })}
{renderClueButton(3, { left: "343px", top: "520px" })}
{renderClueButton(4, { left: "320px", top: "646px" })}
{renderClueButton(5, { left: "298px", top: "774px" })}
{renderClueButton(6, { left: "240px", top: "880px" })}
{renderClueButton(7, { left: "355px", top: "960px" })}
{renderClueButton(8, { left: "266px", top: "1037px" })}
{renderClueButton(9, { left: "280px", top: "1175px" })}
{renderClueButton(10, { left: "336px", top: "1303px" })}
{renderClueButton(11, { left: "250px", top: "1390px" })}
{renderClueButton(12, { left: "165px", top: "1485px" })}
{renderClueButton(13, { left: "305px", top: "1530px" })}
{renderClueButton(14, { left: "340px", top: "1650px" })}
{renderClueButton(15, { left: "225px", top: "1725px" })}
{renderClueButton(16, { left: "220px", top: "1820px" })}
{renderClueButton(17, { left: "275px", top: "1885px" })}
{renderClueButton(18, { left: "362px", top: "1917px" })}
{renderClueButton(19, { left: "300px", top: "2040px" })}
{/* Additional clue buttons can be added here when needed */}
</div>
</div>
</div>
</div>
{/* Navigation bar */}
<nav className={styles["nav-bar"]}>
<Link
href="/map"
className={`${styles["nav-item"]} ${styles["active"]}`}
>
<div className={styles["nav-icon"]}>🗺️</div>
<div className={styles["nav-label"]}>Map</div>
</Link>
<Link href="/stats" className={styles["nav-item"]}>
<div className={styles["nav-icon"]}>📊</div>
<div className={styles["nav-label"]}>Stats</div>
</Link>
<Link
href={teamData?.team ? `/${teamData.team.id}` : "/team-selection"}
className={styles["nav-item"]}
>
<div className={styles["nav-icon"]}>👥</div>
<div className={styles["nav-label"]}>Team</div>
</Link>
<Link href="/leaderboard" className={styles["nav-item"]}>
<div className={styles["nav-icon"]}>🏆</div>
<div className={styles["nav-label"]}>Leaderboard</div>
</Link>
</nav>
{/* Replace hardcoded navbar with NavBar component */}
<NavBar activeLink="map" teamData={teamData?.team} />
</div>
);
}
+45 -21
View File
@@ -4,6 +4,7 @@ import { useSession } from "next-auth/react";
import { useRouter } from "next/navigation";
import Link from "next/link";
import styles from "./stats.module.css";
import NavBar from "@/components/NavBar";
export default function StatsPage() {
const { data: session, status } = useSession();
@@ -11,6 +12,7 @@ export default function StatsPage() {
const [error, setError] = useState(null);
const [teamStats, setTeamStats] = useState(null);
const [expanded, setExpanded] = useState(false);
const [huntActive, setHuntActive] = useState(null);
const router = useRouter();
useEffect(() => {
@@ -22,9 +24,34 @@ export default function StatsPage() {
if (status === "authenticated") {
fetchTeamStats();
checkHuntStatus();
}
}, [status, router]);
// Check hunt status but don't redirect
const checkHuntStatus = async () => {
try {
const timestamp = Date.now();
const response = await fetch(`/api/hunt-status?t=${timestamp}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-store, no-cache, must-revalidate",
Pragma: "no-cache",
},
credentials: "include",
});
if (response.ok) {
const data = await response.json();
setHuntActive(data.active);
// We're just checking status, no redirect needed for stats page
}
} catch (err) {
console.error("Failed to check hunt status:", err);
}
};
const fetchTeamStats = async () => {
try {
setLoading(true);
@@ -181,6 +208,12 @@ export default function StatsPage() {
<h2 className={styles.teamName}>{teamStats.team.name}</h2>
</div>
{!huntActive && teamStats && (
<div className="hunt-inactive-banner">
<p>The treasure hunt is not currently active. Team progress will be visible here once the hunt begins.</p>
</div>
)}
<div className={styles.statsCard}>
<div className={styles.summaryStats}>
<div className={styles.statItem}>
@@ -229,27 +262,8 @@ export default function StatsPage() {
</div>
</div>
<div className={styles.navBar}>
<Link href="/map" className={styles.navItem}>
<div className={styles.navIcon}>🗺️</div>
<div className={styles.navLabel}>Map</div>
</Link>
<Link href="/stats" className={`${styles.navItem} ${styles.active}`}>
<div className={styles.navIcon}>📊</div>
<div className={styles.navLabel}>Stats</div>
</Link>
<Link
href={teamStats?.team ? `/${teamStats.team.id}` : "/team-selection"}
className={styles.navItem}
>
<div className={styles.navIcon}>👥</div>
<div className={styles.navLabel}>Team</div>
</Link>
<Link href="/leaderboard" className={styles.navItem}>
<div className={styles.navIcon}>🏆</div>
<div className={styles.navLabel}>Leaderboard</div>
</Link>
</div>
{/* Replace hardcoded navbar with NavBar component */}
<NavBar activeLink="stats" teamData={teamStats.team} />
<style jsx>{`
.clue-icon.found {
@@ -259,6 +273,16 @@ export default function StatsPage() {
.clue-icon.skipped {
background-color: #1976d2;
}
.hunt-inactive-banner {
background-color: #fff3cd;
color: #856404;
padding: 12px 15px;
margin: 15px 20px 0;
border-radius: 4px;
text-align: center;
font-size: 0.9rem;
}
`}</style>
</div>
);
+69 -13
View File
@@ -135,6 +135,43 @@ export default function TeamPage({ params }) {
}
}, [effectiveTeamId, status, fetchTeamData, router]);
const continueTreasureHunt = async (e) => {
e.preventDefault();
setLoading(true);
try {
// Check if hunt is active first
const timestamp = Date.now();
const response = await fetch(`/api/hunt-status?t=${timestamp}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-store, no-cache, must-revalidate",
Pragma: "no-cache",
},
credentials: "include",
});
if (response.ok) {
const data = await response.json();
if (data.active) {
// Hunt is active, redirect to map
router.push("/map");
} else {
// Hunt is not active, redirect to waiting page
router.push("/waiting");
}
} else {
throw new Error("Failed to check hunt status");
}
} catch (err) {
console.error("Error checking hunt status:", err);
setError("Failed to check hunt status. Please try again.");
setLoading(false);
}
};
if (status === "loading" || loading) {
return (
<div className="loading-container">
@@ -341,28 +378,47 @@ export default function TeamPage({ params }) {
)}
</div>
{/* Replace the outdated navbar with this consistent design */}av-bar"]}>
<div className="nav-bar">v-item"]}>
<Link href="/map" className="nav-item">>🗺️</div>
<div className="nav-icon">🗺️</div>>Map</div>
{team && team.hasStarted && (
<div className="button-container">
<button
className="continue-button"
onClick={continueTreasureHunt}
disabled={loading}
>
{loading ? "Loading..." : "Continue Hunt"}
</button>
</div>
)}
<div className="nav-bar">
<div className="nav-item">
<Link href="/map" className="nav-item">
<div className="nav-icon">🗺️</div>
<div className="nav-label">Map</div>
</Link>v-item"]}>
<Link href="/stats" className="nav-item">}>📊</div>
<div className="nav-icon">📊</div>tats</div>
</Link>
</div>
<div className="nav-item">
<Link href="/stats" className="nav-item">
<div className="nav-icon">📊</div>
<div className="nav-label">Stats</div>
</Link>
</div>
<div className="nav-item">
<Link
href={teamData ? `/${teamData.id}` : "/team-selection"} tem"]} ${styles["active"]}`}
href={teamData ? `/${teamData.id}` : "/team-selection"}
className="nav-item active"
>}>👥</div>
<div className="nav-icon">👥</div>Team</div>
>
<div className="nav-icon">👥</div>
<div className="nav-label">Team</div>
</Link>v-item"]}>
<Link href="/leaderboard" className="nav-item">}>🏆</div>
<div className="nav-icon">🏆</div>oard</div>
</Link>
</div>
<div className="nav-item">
<Link href="/leaderboard" className="nav-item">
<div className="nav-icon">🏆</div>
<div className="nav-label">Leaderboard</div>
</Link>
</div>
</div>
<style jsx>{`
.team-page {
+29 -6
View File
@@ -126,12 +126,18 @@ p {
.nav-bar {
display: flex;
justify-content: space-around;
background-color: #f8f8f8;
background-image: url("/images/Bottom-Bar.svg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
border-top: 1px solid #ddd;
padding: 0.75rem 0;
position: sticky;
position: fixed;
bottom: 0;
width: 110%;
left: 0;
width: 100%;
box-sizing: border-box;
z-index: 100;
}
.nav-item {
@@ -139,10 +145,28 @@ p {
flex-direction: column;
align-items: center;
color: #777;
text-decoration: none;
flex: 1;
max-width: 25%;
}
.nav-item.active {
color: #68543c;
font-weight: bold;
}
.nav-icon {
font-size: 1.5rem;
margin-bottom: 4px;
}
.nav-label {
font-size: 0.75rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
text-align: center;
}
/* Team Selection Page */
@@ -342,7 +366,6 @@ p {
margin-bottom: 1rem;
}
/* Team Header */
.team-header {
position: sticky;
@@ -385,8 +408,8 @@ p {
display: inline-block;
padding: 10px 15px;
border-radius: 4px;
margin-top: 0.50rem;
margin-bottom: 0.50rem;
margin-top: 0.5rem;
margin-bottom: 0.5rem;
text-decoration: none;
text-align: center;
width: 100%;
+159 -161
View File
@@ -1,207 +1,205 @@
"use client";
import { useEffect, useState } from "react";
import { useRouter } from "next/navigation";
import { useState, useEffect } from "react";
import { useSession } from "next-auth/react";
import styles from "./waiting.module.css";
import { setHuntTimer, clearHuntTimer } from "@/utils/timerService";
import { useRouter } from "next/navigation";
import Link from "next/link";
export default function WaitingPage() {
const router = useRouter();
const { status } = useSession();
const { data: session, status } = useSession();
const [huntActive, setHuntActive] = useState(false);
const [huntEnded, setHuntEnded] = useState(false);
const [loading, setLoading] = useState(true);
const [lastHuntData, setLastHuntData] = useState(null);
const router = useRouter();
// Check hunt status VERY aggressively
// Check hunt status at regular intervals
useEffect(() => {
let redirectAttempted = false;
let lastKnownHuntStatus = false;
let lastHuntData = null;
async function checkHuntStatus() {
if (redirectAttempted) return;
const checkHuntStatus = async () => {
try {
// First check if we have a team ID from the session
const userResponse = await fetch("/api/user", {
method: "GET",
headers: {
"Cache-Control": "no-store, no-cache, must-revalidate",
Pragma: "no-cache",
},
credentials: "include",
});
if (userResponse.ok) {
const userData = await userResponse.json();
// If user has a team, check if that team has an active hunt session
if (userData.teamId) {
const teamHuntResponse = await fetch(
`/api/teams/${userData.teamId}/hunt-session`,
{
method: "GET",
headers: {
"Cache-Control": "no-store, no-cache, must-revalidate",
Pragma: "no-cache",
},
credentials: "include",
}
);
// If team has an active hunt session, redirect to map
if (teamHuntResponse.ok) {
const teamHuntData = await teamHuntResponse.json();
if (teamHuntData.startTime) {
// Store the start time in the centralized timer service
setHuntTimer(teamHuntData.startTime);
console.log("Team hunt is active! Redirecting to map...");
redirectAttempted = true;
lastKnownHuntStatus = true;
// Show loading screen and redirect
document.body.innerHTML =
'<div style="display:flex;justify-content:center;align-items:center;height:100vh;font-family:sans-serif;"><div style="text-align:center"><div style="font-size:24px">Loading Map...</div><div style="margin-top:20px">Please wait...</div></div></div>';
window.location.href = "/map";
return;
}
}
}
}
// Fall back to checking the global hunt status
const timestamp = Date.now();
const globalResponse = await fetch(`/api/hunt-status?_t=${timestamp}`, {
const response = await fetch(`/api/hunt-status?t=${timestamp}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-store, no-cache, must-revalidate",
Pragma: "no-cache",
},
credentials: "include",
});
if (globalResponse.ok) {
const data = await globalResponse.json();
console.log("Hunt status check result:", data);
// Store the most recent hunt data to determine if hunt ended
if (lastHuntData && lastHuntData.active && !data.active) {
// Hunt was active before but now it's not - it has ended
console.log("Hunt has ended! Showing leaderboard...");
setHuntEnded(true);
// Clear any timer data
clearHuntTimer();
// Redirect to leaderboard after a brief delay
setTimeout(() => {
window.location.href = "/leaderboard?huntEnded=true";
}, 2000);
return;
}
// If this is a new session but we detect signs of a hunt that ended
if (!lastHuntData && !data.active && data.startTime && data.endTime) {
// Handle case where user lands directly on waiting page after hunt ended
console.log("Hunt appears to have already ended");
setHuntEnded(true);
// Redirect to leaderboard after a brief delay
setTimeout(() => {
window.location.href = "/leaderboard?huntEnded=true";
}, 2000);
return;
}
// Save the current hunt data for next comparison
lastHuntData = data;
if (data.active) {
// Store the global start time in the centralized timer service
if (data.startTime) {
setHuntTimer(data.startTime, data.endTime);
}
console.log("Hunt is active! Redirecting immediately...");
redirectAttempted = true;
lastKnownHuntStatus = true;
// Show loading screen during redirect
document.body.innerHTML =
'<div style="display:flex;justify-content:center;align-items:center;height:100vh;font-family:sans-serif;"><div style="text-align:center"><div style="font-size:24px">Loading Map...</div><div style="margin-top:20px">Please wait...</div></div></div>';
window.location.href = "/map";
return;
}
if (response.ok) {
const data = await response.json();
setHuntActive(data.active);
// If hunt becomes active, redirect to map
if (data.active) {
router.push("/map");
}
}
setLoading(false);
} catch (err) {
console.error("Error checking hunt status:", err);
console.error("Failed to check hunt status:", err);
setLoading(false);
}
}
};
// Check immediately and very frequently
// Check status immediately
checkHuntStatus();
const intervalId = setInterval(checkHuntStatus, 500); // Check every 500ms
// Set up regular polling
const intervalId = setInterval(checkHuntStatus, 5000);
// Clean up on unmount
return () => clearInterval(intervalId);
}, []);
}, [router]);
// Redirect to login if not authenticated
useEffect(() => {
if (status === "unauthenticated") {
router.push("/login");
return null;
}
}, [status, router]);
if (loading) {
return (
<div className={styles.container}>
<div className={styles.spinner}></div>
<h2>Loading...</h2>
<div className="loading-container">
<div className="loading-spinner"></div>
<p>Loading...</p>
</div>
);
}
return (
<div className={styles.container}>
{huntEnded ? (
<>
<h1>Hunt Has Ended</h1>
<p>
The treasure hunt has ended. You can view the results on the
leaderboard.
</p>
<div className={styles.endedMessage}>
<p>Hunt Complete!</p>
<button onClick={() => router.push("/leaderboard?huntEnded=true")}>
View Results
</button>
<div className="waiting-page">
<div className="waiting-card">
<div className="waiting-icon">⏳</div>
<h1>Hunt Not Started Yet</h1>
<p>The treasure hunt has not been activated by the organizers yet.</p>
<p>This page will automatically update when the hunt begins.</p>
<div className="waiting-animation">
<div className="pulse"></div>
</div>
</>
) : (
<>
<h1>Waiting for Hunt to Start</h1>
<p>
The treasure hunt has not started yet. Please wait for the
administrator to start the hunt.
</p>
<div className={styles.waitingAnimation}>⏳</div>
{huntActive && (
<div className={styles.startedMessage}>
<p>The hunt has started!</p>
<button onClick={() => router.push("/map")}>Go to Map</button>
<div className="waiting-buttons">
<Link
href={`/${session?.user?.teamId || ""}`}
className="team-button"
>
Back to Team Page
</Link>
</div>
)}
</>
)}
</div>
<style jsx>{`
.waiting-page {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
background-color: #f4e9dc;
padding: 1rem;
}
.waiting-card {
background-color: white;
border-radius: 8px;
padding: 2rem;
text-align: center;
max-width: 500px;
width: 100%;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.waiting-icon {
font-size: 3rem;
margin-bottom: 1rem;
}
h1 {
color: #68543c;
margin-bottom: 1rem;
}
p {
color: #555;
margin-bottom: 1rem;
}
.waiting-animation {
margin: 2rem 0;
display: flex;
justify-content: center;
}
.pulse {
width: 60px;
height: 60px;
background-color: rgba(104, 84, 60, 0.3);
border-radius: 50%;
position: relative;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% {
transform: scale(0.8);
opacity: 0.8;
}
50% {
transform: scale(1.2);
opacity: 0.4;
}
100% {
transform: scale(0.8);
opacity: 0.8;
}
}
.waiting-buttons {
margin-top: 2rem;
}
.team-button {
display: inline-block;
background-color: #68543c;
color: white;
padding: 0.75rem 1.5rem;
border-radius: 4px;
text-decoration: none;
font-weight: bold;
transition: background-color 0.2s;
}
.team-button:hover {
background-color: #53402d;
}
.loading-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
.loading-spinner {
border: 4px solid #f3f3f3;
border-top: 4px solid #68543c;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin-bottom: 20px;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
`}</style>
</div>
);
}
BIN
View File
Binary file not shown.
+15 -23
View File
@@ -35,7 +35,7 @@ export default function NavBar({ activeLink, teamData }) {
checkHuntStatus();
}, []);
// Handle map link click
// Handle map link click - only redirect for map page
const handleMapClick = (e) => {
if (huntActive === false) {
e.preventDefault();
@@ -44,46 +44,38 @@ export default function NavBar({ activeLink, teamData }) {
};
return (
<nav className={styles["nav-bar"]}>
<nav className="nav-bar">
<Link
href="/map"
className={`${styles["nav-item"]} ${
activeLink === "map" ? styles["active"] : ""
}`}
className={`nav-item ${activeLink === "map" ? "active" : ""}`}
onClick={handleMapClick}
>
<div className={styles["nav-icon"]}>🗺️</div>
<div className={styles["nav-label"]}>Map</div>
<div className="nav-icon">🗺️</div>
<div className="nav-label">Map</div>
</Link>
<Link
href="/stats"
className={`${styles["nav-item"]} ${
activeLink === "stats" ? styles["active"] : ""
}`}
className={`nav-item ${activeLink === "stats" ? "active" : ""}`}
>
<div className={styles["nav-icon"]}>📊</div>
<div className={styles["nav-label"]}>Stats</div>
<div className="nav-icon">📊</div>
<div className="nav-label">Stats</div>
</Link>
<Link
href={teamData?.team ? `/${teamData.team.id}` : "/team-selection"}
className={`${styles["nav-item"]} ${
activeLink === "team" ? styles["active"] : ""
}`}
href={teamData?.id ? `/${teamData.id}` : "/team-selection"}
className={`nav-item ${activeLink === "team" ? "active" : ""}`}
>
<div className={styles["nav-icon"]}>👥</div>
<div className={styles["nav-label"]}>Team</div>
<div className="nav-icon">👥</div>
<div className="nav-label">Team</div>
</Link>
<Link
href="/leaderboard"
className={`${styles["nav-item"]} ${
activeLink === "leaderboard" ? styles["active"] : ""
}`}
className={`nav-item ${activeLink === "leaderboard" ? "active" : ""}`}
>
<div className={styles["nav-icon"]}>🏆</div>
<div className={styles["nav-label"]}>Leaderboard</div>
<div className="nav-icon">🏆</div>
<div className="nav-label">Leaderboard</div>
</Link>
</nav>
);
+6
View File
@@ -0,0 +1,6 @@
<svg width="402" height="89" viewBox="0 0 402 89" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0H402V89H0V0Z" fill="#A1887F"/>
<line x1="97.5" y1="2" x2="97.5" y2="87" stroke="#917A72" stroke-width="3"/>
<line x1="200.5" y1="2" x2="200.5" y2="87" stroke="#917A72" stroke-width="3"/>
<line x1="302.5" y1="2" x2="302.5" y2="87" stroke="#917A72" stroke-width="3"/>
</svg>

After

Width:  |  Height:  |  Size: 384 B

+9
View File
@@ -0,0 +1,9 @@
<svg width="43" height="42" viewBox="0 0 43 42" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<rect width="42.9618" height="42" fill="url(#pattern0_217_89)"/>
<defs>
<pattern id="pattern0_217_89" patternContentUnits="objectBoundingBox" width="1" height="1">
<use xlink:href="#image0_217_89" transform="matrix(0.01 0 0 0.010229 0 -0.0114504)"/>
</pattern>
<image id="image0_217_89" width="100" height="100" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAABbVJREFUeAHtnFvofFMUxz8uud8iRJSQEg+IkpKk3EkppVBKXj16k0flyZOkPFBKKUqRFCXlUpI8yIP7JYTc77fZf7Nyfud39l77t9eZ9TszZ52a1sxea+313d/vnj37nJkzEEcwEAxsNgOXAa8tH+l5HLvEwF7AncBfwD/Lx9/APcDeu4RptmUPA57oCCGCiH0aOHK27DgP/Czg3YIYIsqHwHnO2GZX7ibgpwoxRJRfgNtmx5LDgPcH7tuBECKI2IeBAx1wzqLECcDLBjFElNeBk2bB2AoHeRHw+QhiiChfAZeuEO/Gdp22tHcAf4wohojy54K1uyu2xhJfazdWjEOBx1cgRJ/Yp4AjCiz247XXha7W13Um8I6DGEJuqpVqDh139U46JSdnh/pY67YbgR8dxRBi09b41gxzFwNfVGLKdLF+zfsuL3cIQbtlHwD2G6DvROCVClEGUtev6Rjg+YrBeon0EnD8AI0150EDaevVdCHw2YTEENG/BC7JUHlL4UpBJmU9mm8Hfp+gGCJK2m6nK8lp+90/zgbeG8Dej1uL14cAjw0MRoiYmn0SOHyA2aOAZ3rjGAibdtNpwFu9QUxNgCE8aWt8xgC1/e9jBkKm23Qt8O0aiiEC/QDckKH3SuCbjG9yzWlLey+QvsmTwa2rTWNIY0lj6h+n9Bum+Ppo4LkNEKI/gV4Ejpsi4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gos3e0NWOrpyGwRUsfb2lDHkhVLlsxY80xSOpA63laBpbu9AUs9HZktQup4WxvqWLJiyZIZa55JSgdSx9sqsHR3/78YvQagI7NFeI2jW+cjG+T/stPfjaeOuh17PB8De6kPjzF0ayQOd/TfiiXw4QsGgoFgIBgIBoKBYCAY2AkD/wIbcQPPmO8aMAAAAABJRU5ErkJggg=="/>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

+9
View File
@@ -0,0 +1,9 @@
<svg width="59" height="56" viewBox="0 0 59 56" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<rect x="0.923584" width="57.2824" height="56" fill="url(#pattern0_217_91)"/>
<defs>
<pattern id="pattern0_217_91" patternContentUnits="objectBoundingBox" width="1" height="1">
<use xlink:href="#image0_217_91" transform="matrix(0.01 0 0 0.010229 0 -0.0114504)"/>
</pattern>
<image id="image0_217_91" width="100" height="100" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAABRBJREFUeAHtnFvIPVMYhx/kVI5/pwjlnKJIiQsixyhnIvkjolCKcqFcONyIC4WEC6VILiQhIYdyQyE55MYNkiiEnE/f72uP3j1m9jeHPfPNWn5T057D/uZ73+eZNbNmrTUbPJmACZiACZiACZiACZiACZiACZiACZiACZiACZiACZiACWRAYE/gAuCqic+KUbFmPV0N/Ar8ncj8C6CYs5z2B35LREQ8YRTzfjkauSxBGYWYS3MUclrCQk7NUcgWwLsJSnkH2DxHIcppA3Af8EkCYhSjYlXM2U9nJSBEMf5vJguZmGoLsZDWD6O+ZE3svmIhHYT8DDwMXAs8APzR4RjFw1/500Jawny2ovHv7pbHKEuI6xbSEKZKwTU198QzGh4jgq9btpCGMF8IMvQEvV1YVxNHHeC22y2kIcxPgUOBE2dNMUfnLGRT4ADgiIHnGxvCb3JWZyvkBODzJYJqAnMZ38lSyG7AtwnKkNAsh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R6mId7DndSavSNflem1bQT8JZLytKvFGpy6fxbwFsDavcv9wWkdGmYSqxieOeit23bFBe913Hl7Jee1X3puTkDNURq3NYubYD7uyZgAiZgAiZgAiZgAiZgAiZgAiZgAiZgAiZgAiZgAiZgAiZgAiZgAiZgAiZgAvME/gESCtM3G1YA3wAAAABJRU5ErkJggg=="/>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

+9
View File
@@ -0,0 +1,9 @@
<svg width="59" height="57" viewBox="0 0 59 57" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<rect width="58.3053" height="57" fill="url(#pattern0_217_92)"/>
<defs>
<pattern id="pattern0_217_92" patternContentUnits="objectBoundingBox" width="1" height="1">
<use xlink:href="#image0_217_92" transform="matrix(0.01 0 0 0.010229 0 -0.0114504)"/>
</pattern>
<image id="image0_217_92" width="100" height="100" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAABA1JREFUeAHtnE3I1EYchx+tH8UqfoCCh1o/oIoV7UGxKLSgvXjpyQoKoggqCFoUvOhJL9KrICJ6kKIiSmnVQ0Gpii0UReypolhRVPw4aKUHvwrV/WmGF8Our9nNZmd3fn8I2ewm2ZnnySSZyWTAYQImYAImYAImYAImYAImYAImYAImYAImYAImYAImYAImYAImYAImYAImYAImYAImYAImYAImYAImYAImYAImYALlEBgEjM4mfXZUSGAAMB/YDvwK3ANe5qa72W/bgHmAtnGUTGA4sAm4noOfl1FvWdtsBD4qOU1J7k5H9wrgQRMi8nLu14Qud4lp/jgaCRwtQURezHFgTPPJSnPLicDVNsgIcnQam5Im2uK5/gS400YZQcptYELx5KW1hU5TVyqQEaRcBkakhbhYbo9UKCNIOVQsiemsvbgDMoKUb9LB/H45HQLc7KAQXeQHv19S01hrVQdlhFKi+o4jI3AhAiF/2MYbAp9GICOUksmWAusiErLWQuBAREJ+sBC4GJGQ8xZS/5lGOKdXPVeTTfLxb0QlRGlJPh5HJORR8jaAWxEJUWtB8nEuIiFnkrcB7I5IyC4LgaURCVliITAWeBGBlOd+1t53OB6LQMhPfcnxp4URCPnSGt4m0Mm7LfWCdOQIzAT+60BJ0fXrs1xavJgR2NIBIZtNvzGBgcCPFUpRLxd3xm7s4/UvH9Z6uJ+qQMpJYGg/afHPGQGBOtxGKeqLpZ4ujgIEdCr5DnhaopgnwPoCafCqdQioU7Qqjv+3IEbbquLnTgx1ADf71efAPqDI85N/gL01GbOa/VNv1z8BXV++qtVZtgIHgd+AP7NJn/WdflPN29eJ/nl6DRMwARMwARMwARMwgagIjMpudzdk9RFVFs9mt7s3au+za9Ltr777Oat/qFau21+9u+hokYDGLdGTxJ3A3y3U0kN31GvZvhYAHhOlgJw5wP5am9PDEiQEGfm59q3/mF0gXUmtqucgXwMn2ighLyUs/w58C3yQFPF3ZFanpb86ICIICXOlQWlJNsbXWl/1gkwrrbgBZplzldLkRnhYUxtuKabXEPJClbbVKRQVPZ5Vc3geQKzLKsHDelXMx4BeGYsVfqN0XQIm9ZqUaYCG3muU6di/1wBqM3pFSrfLCAdLT0jpFRk9IWVcRQORBVhVzTXwmfLWVaFarzqiVQWp6v853W3tYd/3sIwgf0e3FJFFEda+A8Qy52phUF6jDnW7aedoomUCLWNfGvhMld1oY1kCp6q8yJXR2gB+SVCInlBGGXqmEXODYf7ILmv5WayvNahTdFmZ7Lb9TI+xiMxNWMgXMQqZmrAQjRsZZexJUIryHHXo9WaNUq2OA708KY/Kq8METMAETMAEoiDwCl6HggQTMLsEAAAAAElFTkSuQmCC"/>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

+9
View File
@@ -0,0 +1,9 @@
<svg width="47" height="45" viewBox="0 0 47 45" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<rect width="46.0305" height="45" fill="url(#pattern0_217_90)"/>
<defs>
<pattern id="pattern0_217_90" patternContentUnits="objectBoundingBox" width="1" height="1">
<use xlink:href="#image0_217_90" transform="matrix(0.01 0 0 0.010229 0 -0.0114504)"/>
</pattern>
<image id="image0_217_90" width="100" height="100" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAABhdJREFUeAHtnTfoLUUUxj8TWhgQ5amNGBpBEQsrsX2FzTMrxs4IomB4vifow0oQO0EMvQlULFVQRCsTiKE1VSYQERVM/x/u4jBv9+6ZubOzwTOw3N29M2fmfN+eiWd2JQ+OgCPgCDgCjoAj4Ag4Ao6AI+AIOAKOgCPgCDgCjsD/A4FjJV0pae/Ixy2SztgC0jMlIWPscl4hCUwmCTdK+lHS35WOPyU9JemoBG2J+7Qk0tYq5w+SbkgoY5GokFFLwTifVyQdYtCCOK9OWM7rDWUsEgWTrGkZMSFcX2zQ5NIJyaCMWMoxhnJuHeWqiRVF2ecNWrw4g3LSpowe9s1A0Q8NWhKny7pq3gOr0cOBGSj6iUFL4tQEvysvsBo9OCF2op2Q4HF0C6lYRXiVFTx51irrr6Z7TBfZevxmJLUkIeRpLV8bD9262oz43qyqrG8DEq2njxsVLUkIeaYGdIvB77p2QgJkrW2IExKAFp+6hcSIGK6tbYhXWZJXWcED5VVW1NC5hbiFBPYhuYW4hRzUFfY2JLARtxC3ELeQwCAOOnULcQuZt4X8KunJxMP6VBNvKKTISi0nunXNXcX3ZtWox4UreV2SkJLlimU5IYHZWC0kBrHktRPihNjq0pJPHbK8ygqevAeNDVppEkJ5Hwfl6TslTphminOwGj3gtDyFcmGerxm0fH0G5bzJUM6to+CFXtN5OSSiPb/boMW9ExPyh6TTDeUsEgUv9Bac2r9fSDraoAV+tV9OWM4nDGUsFgU3f7zQpyDj7AQtzpmIlJcSt00kqNQfFXd/vNCfk/SepPdHPGgzqKYslhGXmDT3SELGmGUEA7DYExfArx0BR8ARcAQcAUfAEXAEHAFHwBFYKwIMDC9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