diff --git a/app/tournaments/[id]/page.js b/app/tournaments/[id]/page.js index c3c40aa..89e15d2 100644 --- a/app/tournaments/[id]/page.js +++ b/app/tournaments/[id]/page.js @@ -1,145 +1,188 @@ -import Image from 'next/image'; -import Link from 'next/link'; -import { CalendarIcon, ClockIcon } from '@radix-ui/react-icons'; -import { Trophy, DollarSign, Users, Shield } from 'lucide-react'; -import dbConnect from '../../../lib/dbConnect'; -import Tournament from '../../../model/Tournament'; +import Image from "next/image"; +import Link from "next/link"; +import { CalendarIcon, ClockIcon } from "@radix-ui/react-icons"; +import { Trophy, DollarSign, Users, Shield } from "lucide-react"; +import dbConnect from "../../../lib/dbConnect"; +import Tournament from "../../../model/Tournament"; async function getTournament(id) { - await dbConnect(); - if (!id) { - console.error('Tournament ID is undefined'); - return null; - } - try { - const tournament = await Tournament.findById(id) - .populate('gameId') - .populate('organizerId') - .lean(); - return tournament ? JSON.parse(JSON.stringify(tournament)) : null; - } catch (error) { - console.error('Error fetching tournament:', error); - return null; - } + await dbConnect(); + if (!id) { + console.error("Tournament ID is undefined"); + return null; + } + try { + const tournament = await Tournament.findById(id) + .populate("gameId") + .populate("organizerId") + .lean(); + return tournament ? JSON.parse(JSON.stringify(tournament)) : null; + } catch (error) { + console.error("Error fetching tournament:", error); + return null; + } } export default async function TournamentPage({ params }) { - if (!params || !params.id) { - return
-
-
-
-
Status: new Date(tournament.tournamentDates.ended) ? 'bg-red-600' : - 'bg-yellow-600' - }`}> - {new Date() < new Date(tournament.tournamentDates.started) ? 'Open' : - new Date() > new Date(tournament.tournamentDates.ended) ? 'Completed' : - 'Live'} -
-{tournament.gameId?.profile || "No description available"}
-
+
+
+
+
+ Status:{" "} + + new Date(tournament.tournamentDates.ended) + ? "bg-red-600" + : "bg-yellow-600" + }`} + > + {new Date() < new Date(tournament.tournamentDates.started) + ? "Open" + : new Date() > new Date(tournament.tournamentDates.ended) + ? "Completed" + : "Live"} + +
+{tournament.rules}
-{tournament.gameId?.profile || "No description available"}
+{tournament.rules}
+