- Updated the guilds API to support searching by both guild name and ID, improving user experience. - Increased the number of guilds retrieved from the database from 100 to 200 for better visibility. - Implemented invite creation functionality, allowing owners to generate invites directly from the guild management interface. - Enhanced the UI to display guild names, icons, and member counts, providing a more informative overview. - Updated localization files to reflect new search capabilities and invite-related messages in both English and German.
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { GuildsManager } from '@/components/owner/owner-forms';
|
|
import { getLocale, t } from '@/lib/i18n';
|
|
import { enrichOwnerGuildListItems } from '@/lib/owner-guilds';
|
|
import { prisma } from '@/lib/prisma';
|
|
|
|
export default async function OwnerGuildsPage() {
|
|
const locale = await getLocale();
|
|
const [guilds, blacklist] = await Promise.all([
|
|
prisma.guild.findMany({
|
|
include: { settings: true },
|
|
orderBy: { createdAt: 'desc' },
|
|
take: 200
|
|
}),
|
|
prisma.guildBlacklist.findMany()
|
|
]);
|
|
const blacklisted = new Set(blacklist.map((entry) => entry.guildId));
|
|
const initialGuilds = await enrichOwnerGuildListItems(
|
|
guilds.map((guild) => ({
|
|
id: guild.id,
|
|
locale: guild.settings?.locale ?? 'de',
|
|
createdAt: guild.createdAt.toISOString(),
|
|
blacklisted: blacklisted.has(guild.id)
|
|
}))
|
|
);
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
<div>
|
|
<h1 className="text-2xl font-semibold">{t(locale, 'owner.guilds.title')}</h1>
|
|
<p className="text-sm text-muted-foreground">{t(locale, 'owner.guilds.subtitle')}</p>
|
|
</div>
|
|
<GuildsManager initialGuilds={initialGuilds} />
|
|
</div>
|
|
);
|
|
}
|