A modern, privacy-focused webmail client built with Next.js and the JMAP protocol. Designed for Stalwart Mail Server. Features: - Full email operations (compose, reply, forward, threading) - Real-time push notifications - Dark/light theme support - Mobile responsive design - Keyboard shortcuts - Drag-and-drop organization - i18n (English/French) - Security-first (external content blocked, HTML sanitization)
78 lines
2.3 KiB
TypeScript
78 lines
2.3 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { Geist, Geist_Mono } from "next/font/google";
|
|
import { notFound } from "next/navigation";
|
|
import { NextIntlClientProvider } from "next-intl";
|
|
import { ThemeProvider } from "@/components/providers/theme-provider";
|
|
import { locales } from "@/i18n/request";
|
|
import "../globals.css";
|
|
|
|
const geistSans = Geist({
|
|
variable: "--font-geist-sans",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
const geistMono = Geist_Mono({
|
|
variable: "--font-geist-mono",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
export const metadata: Metadata = {
|
|
title: "JMAP Webmail",
|
|
description: "Minimalist webmail client using JMAP protocol",
|
|
};
|
|
|
|
export default async function LocaleLayout({
|
|
children,
|
|
params
|
|
}: {
|
|
children: React.ReactNode;
|
|
params: Promise<{ locale: string }>;
|
|
}) {
|
|
const { locale } = await params;
|
|
|
|
// Validate that the incoming `locale` parameter is valid
|
|
if (!(locales as readonly string[]).includes(locale)) notFound();
|
|
|
|
// Load messages for the current locale
|
|
let messages;
|
|
try {
|
|
messages = (await import(`@/locales/${locale}/common.json`)).default;
|
|
} catch {
|
|
notFound();
|
|
}
|
|
|
|
return (
|
|
<html lang={locale} suppressHydrationWarning>
|
|
<head>
|
|
<script
|
|
dangerouslySetInnerHTML={{
|
|
__html: `
|
|
(function() {
|
|
try {
|
|
const stored = localStorage.getItem('theme-storage');
|
|
const theme = stored ? JSON.parse(stored).state.theme : 'system';
|
|
const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
const resolved = theme === 'system' ? systemTheme : theme;
|
|
document.documentElement.classList.remove('light', 'dark');
|
|
document.documentElement.classList.add(resolved);
|
|
} catch (e) {
|
|
document.documentElement.classList.add('light');
|
|
}
|
|
})();
|
|
`,
|
|
}}
|
|
/>
|
|
</head>
|
|
<body
|
|
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
>
|
|
<NextIntlClientProvider locale={locale} messages={messages}>
|
|
<ThemeProvider>
|
|
{children}
|
|
</ThemeProvider>
|
|
</NextIntlClientProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|