nextjs-rewrite #5
@@ -0,0 +1,249 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { useState, useRef } from "react"
|
||||||
|
import { useRouter } from "next/navigation"
|
||||||
|
import Navigation from "@/components/Navigation"
|
||||||
|
import { auth } from "@/lib/auth"
|
||||||
|
|
||||||
|
export default function UploadMatchesPage() {
|
||||||
|
const router = useRouter()
|
||||||
|
const [selectedFile, setSelectedFile] = useState<File | null>(null)
|
||||||
|
const [selectedTournament, setSelectedTournament] = useState<string>("")
|
||||||
|
const [error, setError] = useState("")
|
||||||
|
const [success, setSuccess] = useState("")
|
||||||
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
const [tournaments, setTournaments] = useState<any[]>([])
|
||||||
|
const fileInputRef = useRef<HTMLInputElement>(null)
|
||||||
|
|
||||||
|
// Fetch tournaments on mount
|
||||||
|
useState(() => {
|
||||||
|
fetch("/api/tournaments")
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((data) => {
|
||||||
|
if (data.tournaments) {
|
||||||
|
setTournaments(data.tournaments)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => console.error("Failed to fetch tournaments:", err))
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const file = e.target.files?.[0]
|
||||||
|
if (file) {
|
||||||
|
if (!file.name.endsWith(".csv")) {
|
||||||
|
setError("Please upload a CSV file")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setSelectedFile(file)
|
||||||
|
setError("")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSubmit = async (e: React.FormEvent) => {
|
||||||
|
e.preventDefault()
|
||||||
|
setError("")
|
||||||
|
setSuccess("")
|
||||||
|
|
||||||
|
if (!selectedFile) {
|
||||||
|
setError("Please select a CSV file to upload")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!selectedTournament) {
|
||||||
|
setError("Please select a tournament")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsLoading(true)
|
||||||
|
|
||||||
|
try {
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append("csvFile", selectedFile)
|
||||||
|
formData.append("eventId", selectedTournament)
|
||||||
|
|
||||||
|
const response = await fetch("/api/matches/upload", {
|
||||||
|
method: "POST",
|
||||||
|
body: formData,
|
||||||
|
})
|
||||||
|
|
||||||
|
const data = await response.json()
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(data.error || "Failed to upload CSV")
|
||||||
|
}
|
||||||
|
|
||||||
|
setSuccess(
|
||||||
|
`Successfully imported ${data.importedCount} matches. ` +
|
||||||
|
`${data.errorCount || 0} errors occurred.` +
|
||||||
|
(data.errors ? `\n\nErrors:\n${data.errors.join("\n")}` : "")
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reset form
|
||||||
|
setSelectedFile(null)
|
||||||
|
setSelectedTournament("")
|
||||||
|
if (fileInputRef.current) {
|
||||||
|
fileInputRef.current.value = ""
|
||||||
|
}
|
||||||
|
} catch (err: any) {
|
||||||
|
setError(err.message)
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-gray-50">
|
||||||
|
<Navigation />
|
||||||
|
|
||||||
|
<main className="max-w-3xl mx-auto py-6 sm:px-6 lg:px-8">
|
||||||
|
<div className="px-4 py-6 sm:px-0">
|
||||||
|
<h1 className="text-3xl font-bold text-gray-900 mb-6">
|
||||||
|
Upload Match Results (CSV)
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div className="bg-white shadow rounded-lg p-6">
|
||||||
|
<form onSubmit={handleSubmit} className="space-y-6">
|
||||||
|
{error && (
|
||||||
|
<div className="rounded-md bg-red-50 p-4">
|
||||||
|
<div className="text-sm text-red-700 whitespace-pre-wrap">
|
||||||
|
{error}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{success && (
|
||||||
|
<div className="rounded-md bg-green-50 p-4">
|
||||||
|
<div className="text-sm text-green-700 whitespace-pre-wrap">
|
||||||
|
{success}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Tournament Selection */}
|
||||||
|
<div>
|
||||||
|
<label htmlFor="tournament" className="block text-sm font-medium text-gray-700">
|
||||||
|
Select Tournament *
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
id="tournament"
|
||||||
|
value={selectedTournament}
|
||||||
|
onChange={(e) => setSelectedTournament(e.target.value)}
|
||||||
|
className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-green-500 focus:border-green-500 sm:text-sm"
|
||||||
|
>
|
||||||
|
<option value="">Choose a tournament...</option>
|
||||||
|
{tournaments.map((tournament) => (
|
||||||
|
<option key={tournament.id} value={tournament.id}>
|
||||||
|
{tournament.name}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* File Upload */}
|
||||||
|
<div>
|
||||||
|
<label className="block text-sm font-medium text-gray-700">
|
||||||
|
CSV File *
|
||||||
|
</label>
|
||||||
|
<div className="mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md">
|
||||||
|
<div className="space-y-1 text-center">
|
||||||
|
<svg
|
||||||
|
className="mx-auto h-12 w-12 text-gray-400"
|
||||||
|
stroke="currentColor"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 48 48"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02"
|
||||||
|
strokeWidth={2}
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<div className="flex text-sm text-gray-600">
|
||||||
|
<label
|
||||||
|
htmlFor="file-upload"
|
||||||
|
className="relative cursor-pointer bg-white rounded-md font-medium text-green-600 hover:text-green-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-green-500"
|
||||||
|
>
|
||||||
|
<span>Upload a file</span>
|
||||||
|
<input
|
||||||
|
id="file-upload"
|
||||||
|
name="file-upload"
|
||||||
|
type="file"
|
||||||
|
className="sr-only"
|
||||||
|
accept=".csv"
|
||||||
|
onChange={handleFileChange}
|
||||||
|
ref={fileInputRef}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<p className="pl-1">or drag and drop</p>
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-gray-500">
|
||||||
|
CSV file with match results
|
||||||
|
</p>
|
||||||
|
{selectedFile && (
|
||||||
|
<p className="text-sm text-green-600 mt-2">
|
||||||
|
Selected: {selectedFile.name}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* CSV Format Guide */}
|
||||||
|
<div className="bg-blue-50 rounded-md p-4">
|
||||||
|
<h3 className="text-sm font-medium text-blue-800 mb-2">
|
||||||
|
CSV Format Requirements
|
||||||
|
</h3>
|
||||||
|
<ul className="text-sm text-blue-700 space-y-1">
|
||||||
|
<li><strong>Event #:</strong> Tournament ID (optional if selected above)</li>
|
||||||
|
<li><strong>Round:</strong> Round number (1, 2, 3...)</li>
|
||||||
|
<li><strong>Table:</strong> Table name (Clubs, Hearts, Diamonds, Spades, Stars)</li>
|
||||||
|
<li><strong>Seat 1:</strong> Player 1 name (Odds team)</li>
|
||||||
|
<li><strong>Seat 3:</strong> Player 2 name (Odds team)</li>
|
||||||
|
<li><strong>Odds Points:</strong> Score for Odds team</li>
|
||||||
|
<li><strong>Seat 2:</strong> Player 1 name (Evens team)</li>
|
||||||
|
<li><strong>Seat 4:</strong> Player 2 name (Evens team)</li>
|
||||||
|
<li><strong>Evens Points:</strong> Score for Evens team</li>
|
||||||
|
<li><strong>Winner:</strong> "Odds" or "Evens" (optional)</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Submit Button */}
|
||||||
|
<div className="flex justify-end">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
disabled={isLoading}
|
||||||
|
className="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50"
|
||||||
|
>
|
||||||
|
{isLoading ? "Uploading..." : "Upload CSV"}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Sample CSV */}
|
||||||
|
<div className="mt-6 bg-white shadow rounded-lg p-6">
|
||||||
|
<h2 className="text-lg font-medium text-gray-900 mb-3">
|
||||||
|
Sample CSV Format
|
||||||
|
</h2>
|
||||||
|
<pre className="bg-gray-50 rounded p-4 text-xs overflow-x-auto">
|
||||||
|
{`Event #,Round,Table,Seat 1,Seat 3,Odds Points,Seat 2,Seat 4,Evens Points,Winner
|
||||||
|
1,1,Clubs,Derrick,Jesse C,5,Emma,Alissa,10,Evens
|
||||||
|
1,1,Hearts,Kevin,Andy,8,Ellie,Jesse,6,Odds`}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mt-4 flex justify-end">
|
||||||
|
<button
|
||||||
|
onClick={() => router.back()}
|
||||||
|
className="text-green-600 hover:text-green-900"
|
||||||
|
>
|
||||||
|
← Back
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,290 @@
|
|||||||
|
import { prisma } from "@/lib/prisma"
|
||||||
|
import Navigation from "@/components/Navigation"
|
||||||
|
import Link from "next/link"
|
||||||
|
import { notFound, redirect } from "next/navigation"
|
||||||
|
import { auth } from "@/lib/auth"
|
||||||
|
|
||||||
|
interface PageProps {
|
||||||
|
params: {
|
||||||
|
id: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function TournamentDetailPage({ params }: PageProps) {
|
||||||
|
const session = await auth()
|
||||||
|
|
||||||
|
if (!session || session.user.role !== "club_admin") {
|
||||||
|
redirect("/auth/login")
|
||||||
|
}
|
||||||
|
|
||||||
|
const tournamentId = parseInt(params.id)
|
||||||
|
|
||||||
|
const tournament = await prisma.event.findUnique({
|
||||||
|
where: { id: tournamentId },
|
||||||
|
include: {
|
||||||
|
participants: {
|
||||||
|
include: {
|
||||||
|
player: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
teams: {
|
||||||
|
include: {
|
||||||
|
player1: true,
|
||||||
|
player2: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rounds: {
|
||||||
|
include: {
|
||||||
|
bracketMatchups: {
|
||||||
|
include: {
|
||||||
|
team1: {
|
||||||
|
include: {
|
||||||
|
player1: true,
|
||||||
|
player2: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
team2: {
|
||||||
|
include: {
|
||||||
|
player1: true,
|
||||||
|
player2: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
match: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!tournament) {
|
||||||
|
notFound()
|
||||||
|
}
|
||||||
|
|
||||||
|
const matches = await prisma.match.findMany({
|
||||||
|
where: { eventId: tournamentId },
|
||||||
|
include: {
|
||||||
|
team1P1: true,
|
||||||
|
team1P2: true,
|
||||||
|
team2P1: true,
|
||||||
|
team2P2: true,
|
||||||
|
},
|
||||||
|
orderBy: { playedAt: "desc" },
|
||||||
|
})
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-gray-50">
|
||||||
|
<Navigation />
|
||||||
|
|
||||||
|
<main className="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
|
||||||
|
<div className="px-4 py-6 sm:px-0">
|
||||||
|
{/* Breadcrumb */}
|
||||||
|
<nav className="mb-4">
|
||||||
|
<ol className="flex items-center space-x-2">
|
||||||
|
<li>
|
||||||
|
<Link href="/admin/tournaments" className="text-green-600 hover:text-green-900">
|
||||||
|
Tournaments
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
<li className="text-gray-400">/</li>
|
||||||
|
<li className="text-gray-600">{tournament.name}</li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
{/* Tournament Header */}
|
||||||
|
<div className="bg-white shadow rounded-lg p-6 mb-6">
|
||||||
|
<div className="flex justify-between items-start">
|
||||||
|
<div>
|
||||||
|
<h1 className="text-2xl font-bold text-gray-900">{tournament.name}</h1>
|
||||||
|
<p className="text-gray-500 mt-1">
|
||||||
|
{tournament.format} - {tournament.status}
|
||||||
|
</p>
|
||||||
|
{tournament.eventDate && (
|
||||||
|
<p className="text-sm text-gray-400 mt-1">
|
||||||
|
{new Date(tournament.eventDate).toLocaleDateString()}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="flex space-x-2">
|
||||||
|
<Link
|
||||||
|
href={`/admin/tournaments/${tournament.id}/edit`}
|
||||||
|
className="px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50"
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
href={`/admin/tournaments/${tournament.id}/results`}
|
||||||
|
className="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-green-600 hover:bg-green-700"
|
||||||
|
>
|
||||||
|
Enter Results
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Quick Stats */}
|
||||||
|
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mt-6">
|
||||||
|
<div className="bg-gray-50 rounded-lg p-4 text-center">
|
||||||
|
<p className="text-sm text-gray-500">Participants</p>
|
||||||
|
<p className="text-2xl font-bold text-gray-900">
|
||||||
|
{tournament.participants.length}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="bg-gray-50 rounded-lg p-4 text-center">
|
||||||
|
<p className="text-sm text-gray-500">Teams</p>
|
||||||
|
<p className="text-2xl font-bold text-gray-900">
|
||||||
|
{tournament.teams.length}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="bg-gray-50 rounded-lg p-4 text-center">
|
||||||
|
<p className="text-sm text-gray-500">Rounds</p>
|
||||||
|
<p className="text-2xl font-bold text-gray-900">
|
||||||
|
{tournament.rounds.length}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="bg-gray-50 rounded-lg p-4 text-center">
|
||||||
|
<p className="text-sm text-gray-500">Matches</p>
|
||||||
|
<p className="text-2xl font-bold text-gray-900">
|
||||||
|
{matches.length}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Tabs */}
|
||||||
|
<div className="border-b border-gray-200">
|
||||||
|
<nav className="-mb-px flex space-x-8">
|
||||||
|
<button className="border-green-500 text-green-600 whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">
|
||||||
|
Overview
|
||||||
|
</button>
|
||||||
|
<button className="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">
|
||||||
|
Participants
|
||||||
|
</button>
|
||||||
|
<button className="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">
|
||||||
|
Teams
|
||||||
|
</button>
|
||||||
|
<button className="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">
|
||||||
|
Schedule
|
||||||
|
</button>
|
||||||
|
<button className="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">
|
||||||
|
Results
|
||||||
|
</button>
|
||||||
|
<button className="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">
|
||||||
|
Analytics
|
||||||
|
</button>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Content */}
|
||||||
|
<div className="mt-6">
|
||||||
|
{/* Participants Section */}
|
||||||
|
<div className="bg-white shadow rounded-lg p-6 mb-6">
|
||||||
|
<h2 className="text-lg font-medium text-gray-900 mb-4">
|
||||||
|
Participants ({tournament.participants.length})
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
{tournament.participants.length > 0 ? (
|
||||||
|
<div className="grid grid-cols-2 md:grid-cols-4 gap-3">
|
||||||
|
{tournament.participants.map((participant) => (
|
||||||
|
<div
|
||||||
|
key={participant.id}
|
||||||
|
className="bg-gray-50 rounded p-2 text-center"
|
||||||
|
>
|
||||||
|
<Link
|
||||||
|
href={`/players/${participant.player.id}/profile`}
|
||||||
|
className="text-green-600 hover:text-green-900 text-sm"
|
||||||
|
>
|
||||||
|
{participant.player.name}
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="text-gray-500">No participants registered yet.</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Teams Section */}
|
||||||
|
<div className="bg-white shadow rounded-lg p-6 mb-6">
|
||||||
|
<h2 className="text-lg font-medium text-gray-900 mb-4">
|
||||||
|
Teams ({tournament.teams.length})
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
{tournament.teams.length > 0 ? (
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||||
|
{tournament.teams.map((team) => (
|
||||||
|
<div
|
||||||
|
key={team.id}
|
||||||
|
className="bg-gray-50 rounded p-3 flex justify-between items-center"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<p className="font-medium text-gray-900">
|
||||||
|
{team.player1.name} + {team.player2.name}
|
||||||
|
</p>
|
||||||
|
<p className="text-sm text-gray-500">{team.teamName}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="text-gray-500">No teams created yet.</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Recent Matches Section */}
|
||||||
|
<div className="bg-white shadow rounded-lg p-6">
|
||||||
|
<h2 className="text-lg font-medium text-gray-900 mb-4">
|
||||||
|
Recent Matches ({matches.length})
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
{matches.length > 0 ? (
|
||||||
|
<div className="space-y-3">
|
||||||
|
{matches.slice(0, 10).map((match) => (
|
||||||
|
<div
|
||||||
|
key={match.id}
|
||||||
|
className="border border-gray-200 rounded p-3"
|
||||||
|
>
|
||||||
|
<div className="flex justify-between items-center">
|
||||||
|
<div className="flex-1">
|
||||||
|
<p className="text-sm text-gray-500">
|
||||||
|
{match.playedAt?.toLocaleDateString()}
|
||||||
|
</p>
|
||||||
|
<p className="font-medium">
|
||||||
|
{match.team1P1.name} + {match.team1P2.name} vs{" "}
|
||||||
|
{match.team2P1.name} + {match.team2P2.name}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="text-right">
|
||||||
|
<span className={`font-bold ${
|
||||||
|
match.team1Score > match.team2Score
|
||||||
|
? 'text-green-600'
|
||||||
|
: match.team1Score < match.team2Score
|
||||||
|
? 'text-red-600'
|
||||||
|
: 'text-gray-600'
|
||||||
|
}`}>
|
||||||
|
{match.team1Score}
|
||||||
|
</span>
|
||||||
|
<span className="text-gray-400 mx-2">-</span>
|
||||||
|
<span className={`font-bold ${
|
||||||
|
match.team2Score > match.team1Score
|
||||||
|
? 'text-green-600'
|
||||||
|
: match.team2Score < match.team1Score
|
||||||
|
? 'text-red-600'
|
||||||
|
: 'text-gray-600'
|
||||||
|
}`}>
|
||||||
|
{match.team2Score}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="text-gray-500">No matches recorded yet.</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user