updated lang change and FormDisplay Components

This commit is contained in:
2025-04-30 14:30:22 +03:00
parent f2cc7a69b5
commit 36e63960f8
87 changed files with 5517 additions and 312 deletions

View File

@@ -0,0 +1,6 @@
const menuPages = {
};
export default menuPages;

View File

@@ -0,0 +1,10 @@
import { PageProps } from "../validations/translations/translation";
import { UnAuthorizedPage } from "./unauthorizedpage";
import menuPages from "./index";
export function retrievePageByUrl(url: string): React.FC<PageProps> {
if (url in menuPages) {
return menuPages[url as keyof typeof menuPages];
}
return UnAuthorizedPage;
}

View File

@@ -0,0 +1,43 @@
import { PageProps } from "../validations/translations/translation";
// Language dictionary for internationalization
const languageDictionary = {
en: {
title: "Unauthorized Access",
message1: "You do not have permission to access this page.",
message2: "Please contact the administrator.",
footer: `© ${new Date().getFullYear()} My Application`,
},
tr: {
title: "Yetkisiz Erişim",
message1: "Bu sayfaya erişim izniniz yok.",
message2: "Lütfen yönetici ile iletişime geçin.",
footer: `© ${new Date().getFullYear()} Uygulamam`,
},
};
export const UnAuthorizedPage: React.FC<PageProps> = ({
lang = "en",
queryParams,
}) => {
// Use the language dictionary based on the lang prop, defaulting to English
const t =
languageDictionary[lang as keyof typeof languageDictionary] ||
languageDictionary.en;
return (
<>
<div className="flex flex-col h-screen">
<header className="bg-gray-800 text-white p-4 text-center">
<h1 className="text-2xl font-bold">{t.title}</h1>
</header>
<main className="flex-grow p-4 bg-gray-100">
<p className="text-gray-700">{t.message1}</p>
<p className="text-gray-700">{t.message2}</p>
</main>
<footer className="bg-gray-800 text-white p-4 text-center">
<p>{t.footer}</p>
</footer>
</div>
</>
);
};