Files
football-next/app/(admin)/admin/rounds/[id]/match/[matchId]/page.tsx
2026-04-07 10:38:28 +03:30

39 lines
1.4 KiB
TypeScript

import { db } from "@/lib/db";
import { notFound } from "next/navigation";
import Link from "next/link";
import MatchEventManager from "./MatchEventManager";
import MatchLineupManager from "./MatchLineupManager";
export default async function MatchDetailPage({ params }: { params: Promise<{ id: string; matchId: string }> }) {
const { id, matchId } = await params;
const match = await db.match.findUnique({
where: { id: matchId },
include: {
homeTeam: { include: { players: { where: { isActive: true }, orderBy: { position: "asc" } } } },
awayTeam: { include: { players: { where: { isActive: true }, orderBy: { position: "asc" } } } },
events: { include: { player: true }, orderBy: { minute: "asc" } },
lineups: true,
playerStats: { include: { player: true } },
},
});
if (!match) notFound();
return (
<div className="space-y-6">
<div className="flex items-center gap-3">
<Link href={`/admin/rounds/${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>
{/* مدیریت ترکیب */}
<MatchLineupManager match={match} />
{/* مدیریت رویدادها */}
<MatchEventManager match={match} roundId={id} />
</div>
);
}