From cf7f7a7f3a1433a15ec169d67d89233924c8a686 Mon Sep 17 00:00:00 2001 From: Anders Date: Mon, 19 Feb 2024 20:03:03 +0100 Subject: [PATCH] :sparkles: Added results page --- app/tournament/[id]/results.tsx | 134 +++++++++++++++++++++++++++++++- 1 file changed, 132 insertions(+), 2 deletions(-) diff --git a/app/tournament/[id]/results.tsx b/app/tournament/[id]/results.tsx index 50b03b7..2c71071 100644 --- a/app/tournament/[id]/results.tsx +++ b/app/tournament/[id]/results.tsx @@ -1,3 +1,133 @@ -export default function Results() { - return
; +'use client'; + +import { useParams } from 'next/navigation'; +import { Button } from '../../../components/ui/button'; +import Link from 'next/link'; +import { + Card, + CardDescription, + CardHeader, + CardTitle, +} from '../../../components/ui/card'; +import { CreateTeamDialog } from '../../../components/tournament/create_team_dialog'; +import { TeamDetailsDialog } from '@/components/tournament/teamDetailsDialog'; + +export interface Team { + name: string; + players: string[]; + wins?: number; +} +const teams: Team[] = [ + { + name: 'Embret sitt lag', + players: ['Embret', 'Mori', 'Henrik', 'Eirik'], + wins: 3, + }, + { + name: 'Henrik sitt lag', + players: ['Henrik', 'Mori', 'Eirik', 'Embret'], + wins: 7, + }, + { + name: 'Mori sitt lag', + players: ['Henrik', 'Mori', 'Eirik', 'Embret'], + wins: 10, + }, + { + name: 'Frida sitt lag', + players: ['Henrik', 'Mori', 'Eirik', 'Embret'], + wins: 1, + }, + { + name: 'Jarand sitt lag', + players: ['Henrik', 'Mori', 'Eirik', 'Embret'], + wins: 15, + }, +]; + +export default function ResultsPage() { + const { id } = useParams(); + const sortedTeams = teams.sort((a, b) => (a.wins || 0) - (b.wins || 0)); + + return ( +
+
+
My tournament title
+
Resultater
+ + +
+
+ ); +} + +function TeamCard({ team, place }: { team: Team; place: number }) { + return ( + + +
+ + #{place.toString()} {team.name} + +
+
+
+ ); +} + +function Losers({ teams }: { teams: Team[] }) { + return ( +
+ {teams.slice(3).map((team, index) => ( + + ))} +
+ ); +} + +function Podium({ teams }: { teams: Team[] }) { + return ( +
+
+
{teams[1].name}
+
Icon
+ + #2 + +
+
+
{teams[0].name}
+
Icon
+ + #1 + +
+
+
{teams[2].name}
+
Icon
+ + #3 + +
+
+ ); }