import { Users } from "lucide-react"; import { createTeam, deleteTeam } from "@/actions/admin-teams"; import { StatusCard } from "@/components/admin/dashboard"; import { prisma } from "@/lib/prisma"; import { getTranslations } from "next-intl/server"; export const dynamic = "force-dynamic"; type TeamRow = { id: bigint; rankName: string; badge: string | null; jobDescription: string | null; staffColor: string; hiddenRank: boolean; }; export default async function AdminTeams() { const t = await getTranslations("pages.admin.teams"); let teams: TeamRow[] = []; try { teams = await prisma.websiteTeams.findMany({ select: { id: true, rankName: true, badge: true, jobDescription: true, staffColor: true, hiddenRank: true, }, orderBy: { id: "asc" }, }); } catch { teams = []; } const hidden = teams.filter((t) => t.hiddenRank).length; return (

{t("title")}

{t("subtitle")}

{t("newTeamRank")}

{t("ranksTitle", { count: teams.length })}

{teams.length === 0 ? (
{t("noTeams")}
) : (
{teams.map((team) => ( ))}
{t("colId")} {t("rankName")} {t("badge")} {t("jobDescription")} {t("color")} {t("visibility")}
{String(team.id)} {team.rankName} {team.badge ?? "—"} {team.jobDescription ?? "—"} {team.staffColor} {team.hiddenRank ? t("hidden") : t("visible")}
)}
); }