Refactor layout and home page for improved localization and session handling
- Updated RootLayout to include locale support and integrated ThemeProvider and LocaleProvider for better internationalization. - Replaced static home page content with a redirect based on user session status, enhancing user experience by directing to the appropriate dashboard or login page. - Switched font from Geist to Inter for improved typography consistency.
This commit is contained in:
29
apps/webui/src/app/dashboard/[guildId]/layout.tsx
Normal file
29
apps/webui/src/app/dashboard/[guildId]/layout.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import type { ReactNode } from 'react';
|
||||
import { DashboardShell } from '@/components/layout/dashboard-shell';
|
||||
import { requireGuildAccessOrRedirect } from '@/lib/auth';
|
||||
import { getManageableGuilds } from '@/lib/guilds';
|
||||
|
||||
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 guilds = await getManageableGuilds(session);
|
||||
const currentGuild = guilds.find((guild) => guild.id === guildId);
|
||||
|
||||
if (!currentGuild) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
const otherGuilds = guilds.filter((guild) => guild.id !== guildId);
|
||||
|
||||
return (
|
||||
<DashboardShell guildId={guildId} currentGuild={currentGuild} otherGuilds={otherGuilds} user={session.user}>
|
||||
{children}
|
||||
</DashboardShell>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user