44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import { db } from "@/lib/db";
|
||
import Link from "next/link";
|
||
|
||
export default async function AdminCountriesPage() {
|
||
const countries = await db.country.findMany({
|
||
include: {
|
||
group: true,
|
||
_count: { select: { players: true } },
|
||
},
|
||
orderBy: { name: "asc" },
|
||
});
|
||
|
||
return (
|
||
<div>
|
||
<div className="flex justify-between items-center mb-6">
|
||
<h1 className="text-2xl font-bold">تیمهای ملی</h1>
|
||
<Link href="/admin/countries/new" className="bg-green-700 text-white px-5 py-2 rounded-xl hover:bg-green-800 transition font-medium">
|
||
+ تیم جدید
|
||
</Link>
|
||
</div>
|
||
<div className="grid grid-cols-2 gap-4">
|
||
{countries.map((c) => (
|
||
<div key={c.id} className="bg-white rounded-2xl shadow p-5 flex items-center justify-between">
|
||
<div className="flex items-center gap-4">
|
||
<div className="w-12 h-12 bg-green-100 rounded-xl flex items-center justify-center text-2xl">
|
||
{c.flagUrl ?? "🏳️"}
|
||
</div>
|
||
<div>
|
||
<div className="font-bold">{c.name}</div>
|
||
<div className="text-sm text-gray-500">
|
||
{c.code} · گروه {c.group?.name ?? "-"} · {c._count.players} بازیکن
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<Link href={`/admin/countries/${c.id}/edit`} className="text-blue-600 hover:underline text-sm">
|
||
ویرایش
|
||
</Link>
|
||
</div>
|
||
))}
|
||
</div>
|
||
</div>
|
||
);
|
||
}
|