import { getTranslations } from "next-intl/server"; import Link from "next/link"; import { ContentCard, EmptyState } from "@/components/public/ui"; import { excerpt } from "@/lib/format"; import { prisma } from "@/lib/prisma"; export const revalidate = 300; export const metadata = { title: "Guilds" }; type GuildCard = { id: number; name: string; description: string; badge: string; }; async function getGuilds(): Promise { try { const guilds = await prisma.guilds.findMany({ orderBy: { id: "desc" }, take: 40, select: { id: true, name: true, description: true, badge: true }, }); return guilds; } catch { return []; } } export default async function GuildsPage() { const t = await getTranslations("pages.guilds"); const guilds = await getGuilds(); return (
{guilds.length === 0 ? ( {t("empty")} ) : (
{guilds.map((g) => ( {g.badge ? ( // eslint-disable-next-line @next/next/no-img-element {`${g.name} ) : null}

{g.name || t("unnamedGuild")}

{g.description ? excerpt(g.description, 120) : t("noDescription")}

))}
)}
); }