Files
webmail/app/(main)/admin/layout.tsx
T
Linus Rath 416e59fa54 fix: give the admin panel the real navigation rail, extension icons and the plugin settings last
The admin drew its own copy of the rail, with a logo and only the app
links, next to a sidebar that signed out from its footer. It now renders
the webmail's NavigationRail (desktop and phone), which needs the
translation, theme and tour providers under /admin, so the admin layout
loads the message catalog itself; the rail marks Admin as the current
app for password admins too. The sidebar footer carries the admin
session links and the same about footer as the settings. Plugin and
theme rows and the detail header show the extension's icon from the
directory listing instead of a generic one, and a plugin's own settings
move to the bottom of its page, after availability, permissions and
versions.
2026-10-20 15:38:55 +02:00

34 lines
1.3 KiB
TypeScript

import { getLocale } from 'next-intl/server';
import { IntlProvider } from '@/components/providers/intl-provider';
import { ThemeProvider } from '@/components/providers/theme-provider';
import { TourProvider } from '@/components/tour/tour-provider';
import { defaultLocale } from '@/i18n/routing';
import { AdminLayoutClient } from './_layout-client';
/**
* /admin sits outside the [locale] tree, so it loads the message catalog
* itself: the shell reuses the webmail's navigation rail, which reads its
* labels through next-intl (and the tour context, for its shortcuts
* dialog). The locale comes from the request (cookie or Accept-Language,
* see i18n/request.ts) and the user's own choice takes over in the
* browser, like on every other page.
*/
export default async function AdminLayout({ children }: { children: React.ReactNode }) {
const locale = await getLocale();
let messages;
try {
messages = (await import(`@/locales/${locale}/common.json`)).default;
} catch {
messages = (await import(`@/locales/${defaultLocale}/common.json`)).default;
}
return (
<IntlProvider locale={locale} messages={messages}>
<ThemeProvider>
<TourProvider>
<AdminLayoutClient>{children}</AdminLayoutClient>
</TourProvider>
</ThemeProvider>
</IntlProvider>
);
}