added pages tested via backend

This commit is contained in:
2025-08-06 16:33:03 +03:00
parent 9232da69d3
commit a986ddbb95
33 changed files with 498 additions and 167 deletions

View File

@@ -8,16 +8,17 @@ import { getSelectToken } from '@/fetchers/token/select';
export default async function DashboardPage() {
const pageUrl = "/office/dashboard";
const selectToken = await getSelectToken();
const RenderPage = renderPage(selectToken, pageUrl, dashboardPages);
if (RenderPage) {
return <>
<div>Dashboard Page</div>
<div className='flex align-center justify-center h-screen w-screen mt-10 text-2xl'>
<RenderPage />
</div>
</>
}
try {
const RenderPage = renderPage(selectToken, pageUrl, dashboardPages);
if (RenderPage) {
return <>
<div>Dashboard Page</div>
<div className='flex align-center justify-center h-screen w-screen mt-10 text-2xl'>
<RenderPage />
</div>
</>
}
} catch (error) { console.log(error) }
return <>
<div>Dashboard Page</div>
<div>You are not allowed to reach any page under {pageUrl}. Please contact your administrator.</div>

View File

@@ -1,59 +1,43 @@
import { ReactNode } from 'react';
import { Inter } from 'next/font/google';
import { notFound } from "next/navigation";
import { redirect } from "next/navigation";
import { getTranslations } from "next-intl/server";
import { Locale, locales } from "@/i18n/locales";
import { routing } from "@/i18n/routing";
import { NextIntlClientProvider } from 'next-intl';
import '../globals.css';
const inter = Inter({ subsets: ["latin"] });
type Props = {
children: ReactNode;
params: Promise<{ locale: Locale }>;
children: ReactNode;
params: Promise<{ locale: Locale }>;
};
export function generateStaticParams() {
return locales.map((locale) => ({ locale }));
return locales.map((locale) => ({ locale }));
}
export async function generateMetadata({ params }: Omit<Props, 'children'>) {
// Properly await params before accessing properties
const { locale } = await params;
const t = await getTranslations({ locale, namespace: 'LocaleLayout' });
return {
title: t('title')
};
const { locale } = await params;
const t = await getTranslations({ locale, namespace: 'LocaleLayout' });
return { title: t('title') };
}
export default async function LocaleLayout({ children, params }: Props) {
// Properly await params before accessing properties
const { locale } = await params;
// Validate that the incoming locale is valid
if (!locales.includes(locale as Locale)) {
notFound();
}
// Load messages for all child components
const messages = (await import(`@/i18n/${locale}.json`)).default;
// Enable static rendering
// Note: unstable_setRequestLocale is removed as it's causing TypeScript errors
return (
<html lang={locale}>
<body className={inter.className}>
<NextIntlClientProvider
locale={locale}
messages={messages}
timeZone="Europe/Istanbul" // Configure a default timezone for Turkey
>
{children}
</NextIntlClientProvider>
</body>
</html>
);
const { locale } = await params;
if (!locales.includes(locale as Locale)) {
redirect('/' + locales[0]);
}
const messages = (await import(`@/i18n/${locale}.json`)).default;
return (
<>
<html lang={locale}>
<body className={inter.className}>
<NextIntlClientProvider locale={locale} messages={messages} timeZone="Europe/Istanbul">
{children}
</NextIntlClientProvider>
</body>
</html>
</>
);
}

View File

@@ -1,6 +1,8 @@
'use server';
import HomePage from '@/app/home-page';
import { sendChunksToNest } from '@/lib/init-sync';
export default async function Home() {
sendChunksToNest();
return <HomePage />;
}

View File

@@ -0,0 +1,5 @@
import { ReactNode } from 'react';
export default function RootLayout({ children }: { children: ReactNode }) {
return children;
}

View File

@@ -0,0 +1,8 @@
'use server'
import { redirect } from '@/i18n/navigation';
const RedirectHome = async () => {
return redirect({ locale: "en", href: "/" })
}
export default RedirectHome