32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { db } from "@/lib/db";
|
|
import { notFound } from "next/navigation";
|
|
import Link from "next/link";
|
|
import MatchEventManager from "./MatchEventManager";
|
|
|
|
export default async function MatchDetailPage({ params }: { params: { id: string; matchId: string } }) {
|
|
const match = await db.match.findUnique({
|
|
where: { id: params.matchId },
|
|
include: {
|
|
homeTeam: { include: { players: { orderBy: { position: "asc" } } } },
|
|
awayTeam: { include: { players: { orderBy: { position: "asc" } } } },
|
|
events: { include: { player: true }, orderBy: { minute: "asc" } },
|
|
lineups: true,
|
|
playerStats: { include: { player: true } },
|
|
},
|
|
});
|
|
|
|
if (!match) notFound();
|
|
|
|
return (
|
|
<div>
|
|
<div className="flex items-center gap-3 mb-6">
|
|
<Link href={`/admin/rounds/${params.id}`} className="text-gray-400 hover:text-gray-600">← دور</Link>
|
|
<h1 className="text-xl font-bold">
|
|
{match.homeTeam.name} {match.homeScore ?? "-"} - {match.awayScore ?? "-"} {match.awayTeam.name}
|
|
</h1>
|
|
</div>
|
|
<MatchEventManager match={match} roundId={params.id} />
|
|
</div>
|
|
);
|
|
}
|