add pwa config

This commit is contained in:
2026-04-15 11:50:15 +03:30
parent d163d2c23f
commit fee71ef99f
11 changed files with 146 additions and 3 deletions

View File

@@ -1,12 +1,35 @@
import { ClientAppProvider } from "@/providers/ClientAppProvider";
import "@/styles/globals.css";
import type { Metadata } from "next";
import { getLocale, getMessages } from "next-intl/server";
import { NextIntlClientProvider } from "next-intl";
export const metadata: Metadata = {
title: "Theater of dreams",
title: {
template: "%s | Theater of dreams",
default: "Theater of dreams",
},
description: "Theater of dreams",
authors: {
name: "شرکت دانش بنیان ویرا ارتباطات یکتا تلفن (وایتل)",
url: "https://witel.ir",
},
manifest: "/manifest.json",
icons: {
icon: "/logo/192px.png",
apple: "/logo/512px.png",
},
};
export const viewport = {
width: "device-width",
initialScale: 1,
maximumScale: 1,
};
export default function RootLayout({ children }: { children: React.ReactNode }) {
export default async function RootLayout({ children }: { children: React.ReactNode }) {
const locale = await getLocale();
const messages = await getMessages({ locale });
return (
<html lang="en" suppressHydrationWarning>
<head>
@@ -27,7 +50,9 @@ export default function RootLayout({ children }: { children: React.ReactNode })
</head>
<body className="bg-primary">
<ClientAppProvider>{children}</ClientAppProvider>
<NextIntlClientProvider locale={locale} messages={messages}>
<ClientAppProvider>{children}</ClientAppProvider>
</NextIntlClientProvider>
</body>
</html>
);

39
src/app/not-found.tsx Normal file
View File

@@ -0,0 +1,39 @@
import Link from "next/link";
export default function NotFound() {
return (
<div className="bg-pwa-primary text-text flex min-h-screen items-center justify-center">
<div className="bg-pwa-primary mx-4 w-full max-w-md rounded-xl p-8 text-center">
{/* آیکون خطا */}
{/*<div className="mb-4 flex justify-center">*/}
{/* <svg*/}
{/* xmlns="http://www.w3.org/2000/svg"*/}
{/* className="h-16 w-16 text-core-red"*/}
{/* fill="none"*/}
{/* viewBox="0 0 24 24"*/}
{/* stroke="currentColor"*/}
{/* >*/}
{/* <path*/}
{/* strokeLinecap="round"*/}
{/* strokeLinejoin="round"*/}
{/* strokeWidth={2}*/}
{/* d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"*/}
{/* />*/}
{/* </svg>*/}
{/*</div>*/}
{/* متن خطا */}
<h2 className="text-text mb-2 text-2xl font-bold">صفحه مورد نظر یافت نشد</h2>
<p className="text-text mb-6 leading-relaxed">متاسفانه صفحهای مورد نظر وجود ندارد.</p>
{/* دکمه بازگشت با استفاده از کامپوننت Link */}
<Link
href="/"
className="bg-neo-aqua hover:bg-neo-aqua/70 inline-block rounded-lg px-6 py-3 font-medium text-white shadow-md transition-colors duration-200 hover:shadow-lg"
>
بازگشت به صفحه اصلی
</Link>
</div>
</div>
);
}

12
src/i18n/request.ts Normal file
View File

@@ -0,0 +1,12 @@
import { cookies } from "next/headers";
import { getRequestConfig } from "next-intl/server";
export default getRequestConfig(async () => {
const cookieStore = await cookies();
const locale = cookieStore.get("language")?.value || "fa";
return {
locale,
messages: (await import(`../../messages/${locale}.json`)).default,
};
});