import { db } from "@/lib/db"; import PositionBadge from "@/components/PositionBadge"; export default async function PlayersPage({ searchParams, }: { searchParams: { position?: string; country?: string }; }) { const players = await db.player.findMany({ where: { ...(searchParams.position ? { position: searchParams.position as any } : {}), ...(searchParams.country ? { countryId: searchParams.country } : {}), }, include: { country: true }, orderBy: { totalPoints: "desc" }, }); const countries = await db.country.findMany({ orderBy: { name: "asc" } }); return (

بازیکنان

{/* فیلترها */}
{["", "GK", "DEF", "MID", "FWD"].map((pos) => ( {pos === "" ? "همه" : pos === "GK" ? "دروازه‌بان" : pos === "DEF" ? "مدافع" : pos === "MID" ? "هافبک" : "مهاجم"} ))}
{/* جدول */}
{players.map((p, i) => ( ))}
# بازیکن پست تیم ملی قیمت امتیاز
{i + 1} {p.name} {p.country.name} {p.price}M {p.totalPoints}
); }