mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-08 03:50:21 +00:00
fixed some CSS styling errors with the team member list page and also added the admin dashboard to allow them to start a hunt with either a stop watch style hunt or a predetermined hunt duration. also fixed some css styling issues I ran into due to using some template code to make the dev process quicker
This commit is contained in:
1 parent
673ea41a4c
commit
c05c8829dd
11 files changed
+691
-185
No files matched your search
@@ -28,8 +28,20 @@ export default function TeamSelection() {
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((userData) => {
|
||||
if (userData.teamId) {
|
||||
window.location.href = `/${userData.teamId}`;
|
||||
console.log("User data:", userData); // Debug user data
|
||||
|
||||
// Check if user is an admin first
|
||||
if (userData.role === "admin") {
|
||||
// Redirect admin to admin dashboard with correct path
|
||||
router.push("/admin"); // Changed from /admin-dashboard to /admin
|
||||
} else if (userData.teamId) {
|
||||
// Only attempt to construct URL if teamId is valid
|
||||
if (userData.teamId && !isNaN(parseInt(userData.teamId))) {
|
||||
window.location.href = `/${userData.teamId}`;
|
||||
} else {
|
||||
console.error("Invalid teamId received:", userData.teamId);
|
||||
setIsLoading(false);
|
||||
}
|
||||
} else {
|
||||
setIsLoading(false);
|
||||
}
|
||||
@@ -64,6 +76,11 @@ export default function TeamSelection() {
|
||||
throw new Error(data.error || "Failed to join team");
|
||||
}
|
||||
|
||||
// Add validation before constructing the URL
|
||||
if (!data.teamId || isNaN(parseInt(data.teamId))) {
|
||||
throw new Error("Invalid team ID received");
|
||||
}
|
||||
|
||||
// Navigate to the team page using the correct URL format
|
||||
window.location.href = `/${data.teamId}`;
|
||||
} catch (err) {
|
||||
@@ -111,20 +128,7 @@ export default function TeamSelection() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="nav-bar">
|
||||
<div className="nav-item">
|
||||
<div className="nav-icon">🏠</div>
|
||||
</div>
|
||||
<div className="nav-item">
|
||||
<div className="nav-icon">📊</div>
|
||||
</div>
|
||||
<div className="nav-item">
|
||||
<div className="nav-icon">🏆</div>
|
||||
</div>
|
||||
<div className="nav-item">
|
||||
<div className="nav-icon">👤</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* Navbar removed from here */}
|
||||
|
||||
<style jsx>{`
|
||||
.auth-page {
|
||||
@@ -176,22 +180,7 @@ export default function TeamSelection() {
|
||||
color: red;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.nav-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #ccc;
|
||||
padding: 10px 0;
|
||||
text-align: center;
|
||||
}
|
||||
.nav-item {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
.nav-icon {
|
||||
font-size: 24px;
|
||||
}
|
||||
/* Navbar styles removed from here */
|
||||
`}</style>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user