mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-08 03:50:21 +00:00
just need to fix the map to clue function.
This commit is contained in:
1 parent
727555e70f
commit
ea836179d6
6 files changed
+124
-43
No files matched your search
+13
-5
@@ -43,7 +43,7 @@ export default function MapPage() {
|
||||
window.location.href = url;
|
||||
}, []);
|
||||
|
||||
// Fetch team data for the current user
|
||||
// Enhanced fetchTeamData function
|
||||
const fetchTeamData = useCallback(async () => {
|
||||
try {
|
||||
const response = await fetch("/api/user/team", {
|
||||
@@ -71,6 +71,7 @@ export default function MapPage() {
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log("Team data loaded:", data);
|
||||
setTeamData(data);
|
||||
return data;
|
||||
} catch (err) {
|
||||
@@ -573,6 +574,13 @@ export default function MapPage() {
|
||||
});
|
||||
}, [mapSvg, clues, enhanceSvgMap]);
|
||||
|
||||
// Add useEffect to load team data
|
||||
useEffect(() => {
|
||||
if (status === "authenticated") {
|
||||
fetchTeamData();
|
||||
}
|
||||
}, [status, fetchTeamData]);
|
||||
|
||||
if (status === "loading" || loading) {
|
||||
return (
|
||||
<div className={styles["loading-container"]}>
|
||||
@@ -620,7 +628,7 @@ export default function MapPage() {
|
||||
{/* Map Banner with team info and timer */}
|
||||
<div className={styles["map-banner"]}>
|
||||
<div className={styles["team-name"]}>
|
||||
{teamData?.team?.name || "Your Team"}
|
||||
{teamData?.team?.name || "Loading..."}
|
||||
</div>
|
||||
<div className={styles["elapsed-time"]}>
|
||||
<span className={styles["time-value"]}>{elapsedTime}</span>
|
||||
@@ -667,9 +675,9 @@ export default function MapPage() {
|
||||
<div className={styles["nav-icon"]}>👥</div>
|
||||
<div className={styles["nav-label"]}>Team</div>
|
||||
</Link>
|
||||
<Link href="/team-selection" className={styles["nav-item"]}>
|
||||
<div className={styles["nav-icon"]}>🔙</div>
|
||||
<div className={styles["nav-label"]}>Back</div>
|
||||
<Link href="/leaderboard" className={styles["nav-item"]}>
|
||||
<div className={styles["nav-icon"]}>🏆</div>
|
||||
<div className={styles["nav-label"]}>Leaderboard</div>
|
||||
</Link>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user