Files
Nexumi/apps/webui/src/app/dashboard/[guildId]/layout.tsx
smueller 20593b7173 Enhance dashboard guild access with owner bypass functionality
- Introduced `resolveDashboardGuild` to handle guild resolution for both managed and owner-panel bypass scenarios.
- Updated `GuildLayout` and `WelcomePage` components to utilize the new guild resolution logic, improving access handling.
- Enhanced `DashboardShell` to display an informational banner for users accessing guilds via the owner-panel bypass.
- Added localization support for owner bypass messages in English and German.
- Updated authentication logic to allow owner-panel users to access guilds without Discord Manage Guild permission.
2026-07-24 11:59:16 +02:00

41 lines
1.2 KiB
TypeScript

import { notFound } from 'next/navigation';
import type { ReactNode } from 'react';
import { DashboardShell } from '@/components/layout/dashboard-shell';
import { requireGuildAccessOrRedirect } from '@/lib/auth';
import { getManageableGuilds, resolveDashboardGuild } from '@/lib/guilds';
import { isOwnerUser } from '@/lib/owner-auth';
interface GuildLayoutProps {
children: ReactNode;
params: Promise<{ guildId: string }>;
}
export default async function GuildLayout({ children, params }: GuildLayoutProps) {
const { guildId } = await params;
const session = await requireGuildAccessOrRedirect(guildId);
const [resolved, guilds, showOwnerLink] = await Promise.all([
resolveDashboardGuild(session, guildId),
getManageableGuilds(session),
isOwnerUser(session.user.id)
]);
if (!resolved) {
notFound();
}
const otherGuilds = guilds.filter((guild) => guild.id !== guildId);
return (
<DashboardShell
guildId={guildId}
currentGuild={resolved.guild}
otherGuilds={otherGuilds}
user={session.user}
showOwnerLink={showOwnerLink}
ownerBypass={resolved.ownerBypass}
>
{children}
</DashboardShell>
);
}