edit of teamID page

using a long-wave format to fix issue with repeating patterns not lining up.
This commit is contained in:
bobbert committed 2025-03-23 17:16:20 +00:00
1 parent 6ecbe78718
commit 4d67951956
10 files changed
+286 -219

No files matched your search

+131 -112
View File
@@ -3,11 +3,9 @@ import { useState, useEffect, useCallback } from "react";
import { useSession } from "next-auth/react";
import { useRouter } from "next/navigation";
import Link from "next/link";
import { use } from "react"; // Add this import for React.use()
import { use } from "react";
import NavBar from "@/components/NavBar";
import { getHuntTimer } from "@/utils/timerService";
// Remove the CSS module import
// import styles from "./teamId.module.css";
export default function TeamPage({ params }) {
const { status, data: session } = useSession();
@@ -19,11 +17,9 @@ export default function TeamPage({ params }) {
const [huntInProgress, setHuntInProgress] = useState(false);
const router = useRouter();
// Unwrap the params Promise using React.use()
const unwrappedParams = use(params);
const teamId = unwrappedParams.teamId;
// Add a function to check if the hunt has been activated by admin
const checkHuntStatus = useCallback(async () => {
try {
const response = await fetch("/api/hunt-status", {
@@ -47,7 +43,6 @@ export default function TeamPage({ params }) {
throw new Error("Invalid team ID");
}
// First check if the user is still part of this team by fetching current user data
const userResponse = await fetch("/api/user", {
method: "GET",
headers: {
@@ -59,7 +54,6 @@ export default function TeamPage({ params }) {
const userData = await userResponse.json();
// If the user is not in this team anymore, redirect to team selection
if (!userData.teamId || userData.teamId != teamId) {
console.log("User no longer in team, redirecting to team selection");
window.location.href = "/team-selection";
@@ -68,7 +62,6 @@ export default function TeamPage({ params }) {
console.log("Fetching team data for team ID:", teamId);
// Add timestamp to URL to ensure fresh data on every request
const timestamp = new Date().getTime();
const response = await fetch(`/api/teams/${teamId}?_t=${timestamp}`, {
method: "GET",
@@ -106,12 +99,10 @@ export default function TeamPage({ params }) {
setTeamMembers(data.members || []);
setError("");
// Check hunt status whenever we fetch team data
await checkHuntStatus();
} catch (err) {
console.error("Team page error:", err);
setError(err.message);
// If we get a 401 error, redirect to login
if (err.message.includes("401")) {
router.push("/login");
}
@@ -121,15 +112,12 @@ export default function TeamPage({ params }) {
}, [teamId, router, checkHuntStatus]);
useEffect(() => {
// Only attempt to fetch data when session is ready and we have a teamId
if (status === "authenticated" && teamId) {
console.log("Session authenticated, fetching team data");
fetchTeamData();
// Use a shorter interval (3 seconds) for more responsive updates
const refreshInterval = setInterval(fetchTeamData, 3000);
// Clean up the interval when component unmounts
return () => clearInterval(refreshInterval);
} else if (status === "unauthenticated") {
console.log("User not authenticated, redirecting to login");
@@ -137,9 +125,7 @@ export default function TeamPage({ params }) {
}
}, [teamId, status, fetchTeamData, router]);
// Check if hunt is already in progress on component mount
useEffect(() => {
// Get timer data and check if a hunt has already been started
const timerData = getHuntTimer();
setHuntInProgress(timerData && timerData.startTime);
}, []);
@@ -190,26 +176,36 @@ export default function TeamPage({ params }) {
</div>
</div>
<div className="members-container">
<h2 className="members-title">Team Members</h2>
<div className="content-wrapper">
<div className="waves-container">
<img src="/images/Waves.svg" alt="Waves" className="waves-image" />
</div>
{teamMembers.length > 0 ? (
<div className="members-list">
{teamMembers.map((member) => (
<div key={member.id} className="member-card">
<div className="member-avatar">👤</div>
<div className="member-details">
<div className="member-name">
{member.username}
{member.id === session?.user?.id && " (You)"}
</div>
<div className="scroll-background">
<div className="members-container">
<h2 className="members-title">Team Members</h2>
<div className="members-content">
{teamMembers.length > 0 ? (
<div className="members-list">
{teamMembers.map((member) => (
<div key={member.id} className="member-card">
<div className="member-avatar">👤</div>
<div className="member-details">
<div className="member-name">
{member.username}
{member.id === session?.user?.id && " (You)"}
</div>
</div>
</div>
))}
</div>
</div>
))}
) : (
<div className="empty-state">No team members found</div>
)}
</div>
</div>
) : (
<div className="empty-state">No team members found</div>
)}
</div>
</div>
<div className="team-actions">
@@ -226,14 +222,9 @@ export default function TeamPage({ params }) {
});
if (response.ok) {
// Immediately remove team data from all storage
localStorage.removeItem("teamData");
sessionStorage.removeItem("teamData");
// Set a flag so we know the user has left this team
localStorage.setItem("userLeftTeam", "true");
// Force redirect to team selection
window.location.href = "/team-selection";
} else {
const errorData = await response.json();
@@ -249,7 +240,6 @@ export default function TeamPage({ params }) {
Leave Team
</button>
{/* New Start Hunt button with conditional behavior */}
<button
className="action-button start-button"
onClick={handleStartHunt}
@@ -258,7 +248,6 @@ export default function TeamPage({ params }) {
</button>
</div>
{/* Replace the outdated navbar with the correct one */}
<NavBar activeLink="team" teamData={team} />
<style jsx>{`
@@ -266,12 +255,43 @@ export default function TeamPage({ params }) {
display: flex;
flex-direction: column;
min-height: 100vh;
background-color: #f4f4f4;
background-color: #69b5a8;
font-family: Arial, sans-serif;
position: relative;
overflow-x: hidden; /* Prevent horizontal scroll */
overflow-x: hidden;
width: 100%;
padding-bottom: 70px; /* Add padding to accommodate fixed navbar */
padding-bottom: 70px;
}
.content-wrapper {
position: relative;
flex: 1;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: calc(100vh - 140px); /* Account for header and footer */
}
.waves-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 120px;
overflow: hidden;
z-index: 1;
}
.waves-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
object-position: center top;
}
.team-banner {
@@ -284,12 +304,13 @@ export default function TeamPage({ params }) {
position: relative;
display: flex;
align-items: center;
z-index: 3;
}
.team-info {
flex: 1;
display: flex;
justify-content: space-between; /* This spreads items to opposite ends */
justify-content: space-between;
align-items: center;
}
@@ -297,62 +318,112 @@ export default function TeamPage({ params }) {
margin: 0;
font-size: 24px;
font-weight: bold;
color: white; /* Explicitly setting color to white */
color: white;
}
.team-code {
font-size: 24px;
font-weight: bold;
color: white; /* Ensuring team code is also white */
margin-left: auto; /* Pushes the code to the right */
color: white;
margin-left: auto;
}
.scroll-background {
background-image: url("/images/scroll.svg");
background-repeat: no-repeat;
background-size: contain;
background-position: center;
margin: 20px;
flex: 1;
display: flex;
flex-direction: column;
position: relative;
z-index: 2;
padding: 60px 20px 80px 20px;
height: calc(100% - 40px);
max-height: 100%;
width: 80vw;
max-width: 450px;
}
.members-container {
padding: 20px;
flex: 1;
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
.members-title {
font-size: 18px;
font-size: 20px;
font-weight: bold;
margin-bottom: 15px;
color: #333;
color: #fff;
text-align: center;
margin-top: -46px;
}
.members-content {
flex: 1;
overflow-y: auto;
padding: 10px;
max-height: 100%;
}
.members-list {
display: flex;
flex-direction: column;
gap: 10px;
gap: 8px;
width: 100%;
align-items: center;
}
.member-card {
background-color: white;
border-radius: 8px;
padding: 15px;
border-radius: 6px;
padding: 10px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
border: 2px solid #68543c; /* Add 2px thick border with the same brown color as banner */
border: 1px solid #68543c;
width: 100%;
max-width: 320px;
margin: 0 auto 8px auto;
}
.member-avatar {
font-size: 24px;
margin-right: 15px;
font-size: 20px;
margin-right: 12px;
}
.member-name {
font-weight: 600;
font-size: 14px;
text-align: center;
}
.empty-state {
text-align: center;
padding: 30px;
padding: 20px;
color: #888;
width: 80%;
max-width: 400px;
background-color: rgba(255, 255, 255, 0.7);
border-radius: 8px;
margin: 0 auto;
font-size: 14px;
}
.team-actions {
display: flex;
gap: 10px;
padding: 20px;
padding: 10px 20px;
position: relative;
bottom: 0;
left: 0;
right: 0;
z-index: 3;
margin-top: 15px;
}
.action-button {
@@ -362,6 +433,7 @@ export default function TeamPage({ params }) {
border-radius: 8px;
font-weight: bold;
cursor: pointer;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.leave-button {
@@ -374,60 +446,6 @@ export default function TeamPage({ params }) {
color: white;
}
.nav-bar {
display: flex;
justify-content: space-around;
background-color: white;
border-top: 1px solid #ddd;
padding: 10px 0;
position: fixed; /* Fix the navbar at the bottom */
bottom: 0;
left: 0;
width: 100%; /* Use 100% instead of 100vw to prevent overflow issues */
box-sizing: border-box; /* Include padding in width calculation */
z-index: 100; /* Ensure navbar is above other content */
margin: 0; /* Remove any margin that might be causing the gap */
}
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
text-decoration: none;
color: #666;
flex: 1;
padding: 8px 0;
max-width: 25%; /* Ensure each item takes up equal space */
}
.nav-item.active {
color: #68543c;
}
.nav-icon {
font-size: 22px;
margin-bottom: 3px;
}
.nav-label {
font-size: 12px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
text-align: center;
}
/* Responsive adjustments for smaller screens */
@media (max-width: 375px) {
.nav-icon {
font-size: 20px;
}
.nav-label {
font-size: 10px;
}
}
.loading-container,
.error-container {
display: flex;
@@ -461,6 +479,7 @@ export default function TeamPage({ params }) {
.error-icon {
font-size: 48px;
margin-bottom: 20px;
color: #d32f2f;
}
.error-message {
+5 -42
View File
@@ -10,7 +10,6 @@ import {
import Link from "next/link";
import dynamic from "next/dynamic";
import { use } from "react";
// Add missing import for NavBar component
import NavBar from "@/components/NavBar";
// Dynamically import the QR scanner component with no SSR
@@ -23,7 +22,6 @@ const EnhancedQRScanner = dynamic(
);
export default function CluePage({ params }) {
// Unwrap params properly using use() from React
const unwrappedParams = use(params);
const clueId = unwrappedParams.clueId;
@@ -34,7 +32,7 @@ export default function CluePage({ params }) {
const [scanMessage, setScanMessage] = useState(null);
const [lastRefresh, setLastRefresh] = useState(0);
const [clueFound, setClueFound] = useState(false);
const [clueSkipped, setClueSkipped] = useState(false); // Add state for skipped status
const [clueSkipped, setClueSkipped] = useState(false);
const [allClues, setAllClues] = useState([]);
const [nextClueId, setNextClueId] = useState(null);
const [nextClueAvailable, setNextClueAvailable] = useState(false);
@@ -49,18 +47,15 @@ export default function CluePage({ params }) {
const notificationTimeoutRef = useRef(null);
const navErrorTimeoutRef = useRef(null);
const timerIdRef = useRef(null);
const timerInitializedRef = useRef(false); // Add this ref to track if timer is already initialized
const timerInitializedRef = useRef(false);
// Check if user is admin
const isAdmin = session?.user?.role === "admin";
// This effect handles authentication and initial clue data fetch
useEffect(() => {
let isMounted = true;
const now = Date.now();
const minRefreshInterval = isAdmin ? 30000 : 10000;
// Skip if we refreshed too recently and this isn't the first load
if (loading === false && now - lastRefresh < minRefreshInterval) {
return;
}
@@ -74,7 +69,6 @@ export default function CluePage({ params }) {
return;
}
// Fetch all clues to get navigation context
const fetchAllClues = async () => {
try {
const response = await fetch("/api/clues");
@@ -84,12 +78,11 @@ export default function CluePage({ params }) {
if (isMounted) {
setAllClues(data);
// Find next clue for navigation
const currentIndex = data.findIndex((c) => c.id === parseInt(clueId));
if (currentIndex !== -1 && currentIndex < data.length - 1) {
const nextClue = data[currentIndex + 1];
setNextClueId(nextClue.id);
// Set if the next clue is available (already found or is the next unfound clue)
setNextClueAvailable(nextClue.found || nextClue.available);
}
}
@@ -100,13 +93,11 @@ export default function CluePage({ params }) {
}
};
// Fetch current clue details
async function fetchClue() {
try {
setLoading(true);
await fetchAllClues();
// Add timestamp to avoid browser caching
const timestamp = Date.now();
const response = await fetch(`/api/clues/${clueId}?t=${timestamp}`, {
method: "GET",
@@ -130,7 +121,7 @@ export default function CluePage({ params }) {
if (isMounted) {
setClue(data);
setClueFound(data.found);
setClueSkipped(data.skipped); // Set skipped status from API response
setClueSkipped(data.skipped);
setLoading(false);
setLastRefresh(Date.now());
}
@@ -150,19 +141,12 @@ export default function CluePage({ params }) {
};
}, [clueId, router, status, lastRefresh, loading, isAdmin]);
// Add a new effect to check hunt status periodically
useEffect(() => {
// Check hunt status every 5 seconds
const checkHuntStatus = async () => {
try {
// First check locally if timer indicates hunt has ended
const timerData = getHuntTimer();
let isActive = timerData?.isActive ?? true;
// Only make API call if local data suggests the hunt is active
// This reduces unnecessary API calls
if (isActive) {
// Also sync with server occasionally
const result = await syncTimerWithServer();
if (result.success) {
@@ -170,26 +154,21 @@ export default function CluePage({ params }) {
}
}
// Update hunt active state
setHuntActive(isActive);
// If hunt was active before but is not active now, it just ended
if (previousHuntState && !isActive) {
console.log("Hunt has ended! Redirecting to leaderboard...");
router.push("/leaderboard?huntEnded=true");
}
// Update previous state for next comparison
setPreviousHuntState(isActive);
} catch (err) {
console.error("Error checking hunt status:", err);
}
};
// Check immediately on mount and after any hunt state change
checkHuntStatus();
// Also set up interval for periodic checks
const intervalId = setInterval(checkHuntStatus, 5000);
return () => {
@@ -197,16 +176,13 @@ export default function CluePage({ params }) {
};
}, [router, previousHuntState]);
// Function to ensure we have timer data from the server - only if needed
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
console.log("No timer data found, syncing with server...");
const result = await syncTimerWithServer();
return result.success;
@@ -216,37 +192,29 @@ export default function CluePage({ params }) {
}
}
// Updated timer effect with protection against multiple initializations
useEffect(() => {
// Prevent multiple initializations of the timer
if (timerInitializedRef.current) {
return;
}
// Initialize timer
async function initializeTimer() {
// First ensure we have timer data
await fetchTeamHuntStartTime();
// Set up timer updates if not already set
if (!timerIdRef.current) {
const updateTimer = () => {
const timerData = getHuntTimer();
if (timerData && timerData.startTime) {
setElapsedTime(formatElapsedTime(timerData.startTime));
// Check if timer has ended (if there's an endTime)
if (timerData.endTime) {
const now = Date.now();
const endTime = new Date(timerData.endTime).getTime();
// If current time is past the end time, hunt has ended
if (now >= endTime) {
setHuntActive(false);
clearInterval(timerIdRef.current);
timerIdRef.current = null;
// Redirect to leaderboard with huntEnded flag
console.log(
"Hunt end time reached! Redirecting to leaderboard..."
);
@@ -256,10 +224,8 @@ export default function CluePage({ params }) {
}
};
// Initial update
updateTimer();
// Update every second
timerIdRef.current = setInterval(updateTimer, 1000);
timerInitializedRef.current = true;
}
@@ -267,7 +233,6 @@ export default function CluePage({ params }) {
initializeTimer();
// Clean up interval on unmount
return () => {
if (timerIdRef.current) {
clearInterval(timerIdRef.current);
@@ -275,11 +240,9 @@ export default function CluePage({ params }) {
timerInitializedRef.current = false;
}
};
}, [router]); // Only depend on router
}, [router]);
// Make sure hunt status check doesn't interfere with the timer
useEffect(() => {
// This function should NOT reset the timer or recreate it
async function checkHuntStatus() {
try {
const response = await fetch("/api/hunt-status", {
+3 -56
View File
@@ -1,4 +1,3 @@
/* eslint-disable @next/next/no-img-element */
"use client";
import { useState, useEffect, useRef, useCallback } from "react";
import { useSession } from "next-auth/react";
@@ -26,12 +25,9 @@ export default function MapPage() {
const router = useRouter();
const isMounted = useRef(true);
// Add local state for hunt active status
const [huntActive, setHuntActive] = useState(null);
// Add previous hunt state to detect when hunt ends
const [previousHuntState, setPreviousHuntState] = useState(null);
// Use useCallback for functions called in useEffect to avoid dependency issues
const softRedirect = useCallback(
(url) => {
if (isMounted.current) {
@@ -41,12 +37,10 @@ export default function MapPage() {
[router]
);
// Hard redirect function (for when a full page reload is needed)
const hardRedirect = useCallback((url) => {
window.location.href = url;
}, []);
// Enhanced fetchTeamData function
const fetchTeamData = useCallback(async () => {
try {
const response = await fetch("/api/user/team", {
@@ -84,7 +78,6 @@ export default function MapPage() {
}
}, [softRedirect]);
// Fetch all clues with their status
const fetchClues = useCallback(async () => {
try {
const response = await fetch("/api/clues", {
@@ -98,7 +91,6 @@ export default function MapPage() {
});
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,
@@ -114,10 +106,7 @@ export default function MapPage() {
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,
@@ -125,17 +114,16 @@ export default function MapPage() {
});
setClues(processedClues);
setLoading(false); // Set loading to false after clues are fetched
setLoading(false);
return processedClues;
} catch (err) {
console.error("Failed to fetch clues:", err);
setError(err.message); // Make sure we set the error state
setError(err.message);
setLoading(false);
return [];
}
}, []);
// Handle clue button click
const handleClueClick = useCallback(
(clueId, isAvailable, isFound) => {
if (isFound || isAvailable) {
@@ -147,27 +135,23 @@ export default function MapPage() {
[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`;
};
// Initial resize and listen for window resize
setTimeout(resizeOverlay, 300);
window.addEventListener("resize", resizeOverlay);
@@ -177,7 +161,6 @@ export default function MapPage() {
}
}, []);
// Add this useEffect to coordinate loading the map and clues
useEffect(() => {
if (status === "authenticated") {
fetchClues();
@@ -186,20 +169,17 @@ export default function MapPage() {
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", {
@@ -216,13 +196,11 @@ export default function MapPage() {
const data = await response.json();
setHuntActive(data.active);
// If hunt is inactive, redirect to waiting page
if (data.active === false) {
router.push("/waiting");
return;
}
// If hunt is active, ensure we have timer data
if (data.active && data.startTime) {
setHuntTimer(data.startTime);
}
@@ -232,16 +210,13 @@ export default function MapPage() {
}
}
// 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) {
@@ -250,16 +225,12 @@ export default function MapPage() {
}
}
// 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) {
@@ -267,27 +238,21 @@ export default function MapPage() {
}
};
// 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 () => {
@@ -295,22 +260,18 @@ export default function MapPage() {
};
}, [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]);
@@ -323,11 +284,7 @@ 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>
@@ -359,7 +316,6 @@ export default function MapPage() {
);
}
// 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)
@@ -369,12 +325,10 @@ export default function MapPage() {
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
if (index >= clues.length) return null;
const clue = clues[index];
return (
@@ -392,7 +346,6 @@ export default function MapPage() {
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..."}
@@ -403,10 +356,8 @@ export default function MapPage() {
<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"
@@ -416,7 +367,6 @@ export default function MapPage() {
/>
<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" })}
@@ -437,14 +387,11 @@ export default function MapPage() {
{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>
{/* Replace hardcoded navbar with NavBar component */}
<NavBar activeLink="map" teamData={teamData?.team} />
</div>
);
+5 -2
View File
@@ -479,9 +479,11 @@ export default function TeamPage({ params }) {
padding: 15px;
display: flex;
align-items: center;
justify-content: center; /* Center content horizontally */
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
width: 80vw;
max-width: 500px;
width: calc(80vw - 8px); /* Reduce width by 8px */
max-width: 492px; /* Reduced from 500px by 8px */
margin: 0 auto; /* Center the card */
}
.member-avatar {
@@ -491,6 +493,7 @@ export default function TeamPage({ params }) {
.member-name {
font-weight: 600;
text-align: center; /* Center the text */
}
.empty-state {