Files
football-next/app/(admin)/admin/countries/page.tsx
a.alinaghipour aa9ed69dd2 first commit
2026-04-05 15:53:20 +03:30

44 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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>
);
}