From b714585a2e85845da1eecb8feb542481532f8082 Mon Sep 17 00:00:00 2001 From: Berkay Date: Wed, 28 May 2025 16:05:23 +0300 Subject: [PATCH] new menu structure tested new version will be deployed --- docker-compose.yml | 84 ++++---- .../panel/[...page]/page.tsx | 6 +- .../custom/content/PageToBeChildrendMulti.tsx | 31 ++- .../components/custom/content/component.tsx | 92 ++++----- .../components/custom/footer/component.tsx | 5 +- .../components/custom/header/component.tsx | 12 +- .../src/components/custom/menu/component.tsx | 13 +- .../custom/menu/menuItemsSection.tsx | 158 ++++---------- .../custom/menu/userProfileSection.tsx | 4 +- .../mutual/context/online/context.ts | 1 + .../mutual/languageSelection/component.tsx | 17 +- .../src/languages/mutual/menu/english.ts | 193 ++++++++++++++++-- .../src/languages/mutual/menu/turkish.ts | 192 +++++++++++++++-- .../src/layouts/dashboard/client.tsx | 80 +++----- .../src/layouts/dashboard/layout.tsx | 9 +- .../client_frontend/src/pages/multi/index.ts | 79 ++++++- .../src/pages/resolver/resolver.tsx | 4 +- .../src/validations/mutual/dashboard/props.ts | 101 +++++---- 18 files changed, 679 insertions(+), 402 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 094f3c8..157eb0f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,49 +31,49 @@ services: # cpus: 1 # mem_limit: 2048m - account_service: - container_name: account_service - build: - context: . - dockerfile: api_services/api_builds/account_service/Dockerfile - env_file: - - api_env.env - networks: - - wag-services - environment: - - API_PATH=app:app - - API_HOST=0.0.0.0 - - API_PORT=8004 - - API_LOG_LEVEL=info - - API_RELOAD=1 - - API_APP_NAME=evyos-account-api-gateway - - API_TITLE=WAG API Account Api Gateway - - API_DESCRIPTION=This api is serves as web account api gateway only to evyos web services. - - API_APP_URL=https://account_service - ports: - - "8004:8004" + # account_service: + # container_name: account_service + # build: + # context: . + # dockerfile: api_services/api_builds/account_service/Dockerfile + # env_file: + # - api_env.env + # networks: + # - wag-services + # environment: + # - API_PATH=app:app + # - API_HOST=0.0.0.0 + # - API_PORT=8004 + # - API_LOG_LEVEL=info + # - API_RELOAD=1 + # - API_APP_NAME=evyos-account-api-gateway + # - API_TITLE=WAG API Account Api Gateway + # - API_DESCRIPTION=This api is serves as web account api gateway only to evyos web services. + # - API_APP_URL=https://account_service + # ports: + # - "8004:8004" - building_service: - container_name: building_service - build: - context: . - dockerfile: api_services/api_builds/building_service/Dockerfile - env_file: - - api_env.env - networks: - - wag-services - environment: - - API_PATH=app:app - - API_HOST=0.0.0.0 - - API_PORT=8006 - - API_LOG_LEVEL=info - - API_RELOAD=1 - - API_APP_NAME=evyos-building-api-gateway - - API_TITLE=WAG API Building Api Gateway - - API_DESCRIPTION=This api is serves as web building api gateway only to evyos web services. - - API_APP_URL=https://building_service - ports: - - "8006:8006" + # building_service: + # container_name: building_service + # build: + # context: . + # dockerfile: api_services/api_builds/building_service/Dockerfile + # env_file: + # - api_env.env + # networks: + # - wag-services + # environment: + # - API_PATH=app:app + # - API_HOST=0.0.0.0 + # - API_PORT=8006 + # - API_LOG_LEVEL=info + # - API_RELOAD=1 + # - API_APP_NAME=evyos-building-api-gateway + # - API_TITLE=WAG API Building Api Gateway + # - API_DESCRIPTION=This api is serves as web building api gateway only to evyos web services. + # - API_APP_URL=https://building_service + # ports: + # - "8006:8006" identity_service: container_name: identity_service diff --git a/web_services/client_frontend/src/app/(DashboardLayout)/panel/[...page]/page.tsx b/web_services/client_frontend/src/app/(DashboardLayout)/panel/[...page]/page.tsx index 83a5c2d..85cddf1 100644 --- a/web_services/client_frontend/src/app/(DashboardLayout)/panel/[...page]/page.tsx +++ b/web_services/client_frontend/src/app/(DashboardLayout)/panel/[...page]/page.tsx @@ -9,11 +9,7 @@ const MainEnPage: React.FC = async ({ params, searchParam const searchParameters = await searchParams; const tokenValid = await checkAccessTokenIsValid() if (!tokenValid) { redirect("/auth/login") } - return ( -
- -
- ); + return
} export default MainEnPage; diff --git a/web_services/client_frontend/src/components/custom/content/PageToBeChildrendMulti.tsx b/web_services/client_frontend/src/components/custom/content/PageToBeChildrendMulti.tsx index 981473d..d5a43be 100644 --- a/web_services/client_frontend/src/components/custom/content/PageToBeChildrendMulti.tsx +++ b/web_services/client_frontend/src/components/custom/content/PageToBeChildrendMulti.tsx @@ -3,33 +3,28 @@ import ContentToRenderNoPage from "@/pages/mutual/noContent/page"; import pageIndexMulti from "@/pages/multi/index"; const PageToBeChildrendMulti: React.FC = ({ - lang, activePageUrl, - mode, userData, userLoading, userError, - selectionData, - selectionLoading, - selectionError, - useReloadWindow + onlineData, + onlineLoading, + onlineError, + searchParams, + refreshOnline, + updateOnline, + refreshUser, + updateUser, }) => { const pageComponents = pageIndexMulti[activePageUrl]; - if (!pageComponents) { return } + if (!pageComponents) { return } const ComponentKey = Object.keys(pageComponents)[0]; const PageComponent = pageComponents[ComponentKey]; - if (!PageComponent) { return } + if (!PageComponent) { return } return ; } diff --git a/web_services/client_frontend/src/components/custom/content/component.tsx b/web_services/client_frontend/src/components/custom/content/component.tsx index 4f0aa7f..721b1a6 100644 --- a/web_services/client_frontend/src/components/custom/content/component.tsx +++ b/web_services/client_frontend/src/components/custom/content/component.tsx @@ -1,82 +1,68 @@ 'use client'; - -import { FC, Suspense, useMemo, memo } from "react"; +import { FC, Suspense, memo } from "react"; import { ContentProps, ModeTypes, ModeTypesList } from "@/validations/mutual/dashboard/props"; +import { LanguageTypes } from "@/validations/mutual/language/validations"; import PageToBeChildrendMulti from "./PageToBeChildrendMulti"; import LoadingContent from "@/components/mutual/loader/component"; -// Create a memoized version of PageToBeChildrendMulti to prevent unnecessary re-renders const MemoizedMultiPage = memo(PageToBeChildrendMulti); -// const ContentComponent: FC = async ({ lang, translations, activePageUrl, isMulti, mode }) => { -// const modeFromQuery = ModeTypesList.includes(mode || '') ? mode : 'shortList' -// const renderProps = { lang, translations, activePageUrl, mode: modeFromQuery as ModeTypes } -// const PageToBeChildrend = isMulti ? PageToBeChildrendMulti : PageToBeChildrendSingle -// const loadingContent = -// const classNameDiv = "fixed top-24 left-80 right-0 py-10 px-15 border-emerald-150 border-l-2 overflow-y-auto h-[calc(100vh-64px)]" -// return
-// }; +const translations = { + en: { + errorLoadingContent: "Error Loading Content", + contentArea: "Content Area", + contentLoading: "Content Loading", + contentLoadingDescription: "The requested page is currently unavailable or still loading.", + pageUrl: "Page URL", + language: "Language", + }, + tr: { + errorLoadingContent: "İçerik Yüklenirken Hata", + contentArea: "İçerik Alanı", + contentLoading: "İçerik Yükleniyor", + contentLoadingDescription: "İçerik Yüklenirken Hata", + pageUrl: "Sayfa URL", + language: "Dil", + } +} -// Static fallback component to avoid state updates during render -const FallbackContent: FC<{ lang: string; activePageUrl: string; mode: string }> = memo(({ lang, activePageUrl, mode }) => ( +const FallbackContent: FC<{ lang: LanguageTypes; activePageUrl: string }> = memo(({ lang, activePageUrl }) => (
-

Content Loading

-

The requested page is currently unavailable or still loading.

+

{translations[lang].contentLoading}

+

{translations[lang].contentLoadingDescription}

-

Page URL: {activePageUrl}

-

Language: {lang}

-

Mode: {mode}

+

{translations[lang].pageUrl}: {activePageUrl}

+

{translations[lang].language}: {lang}

)); const ContentComponent: FC = ({ - lang, activePageUrl, mode, - userData, userLoading, userError, - selectionData, selectionLoading, selectionError, + searchParams, activePageUrl, mode, userData, userLoading, userError, refreshUser, updateUser, + onlineData, onlineLoading, onlineError, refreshOnline, updateOnline, }) => { - - const page = useMemo(() => { const extractedPage = activePageUrl.split('/').pop(); return extractedPage }, [activePageUrl]); - const modeFromQuery: string = ModeTypesList.includes(mode || '') ? (mode || 'shortList') : 'shortList'; const loadingContent = ; const classNameDiv = "fixed top-24 left-80 right-0 py-10 px-15 border-emerald-150 border-l-2 overflow-y-auto h-[calc(100vh-64px)]"; + const lang = onlineData?.lang as LanguageTypes || 'en'; - if (selectionLoading || userLoading) { return
{loadingContent}
} - if (selectionError || userError) { - return
-
-

Error Loading Content

-

{selectionError || userError}

+ if (userLoading) { return
{loadingContent}
} + if (userError) { + return ( +
+

{translations[lang].errorLoadingContent}

{userError}

-
+ ) } return (
-

Content Area

- - {/* Fallback Content */} - {(!userData || !selectionData) && ( - - )} - - {/* Wrap component in memo to prevent unnecessary re-renders */} +

{translations[lang].contentArea}

+ {(!userData) && ()} + activePageUrl={activePageUrl || ''} searchParams={searchParams} + userData={userData} userLoading={userLoading} userError={userError} refreshUser={refreshUser} updateUser={updateUser} + onlineData={onlineData} onlineLoading={onlineLoading} onlineError={onlineError} refreshOnline={refreshOnline} updateOnline={updateOnline} />
diff --git a/web_services/client_frontend/src/components/custom/footer/component.tsx b/web_services/client_frontend/src/components/custom/footer/component.tsx index 5856c50..fbdd45b 100644 --- a/web_services/client_frontend/src/components/custom/footer/component.tsx +++ b/web_services/client_frontend/src/components/custom/footer/component.tsx @@ -2,6 +2,7 @@ import { FC } from "react"; import { langGetKey } from "@/lib/langGet"; import { FooterProps } from "@/validations/mutual/dashboard/props"; +import { LanguageTypes } from "@/validations/mutual/language/validations"; const translations = { en: { @@ -15,9 +16,11 @@ const translations = { } const FooterComponent: FC = ({ - lang, activePageUrl, useReloadWindow, configData, configLoading, configError + activePageUrl, configData, configLoading, configError, + onlineData, onlineLoading, onlineError }) => { // Use the config context hook + const lang = onlineData?.lang as LanguageTypes || 'en'; return (
diff --git a/web_services/client_frontend/src/components/custom/header/component.tsx b/web_services/client_frontend/src/components/custom/header/component.tsx index 6f2cc6b..e913b6d 100644 --- a/web_services/client_frontend/src/components/custom/header/component.tsx +++ b/web_services/client_frontend/src/components/custom/header/component.tsx @@ -3,6 +3,7 @@ import { FC } from "react"; import { HeaderProps } from "@/validations/mutual/dashboard/props"; import { langGetKey } from "@/lib/langGet"; import LanguageSelectionComponent from "@/components/mutual/languageSelection/component"; +import { LanguageTypes } from "@/validations/mutual/language/validations"; const translations = { en: { @@ -16,10 +17,10 @@ const translations = { } const HeaderComponent: FC = ({ - lang, activePageUrl, prefix, mode, - onlineData, onlineLoading, onlineError, refreshOnline, updateOnline, - userData, userLoading, userError, + activePageUrl, onlineData, onlineLoading, onlineError, refreshOnline, updateOnline, + userData, userLoading, userError, refreshUser, updateUser }) => { + const lang = onlineData?.lang as LanguageTypes || 'en'; return (
@@ -29,12 +30,11 @@ const HeaderComponent: FC = ({
{!onlineLoading && onlineData && onlineData.userType && (
- {onlineData.lang || lang} + {lang} {onlineData.userType}
)}
diff --git a/web_services/client_frontend/src/components/custom/menu/component.tsx b/web_services/client_frontend/src/components/custom/menu/component.tsx index cd49e13..03d11d0 100644 --- a/web_services/client_frontend/src/components/custom/menu/component.tsx +++ b/web_services/client_frontend/src/components/custom/menu/component.tsx @@ -1,6 +1,7 @@ 'use client'; import { FC, Suspense } from "react"; import { MenuProps } from "@/validations/mutual/dashboard/props"; +import { LanguageTypes } from "@/validations/mutual/language/validations"; import UserProfileSection from "./userProfileSection"; import ClientSelectionSection from "./clientSelectionSection"; @@ -11,7 +12,7 @@ import MenuEmptyState from "./menuEmptyState"; import LoadingContent from "@/components/mutual/loader/component"; const MenuComponent: FC = ({ - lang, activePageUrl, useReloadWindow, availableApplications, + activePageUrl, availableApplications, prefix, onlineData, onlineLoading, onlineError, userData, userLoading, userError, selectionData, selectionLoading, selectionError, @@ -21,21 +22,21 @@ const MenuComponent: FC = ({ if (menuError) { return ; } // Render error state if (availableApplications.length === 0) { return ; } // Render empty state function handleClientSelection(client: any) { console.log('Client selected:', client) } + const lang = onlineData?.lang as LanguageTypes || 'en'; return (
{/* User Profile Section */} -
}> +
}> {/* Client Selection Section */} -
}> +
}> - {/* Menu Items Section */} -
}> - + }> + diff --git a/web_services/client_frontend/src/components/custom/menu/menuItemsSection.tsx b/web_services/client_frontend/src/components/custom/menu/menuItemsSection.tsx index 8dc45eb..4d25a1c 100644 --- a/web_services/client_frontend/src/components/custom/menu/menuItemsSection.tsx +++ b/web_services/client_frontend/src/components/custom/menu/menuItemsSection.tsx @@ -1,14 +1,13 @@ 'use client'; - -import { FC, useState, useEffect } from "react"; +import React, { FC, useEffect, useState } from "react"; +import { menuTranslation } from "@/languages/mutual/menu"; import FirstLayerDropdown from "./firstLayerComponent"; import SecondLayerDropdown from "./secondLayerComponent"; import ThirdLayerDropdown from "./thirdLayerComponent"; -import { parseURlFormString } from "@/lib/menuGet"; -import { menuTranslation } from "@/languages/mutual/menu"; -// Define types for menu structure -type ThirdLayerItem = Record; +type TranslationItem = { value: string; key: string }; +type ThirdLayerItemData = { path: string; translation: TranslationItem[] }; +type ThirdLayerItem = Record; type SecondLayerItems = Record; type FirstLayerItems = Record; type MenuStructure = FirstLayerItems; @@ -17,159 +16,86 @@ interface MenuItemsSectionProps { availableApplications: string[]; activePageUrl: string; lang: string; + prefix?: string; } -// Helper function to get translation for a URL path -const getMenuTranslation = (translations: any, urlPath: string) => { - if (translations[urlPath]) { - return translations[urlPath]; - } - const cleanPath = urlPath.startsWith('/') ? urlPath.substring(1) : urlPath; - if (translations[cleanPath]) { - return translations[cleanPath]; - } - const pathWithSlash = urlPath.startsWith('/') ? urlPath : `/${urlPath}`; - if (translations[pathWithSlash]) { - return translations[pathWithSlash]; - } - const keys = Object.keys(translations); - for (const key of keys) { - const cleanKey = key.startsWith('/') ? key.substring(1) : key; - const cleanUrlPath = urlPath.startsWith('/') ? urlPath.substring(1) : urlPath; +const menuStaticTranslation = { + tr: { menu: "Menü" }, + en: { menu: "Menu" } +} - if (cleanUrlPath.includes(cleanKey) || cleanKey.includes(cleanUrlPath)) { - return translations[key]; - } - } - const parts = urlPath.split('/'); - return parts[parts.length - 1] || urlPath; -}; - -const MenuItemsSection: FC = ({ availableApplications, activePageUrl, lang }) => { +const MenuItemsSection: FC = ({ availableApplications, activePageUrl, lang, prefix }) => { const [expandedFirstLayer, setExpandedFirstLayer] = useState(null); const [expandedSecondLayer, setExpandedSecondLayer] = useState(null); const [menuStructure, setMenuStructure] = useState({}); const menuTranslationWLang = menuTranslation[lang as keyof typeof menuTranslation]; - const activePathLayers = parseURlFormString(activePageUrl).data; - const activeFirstLayer = activePathLayers[0] || null; - const activeSecondLayer = activePathLayers[1] || null; - const activeThirdLayer = activePathLayers.slice(2, activePathLayers.length).join("/"); + const activeParsedLayer = (menuTranslationWLang[activePageUrl as keyof typeof menuTranslationWLang] as unknown as TranslationItem[]) || []; + const activeFirstLayer = activeParsedLayer[0] ? activeParsedLayer[0].key : null; + const activeSecondLayer = activeParsedLayer[1] ? activeParsedLayer[1].key : null; + const activeThirdLayer = activeParsedLayer[2] ? activeParsedLayer[2].key : null; useEffect(() => { const newMenuStructure: MenuStructure = {}; availableApplications.forEach((appPath: string) => { - const cleanPath = appPath.startsWith('/') ? appPath.substring(1) : appPath; - const pathParts = cleanPath.split('/'); - if (pathParts.length >= 3) { - const firstLayer = pathParts[0]; - const secondLayer = pathParts[1]; - const thirdLayer = pathParts.slice(2).join('/'); + const pathTranslation = menuTranslationWLang[appPath as keyof typeof menuTranslationWLang] as unknown as TranslationItem[] | undefined; + if (pathTranslation && pathTranslation.length >= 3) { + const firstLayer = pathTranslation[0] ? pathTranslation[0].key : ''; + const secondLayer = pathTranslation[1] ? pathTranslation[1].key : ''; + const thirdLayer = pathTranslation[2] ? pathTranslation[2].key : ''; if (!newMenuStructure[firstLayer]) { newMenuStructure[firstLayer] = {} } if (!newMenuStructure[firstLayer][secondLayer]) { newMenuStructure[firstLayer][secondLayer] = {} } - newMenuStructure[firstLayer][secondLayer][thirdLayer] = true; + newMenuStructure[firstLayer][secondLayer][thirdLayer] = { path: appPath, translation: pathTranslation }; } }); setMenuStructure(newMenuStructure); - }, [availableApplications]); + }, [availableApplications, menuTranslationWLang]); - useEffect(() => { - if (activeFirstLayer) { - setExpandedFirstLayer(activeFirstLayer); - if (activeSecondLayer) { - setExpandedSecondLayer(activeSecondLayer) - } - } - }, [activeFirstLayer, activeSecondLayer]); - - const handleFirstLayerClick = (key: string) => { - if (expandedFirstLayer === key) { - setExpandedFirstLayer(null); - setExpandedSecondLayer(null) - } else { - setExpandedFirstLayer(key); - setExpandedSecondLayer(null) - } - }; - - const handleSecondLayerClick = (key: string) => { - if (expandedSecondLayer === key) { - setExpandedSecondLayer(null) - } else { - setExpandedSecondLayer(key) - } - }; + useEffect(() => { if (activeFirstLayer) { setExpandedFirstLayer(activeFirstLayer); if (activeSecondLayer) { setExpandedSecondLayer(activeSecondLayer) } } }, [activeFirstLayer, activeSecondLayer]); + const handleFirstLayerClick = (key: string) => { if (expandedFirstLayer === key) { setExpandedFirstLayer(null); setExpandedSecondLayer(null) } else { setExpandedFirstLayer(key); setExpandedSecondLayer(null) } }; + const handleSecondLayerClick = (key: string) => { if (expandedSecondLayer === key) { setExpandedSecondLayer(null) } else { setExpandedSecondLayer(key) } }; const renderThirdLayerItems = (firstLayerKey: string, secondLayerKey: string, thirdLayerItems: ThirdLayerItem) => { - const baseUrl = `/${firstLayerKey}/${secondLayerKey}`; - return Object.keys(thirdLayerItems).map(thirdLayerKey => { + return Object.entries(thirdLayerItems).map(([thirdLayerKey, itemData]) => { const isActive = activeFirstLayer === firstLayerKey && activeSecondLayer === secondLayerKey && activeThirdLayer === thirdLayerKey; - const mergeUrl = `${baseUrl}/${thirdLayerKey}`; - const url = `/${lang}${baseUrl}/${thirdLayerKey}`; - return ( -
- -
- ); + const url = itemData ? itemData.path || '' : ''; + const translation = itemData ? itemData.translation || [] : []; + const displayText = translation[2]?.value || thirdLayerKey; + return
; }); }; - const renderSecondLayerItems = (firstLayerKey: string, secondLayerItems: SecondLayerItems) => { return Object.entries(secondLayerItems).map(([secondLayerKey, thirdLayerItems]) => { const isActive = activeFirstLayer === firstLayerKey && activeSecondLayer === secondLayerKey; const isExpanded = expandedSecondLayer === secondLayerKey; - const mergeUrl = `/${firstLayerKey}/${secondLayerKey}`; + const anyThirdLayerItem = Object.values(thirdLayerItems)[0]; + const translation = anyThirdLayerItem ? anyThirdLayerItem.translation : []; + const displayText = translation[1]?.value || secondLayerKey; return (
- handleSecondLayerClick(secondLayerKey)} - /> - {isExpanded && ( -
- {renderThirdLayerItems(firstLayerKey, secondLayerKey, thirdLayerItems)} -
- )} + handleSecondLayerClick(secondLayerKey)} /> + {isExpanded &&
{renderThirdLayerItems(firstLayerKey, secondLayerKey, thirdLayerItems)}
}
); }); }; - const renderFirstLayerItems = () => { return Object.entries(menuStructure).map(([firstLayerKey, secondLayerItems]) => { const isActive = activeFirstLayer === firstLayerKey; const isExpanded = expandedFirstLayer === firstLayerKey; - const mergeUrl = `/${firstLayerKey}`; + const anySecondLayer = Object.values(secondLayerItems)[0]; + const anyThirdLayerItem = anySecondLayer ? Object.values(anySecondLayer)[0] : null; + const translation = anyThirdLayerItem ? anyThirdLayerItem.translation : []; + const displayText = translation[0]?.value || firstLayerKey; return (
- handleFirstLayerClick(firstLayerKey)} - /> - {isExpanded && ( -
- {renderSecondLayerItems(firstLayerKey, secondLayerItems)} -
- )} + handleFirstLayerClick(firstLayerKey)} /> + {isExpanded &&
{renderSecondLayerItems(firstLayerKey, secondLayerItems)}
}
); }); }; - - return ( -
-

Menu

- {renderFirstLayerItems()} -
- ); + return

{menuStaticTranslation[lang as keyof typeof menuStaticTranslation].menu}

{renderFirstLayerItems()}
; }; export default MenuItemsSection; diff --git a/web_services/client_frontend/src/components/custom/menu/userProfileSection.tsx b/web_services/client_frontend/src/components/custom/menu/userProfileSection.tsx index 088f547..a833251 100644 --- a/web_services/client_frontend/src/components/custom/menu/userProfileSection.tsx +++ b/web_services/client_frontend/src/components/custom/menu/userProfileSection.tsx @@ -17,9 +17,7 @@ const UserProfileSection: FC = ({ userData, onlineData
- {userData && userData.avatar ? ( - Avatar - ) : ( + {userData && userData.avatar ? (Avatar) : (
{userData?.email ? userData.email.slice(0, 2).toUpperCase() : 'U'}
diff --git a/web_services/client_frontend/src/components/mutual/context/online/context.ts b/web_services/client_frontend/src/components/mutual/context/online/context.ts index 750eb5f..077ff63 100644 --- a/web_services/client_frontend/src/components/mutual/context/online/context.ts +++ b/web_services/client_frontend/src/components/mutual/context/online/context.ts @@ -99,6 +99,7 @@ async function setContextPageOnline( body: JSON.stringify(setOnline), signal: controller.signal, }); + console.log("result", await result.json()); // Clear the timeout clearTimeout(timeoutId); diff --git a/web_services/client_frontend/src/components/mutual/languageSelection/component.tsx b/web_services/client_frontend/src/components/mutual/languageSelection/component.tsx index ece1e9c..1960b98 100644 --- a/web_services/client_frontend/src/components/mutual/languageSelection/component.tsx +++ b/web_services/client_frontend/src/components/mutual/languageSelection/component.tsx @@ -7,9 +7,7 @@ import { LanguageTypes } from "@/validations/mutual/language/validations"; import LanguageSelectionItem from "./languageItem"; interface LanguageSelectionComponentProps { - lang: LanguageTypes; activePage: string; - prefix: string; onlineData: any; onlineLoading: boolean; onlineError: any; @@ -17,13 +15,14 @@ interface LanguageSelectionComponentProps { updateOnline: (newOnline: any) => Promise; } -const LanguageSelectionComponent: React.FC = ({ lang, activePage, prefix, onlineData, onlineLoading, onlineError, refreshOnline, updateOnline }) => { +const LanguageSelectionComponent: React.FC = ({ activePage, onlineData, onlineLoading, onlineError, refreshOnline, updateOnline }) => { + const lang = onlineData?.lang as LanguageTypes || 'en'; const translations = langGet(lang, languageSelectionTranslation); - const getPageWithLocale = (locale: LanguageTypes): string => { return `${prefix}/${activePage}` } const languageButtons = [ - { activeLang: lang, buttonsLang: "en", refUrl: getPageWithLocale("en"), innerText: langGetKey(translations, "english") }, - { activeLang: lang, buttonsLang: "tr", refUrl: getPageWithLocale("tr"), innerText: langGetKey(translations, "turkish") } - ] + { activeLang: lang, buttonsLang: "en", refUrl: "en", innerText: langGetKey(translations, "english") }, + { activeLang: lang, buttonsLang: "tr", refUrl: "tr", innerText: langGetKey(translations, "turkish") } + ]; + return (
@@ -32,8 +31,8 @@ const LanguageSelectionComponent: React.FC = ({ {languageButtons.map((props, index) => ( - + ))} diff --git a/web_services/client_frontend/src/languages/mutual/menu/english.ts b/web_services/client_frontend/src/languages/mutual/menu/english.ts index d9b00dd..677625e 100644 --- a/web_services/client_frontend/src/languages/mutual/menu/english.ts +++ b/web_services/client_frontend/src/languages/mutual/menu/english.ts @@ -1,27 +1,176 @@ +// const menuTranslationEn = { +// "/definitions/identifications/people": "People", +// "/definitions/identifications/users": "Users", + +// "/definitions/building/parts": "Build Parts", +// "/definitions/building/areas": "Building Areas", + +// "/building/accounts/managment/accounts": "Management Accounts", +// "/building/accounts/managment/budgets": "Management Budgets", +// "/building/accounts/parts/accounts": "Parts Accounts", +// "/building/accounts/parts/budgets": "Parts Budgets", + +// "/building/meetings/regular/actions": "Regular Meeting Actions", +// "/building/meetings/regular/accounts": "Regular Meeting Accounts", +// "/building/meetings/ergunt/actions": "Ergunt Meeting Actions", +// "/building/meetings/ergunt/accounts": "Ergunt Meeting Accounts", +// "/building/meetings/invited/attendance": "Meeting Invited Attendance", +// }; + const menuTranslationEn = { - "/definitions": "Definitions", - "/definitions/identifications": "Identifications", - "/definitions/identifications/people": "People", - "/definitions/identifications/users": "Users", + // New menu + "/dashboard": [ + { value: "Dashboard", key: "dashboard" }, + { value: "Dashboard", key: "dashboard" }, + { value: "Dashboard", key: "dashboard" }, + ], + "/individual": [ + { value: "Individual", key: "individual" }, + { value: "Individual", key: "individual" }, + { value: "Individual", key: "individual" }, + ], + "/user": [ + { value: "User", key: "user" }, + { value: "User", key: "user" }, + { value: "User", key: "user" }, + ], + "/build": [ + { value: "Build", key: "build" }, + { value: "Build", key: "build" }, + { value: "Build", key: "build" }, + ], + "/build/parts": [ + { value: "Build", key: "build" }, + { value: "Parts", key: "parts" }, + { value: "Build", key: "build" }, + ], + "/management/budget/actions": [ + { value: "Management", key: "management" }, + { value: "Budget", key: "budget" }, + { value: "Actions", key: "actions" }, + ], + "/management/budget": [ + { value: "Management", key: "management" }, + { value: "Budget", key: "budget" }, + { value: "Budget", key: "budget" }, + ], + "/annual/meeting/close": [ + { value: "Annual", key: "annual" }, + { value: "Meeting", key: "meeting" }, + { value: "Close", key: "close" }, + ], + "/emergency/meeting": [ + { value: "Emergency", key: "emergency" }, + { value: "Meeting", key: "meeting" }, + { value: "Meeting", key: "meeting" }, + ], + "/emergency/meeting/close": [ + { value: "Emergency", key: "emergency" }, + { value: "Meeting", key: "meeting" }, + { value: "Close", key: "close" }, + ], + "/tenant/accounting": [ + { value: "Tenant", key: "tenant" }, + { value: "Accounting", key: "accounting" }, + { value: "Accounting", key: "accounting" }, + ], + "/meeting/participation": [ + { value: "Meeting", key: "meeting" }, + { value: "Participation", key: "participation" }, + { value: "Participation", key: "participation" }, + ], + "/tenant/messageToBM": [ + { value: "Tenant", key: "tenant" }, + { value: "Message To BM", key: "messageToBM" }, + { value: "Message To BM", key: "messageToBM" }, + ], + "/tenant/messageToOwner": [ + { value: "Tenant", key: "tenant" }, + { value: "Message To Owner", key: "messageToOwner" }, + { value: "Message To Owner", key: "messageToOwner" }, + ], + "/management/accounting": [ + { value: "Management", key: "management" }, + { value: "Accounting", key: "accounting" }, + { value: "Accounting", key: "accounting" }, + ], + "/build/area": [ + { value: "Build", key: "build" }, + { value: "Area", key: "area" }, + { value: "Area", key: "area" }, + ], + "/management/budget/status": [ + { value: "Management", key: "management" }, + { value: "Budget", key: "budget" }, + { value: "Status", key: "status" }, + ], - "/definitions/building": "Building", - "/definitions/building/parts": "Build Parts", - "/definitions/building/areas": "Building Areas", - - "/building": "Building", - "/building/accounts": "Account Actions", - "/building/accounts/managment/accounts": "Management Accounts", - "/building/accounts/managment/budgets": "Management Budgets", - "/building/accounts/parts/accounts": "Parts Accounts", - "/building/accounts/parts/budgets": "Parts Budgets", - - "/building/meetings": "Meetings", - "/building/meetings/regular/actions": "Regular Meeting Actions", - "/building/meetings/regular/accounts": "Regular Meeting Accounts", - "/building/meetings/ergunt/actions": "Ergunt Meeting Actions", - "/building/meetings/ergunt/accounts": "Ergunt Meeting Accounts", - "/building/meetings/invited/attendance": "Meeting Invited Attendance", + // Early menu + "/definitions/identifications/people": [ + { value: "Definitions", key: "definitions" }, + { value: "Identifications", key: "identifications" }, + { value: "People", key: "people" }, + ], + "/definitions/identifications/users": [ + { value: "Definitions", key: "definitions" }, + { value: "Identifications", key: "identifications" }, + { value: "Users", key: "users" }, + ], + "/definitions/building/parts": [ + { value: "Definitions", key: "definitions" }, + { value: "Building", key: "building" }, + { value: "Parts", key: "parts" }, + ], + "/definitions/building/areas": [ + { value: "Definitions", key: "definitions" }, + { value: "Building", key: "building" }, + { value: "Areas", key: "areas" }, + ], + "/building/accounts/managment/accounts": [ + { value: "Building", key: "building" }, + { value: "Accounts", key: "accounts" }, + { value: "Managment", key: "managment" }, + ], + "/building/accounts/managment/budgets": [ + { value: "Building", key: "building" }, + { value: "Accounts", key: "accounts" }, + { value: "Managment", key: "managment" }, + ], + "/building/accounts/parts/accounts": [ + { value: "Building", key: "building" }, + { value: "Accounts", key: "accounts" }, + { value: "Parts", key: "parts" }, + ], + "/building/accounts/parts/budgets": [ + { value: "Building", key: "building" }, + { value: "Accounts", key: "accounts" }, + { value: "Parts", key: "parts" }, + ], + "/building/meetings/regular/actions": [ + { value: "Building", key: "building" }, + { value: "Meetings", key: "meetings" }, + { value: "Regular", key: "regular" }, + ], + "/building/meetings/regular/accounts": [ + { value: "Building", key: "building" }, + { value: "Meetings", key: "meetings" }, + { value: "Regular", key: "regular" }, + ], + "/building/meetings/ergunt/actions": [ + { value: "Building", key: "building" }, + { value: "Meetings", key: "meetings" }, + { value: "Ergunt", key: "ergunt" }, + ], + "/building/meetings/ergunt/accounts": [ + { value: "Building", key: "building" }, + { value: "Meetings", key: "meetings" }, + { value: "Ergunt", key: "ergunt" }, + ], + "/building/meetings/invited/attendance": [ + { value: "Building", key: "building" }, + { value: "Meetings", key: "meetings" }, + { value: "Invited", key: "invited" }, + ], }; export { menuTranslationEn }; -// export { menuTranslationEn, menuIndex }; diff --git a/web_services/client_frontend/src/languages/mutual/menu/turkish.ts b/web_services/client_frontend/src/languages/mutual/menu/turkish.ts index d4ec7cf..11c59d9 100644 --- a/web_services/client_frontend/src/languages/mutual/menu/turkish.ts +++ b/web_services/client_frontend/src/languages/mutual/menu/turkish.ts @@ -1,26 +1,176 @@ +// const menuTranslationTr = { +// "/definitions/identifications/people": "Kişiler", +// "/definitions/identifications/users": "Kullanıcılar", + +// "/definitions/building/parts": "Daireler", +// "/definitions/building/areas": "Bina Alanları", + +// "/building/accounts/managment/accounts": "Bina Hesapları", +// "/building/accounts/managment/budgets": "Bina Bütçesi", +// "/building/accounts/parts/accounts": "Daire Hesapları", +// "/building/accounts/parts/budgets": "Daire Bütçesi", + +// "/building/meetings/regular/actions": "Düzenli Toplantı Eylemleri", +// "/building/meetings/regular/accounts": "Düzenli Toplantı Accounts", +// "/building/meetings/ergunt/actions": "Ergunt Toplantı Eylemleri", +// "/building/meetings/ergunt/accounts": "Ergunt Toplantı Accounts", +// "/building/meetings/invited/attendance": "Toplantı Davetli Katılımlar", +// }; + const menuTranslationTr = { - "/definitions": "Tanımlamalar", - "/definitions/identifications": "Tanımlamalar", - "/definitions/identifications/people": "Kişiler", - "/definitions/identifications/users": "Kullanıcılar", + // New menu + "/dashboard": [ + { value: "Dashboard", key: "dashboard" }, + { value: "Dashboard", key: "dashboard" }, + { value: "Dashboard", key: "dashboard" }, + ], + "/individual": [ + { value: "Individual", key: "individual" }, + { value: "Individual", key: "individual" }, + { value: "Individual", key: "individual" }, + ], + "/user": [ + { value: "User", key: "user" }, + { value: "User", key: "user" }, + { value: "User", key: "user" }, + ], + "/build": [ + { value: "Build", key: "build" }, + { value: "Build", key: "build" }, + { value: "Build", key: "build" }, + ], + "/build/parts": [ + { value: "Build", key: "build" }, + { value: "Parts", key: "parts" }, + { value: "Build", key: "build" }, + ], + "/management/budget/actions": [ + { value: "Management", key: "management" }, + { value: "Budget", key: "budget" }, + { value: "Actions", key: "actions" }, + ], + "/management/budget": [ + { value: "Management", key: "management" }, + { value: "Budget", key: "budget" }, + { value: "Budget", key: "budget" }, + ], + "/annual/meeting/close": [ + { value: "Annual", key: "annual" }, + { value: "Meeting", key: "meeting" }, + { value: "Close", key: "close" }, + ], + "/emergency/meeting": [ + { value: "Emergency", key: "emergency" }, + { value: "Meeting", key: "meeting" }, + { value: "Meeting", key: "meeting" }, + ], + "/emergency/meeting/close": [ + { value: "Emergency", key: "emergency" }, + { value: "Meeting", key: "meeting" }, + { value: "Close", key: "close" }, + ], + "/tenant/accounting": [ + { value: "Tenant", key: "tenant" }, + { value: "Accounting", key: "accounting" }, + { value: "Accounting", key: "accounting" }, + ], + "/meeting/participation": [ + { value: "Meeting", key: "meeting" }, + { value: "Participation", key: "participation" }, + { value: "Participation", key: "participation" }, + ], + "/tenant/messageToBM": [ + { value: "Tenant", key: "tenant" }, + { value: "Message To BM", key: "messageToBM" }, + { value: "Message To BM", key: "messageToBM" }, + ], + "/tenant/messageToOwner": [ + { value: "Tenant", key: "tenant" }, + { value: "Message To Owner", key: "messageToOwner" }, + { value: "Message To Owner", key: "messageToOwner" }, + ], + "/management/accounting": [ + { value: "Management", key: "management" }, + { value: "Accounting", key: "accounting" }, + { value: "Accounting", key: "accounting" }, + ], + "/build/area": [ + { value: "Build", key: "build" }, + { value: "Area", key: "area" }, + { value: "Area", key: "area" }, + ], + "/management/budget/status": [ + { value: "Management", key: "management" }, + { value: "Budget", key: "budget" }, + { value: "Status", key: "status" }, + ], - "/definitions/building": "Bina", - "/definitions/building/parts": "Daireler", - "/definitions/building/areas": "Bina Alanları", - - "/building": "Bina", - "/building/accounts": "Account Eylemleri", - "/building/accounts/managment/accounts": "Bina Hesapları", - "/building/accounts/managment/budgets": "Bina Bütçesi", - "/building/accounts/parts/accounts": "Daire Hesapları", - "/building/accounts/parts/budgets": "Daire Bütçesi", - - "/building/meetings": "Toplantılar", - "/building/meetings/regular/actions": "Düzenli Toplantı Eylemleri", - "/building/meetings/regular/accounts": "Düzenli Toplantı Accounts", - "/building/meetings/ergunt/actions": "Ergunt Toplantı Eylemleri", - "/building/meetings/ergunt/accounts": "Ergunt Toplantı Accounts", - "/building/meetings/invited/attendance": "Toplantı Davetli Katılımlar", + // Early menu + "/definitions/identifications/people": [ + { value: "Tanımlamalar", key: "definitions" }, + { value: "Tanımlamalar", key: "identifications" }, + { value: "Kişiler", key: "people" }, + ], + "/definitions/identifications/users": [ + { value: "Tanımlamalar", key: "definitions" }, + { value: "Tanımlamalar", key: "identifications" }, + { value: "Kullanıcılar", key: "users" }, + ], + "/definitions/building/parts": [ + { value: "Tanımlamalar", key: "definitions" }, + { value: "Bina", key: "building" }, + { value: "Daireler", key: "parts" }, + ], + "/definitions/building/areas": [ + { value: "Tanımlamalar", key: "definitions" }, + { value: "Bina", key: "building" }, + { value: "Bina Alanları", key: "areas" }, + ], + "/building/accounts/managment/accounts": [ + { value: "Bina", key: "building" }, + { value: "Hesap Eylemleri", key: "accounts" }, + { value: "Yönetim", key: "managment" }, + ], + "/building/accounts/managment/budgets": [ + { value: "Bina", key: "building" }, + { value: "Hesap Eylemleri", key: "accounts" }, + { value: "Yönetim", key: "managment" }, + ], + "/building/accounts/parts/accounts": [ + { value: "Bina", key: "building" }, + { value: "Hesap Eylemleri", key: "accounts" }, + { value: "Daireler", key: "parts" }, + ], + "/building/accounts/parts/budgets": [ + { value: "Bina", key: "building" }, + { value: "Hesap Eylemleri", key: "accounts" }, + { value: "Daireler", key: "parts" }, + ], + "/building/meetings/regular/actions": [ + { value: "Bina", key: "building" }, + { value: "Toplantılar", key: "meetings" }, + { value: "Düzenli", key: "regular" }, + ], + "/building/meetings/regular/accounts": [ + { value: "Bina", key: "building" }, + { value: "Toplantılar", key: "meetings" }, + { value: "Düzenli", key: "regular" }, + ], + "/building/meetings/ergunt/actions": [ + { value: "Bina", key: "building" }, + { value: "Toplantılar", key: "meetings" }, + { value: "Acil", key: "ergunt" }, + ], + "/building/meetings/ergunt/accounts": [ + { value: "Bina", key: "building" }, + { value: "Toplantılar", key: "meetings" }, + { value: "Acil", key: "ergunt" }, + ], + "/building/meetings/invited/attendance": [ + { value: "Bina", key: "building" }, + { value: "Toplantılar", key: "meetings" }, + { value: "Davetli", key: "invited" }, + ], }; export { menuTranslationTr }; diff --git a/web_services/client_frontend/src/layouts/dashboard/client.tsx b/web_services/client_frontend/src/layouts/dashboard/client.tsx index 2f6d902..721841f 100644 --- a/web_services/client_frontend/src/layouts/dashboard/client.tsx +++ b/web_services/client_frontend/src/layouts/dashboard/client.tsx @@ -1,68 +1,48 @@ 'use client'; - -import HeaderComponent from "@/components/custom/header/component"; -import MenuComponent from "@/components/custom/menu/component"; -import ContentComponent from "@/components/custom/content/component"; -import FooterComponent from "@/components/custom/footer/component"; -import React, { FC, useEffect } from 'react'; +import React, { FC } from 'react'; import { ClientProviders } from "@/components/mutual/providers/client-providers"; -import { ClientOnline, ClientMenu, ClientSelection, ClientUser, ClientSettings } from "@/types/mutual/context/validations"; import { ModeTypes } from "@/validations/mutual/dashboard/props"; -import type { LanguageTypes } from "@/validations/mutual/language/validations"; - -// Import all context hooks import { useMenu } from "@/components/mutual/context/menu/context"; import { useOnline } from "@/components/mutual/context/online/context"; import { useSelection } from "@/components/mutual/context/selection/context"; import { useUser } from "@/components/mutual/context/user/context"; import { useConfig } from "@/components/mutual/context/config/context"; -interface ClientLayoutProps { - allProps: { - lang: LanguageTypes; - activePageUrl: string; - mode: ModeTypes; - prefix: string; - }; - packs?: { - menu?: ClientMenu; - selection?: ClientSelection; - user?: ClientUser; - settings?: ClientSettings; - online?: ClientOnline; - }; - useReloadWindow?: () => void; -} +import HeaderComponent from "@/components/custom/header/component"; +import MenuComponent from "@/components/custom/menu/component"; +import ContentComponent from "@/components/custom/content/component"; +import FooterComponent from "@/components/custom/footer/component"; + +interface ClientLayoutProps { activePageUrl: string, searchParams: Record } + +const ClientLayout: FC = ({ activePageUrl, searchParams }) => { -const ClientLayout: FC = ({ allProps }) => { const { onlineData, isLoading: onlineLoading, error: onlineError, refreshOnline, updateOnline } = useOnline(); - const { userData, isLoading: userLoading, error: userError } = useUser(); - const { availableApplications, isLoading: menuLoading, error: menuError, menuData, refreshMenu } = useMenu(); - const { selectionData, isLoading: selectionLoading, error: selectionError } = useSelection(); - const { configData, isLoading: configLoading, error: configError } = useConfig(); + const { userData, isLoading: userLoading, error: userError, refreshUser, updateUser } = useUser(); + const { availableApplications, isLoading: menuLoading, error: menuError, menuData, refreshMenu, updateMenu } = useMenu(); + const { selectionData, isLoading: selectionLoading, error: selectionError, refreshSelection, updateSelection } = useSelection(); + const { configData, isLoading: configLoading, error: configError, refreshConfig, updateConfig } = useConfig(); + const prefix = "/panel" + const mode = (searchParams?.mode as ModeTypes) || 'shortList'; + console.log("onlineData", onlineData) return (
- - - - + + + +
); diff --git a/web_services/client_frontend/src/layouts/dashboard/layout.tsx b/web_services/client_frontend/src/layouts/dashboard/layout.tsx index 39ea4e8..386facf 100644 --- a/web_services/client_frontend/src/layouts/dashboard/layout.tsx +++ b/web_services/client_frontend/src/layouts/dashboard/layout.tsx @@ -1,13 +1,10 @@ 'use server'; import { FC } from "react"; -import { DashboardLayoutProps, ModeTypes } from "@/validations/mutual/dashboard/props"; +import { DashboardLayoutProps } from "@/validations/mutual/dashboard/props"; import { ClientLayout } from "./client"; -const DashboardLayout: FC = async ({ params, searchParams, lang }) => { - const mode = (searchParams?.mode as ModeTypes) || 'shortList'; - const activePageUrl = `/${params.page?.join('/')}`; - const allProps = { lang: lang || '', activePageUrl, mode, prefix: "/panel" }; - return +const DashboardLayout: FC = async ({ params, searchParams }) => { + const activePageUrl = `/${params.page?.join('/')}`; return } export { DashboardLayout }; diff --git a/web_services/client_frontend/src/pages/multi/index.ts b/web_services/client_frontend/src/pages/multi/index.ts index 1612cad..d192c52 100644 --- a/web_services/client_frontend/src/pages/multi/index.ts +++ b/web_services/client_frontend/src/pages/multi/index.ts @@ -1,8 +1,85 @@ import { ContentProps } from "@/validations/mutual/dashboard/props"; import superUserBuildingPartsTenantSomething from "./building/parts/tenantSomething/page"; +function getPageComponent( + baseUrl: string, + pageKey: string +): React.FC | null { + const pageGroup = pageIndexMulti[baseUrl]; + if (!pageGroup) { + console.log(`No page group found for URL: ${baseUrl}`); + return null; + } + + const PageComponent = pageGroup[pageKey]; + if (!PageComponent) { + console.log( + `No page component found for key: ${pageKey} in URL group: ${baseUrl}` + ); + return null; + } + + return PageComponent; +} + const pageIndexMulti: Record>> = { - "/main/pages/user/dashboard": { superUserBuildingPartsTenantSomething }, + // New pages + "/dashboard": { + superUserBuildingPartsTenantSomething, + }, + "/individual": { + superUserBuildingPartsTenantSomething, + }, + "/user": { + superUserBuildingPartsTenantSomething, + }, + "/build": { + superUserBuildingPartsTenantSomething, + }, + "/build/parts": { + superUserBuildingPartsTenantSomething, + }, + "/management/budget/actions": { + superUserBuildingPartsTenantSomething, + }, + "/management/budget": { + superUserBuildingPartsTenantSomething, + }, + "/annual/meeting/close": { + superUserBuildingPartsTenantSomething, + }, + "/emergency/meeting": { + superUserBuildingPartsTenantSomething, + }, + "/emergency/meeting/close": { + superUserBuildingPartsTenantSomething, + }, + "/tenant/accounting": { + superUserBuildingPartsTenantSomething, + }, + "/meeting/participation": { + superUserBuildingPartsTenantSomething, + }, + "/tenant/messageToBM": { + superUserBuildingPartsTenantSomething, + }, + "/tenant/messageToOwner": { + superUserBuildingPartsTenantSomething, + }, + "/management/accounting": { + superUserBuildingPartsTenantSomething, + }, + "/build/area": { + superUserBuildingPartsTenantSomething, + }, + "/management/budget/status": { + superUserBuildingPartsTenantSomething, + }, + + // Early pages + "/main/pages/user/dashboard": { + superUserBuildingPartsTenantSomething, + }, "/definitions/identifications/people": { superUserBuildingPartsTenantSomething, }, diff --git a/web_services/client_frontend/src/pages/resolver/resolver.tsx b/web_services/client_frontend/src/pages/resolver/resolver.tsx index 4edac01..cc58542 100644 --- a/web_services/client_frontend/src/pages/resolver/resolver.tsx +++ b/web_services/client_frontend/src/pages/resolver/resolver.tsx @@ -7,7 +7,7 @@ import pageIndexMulti from "@/pages/multi/index"; import pageIndexSingle from "@/pages/single/index"; import ContentToRenderNoPage from "@/pages/mutual/noContent/page"; -async function resolveWhichPageToRenderSingle({ activePageUrl }: ResolverProps): Promise | null> { +async function resolveWhichPageToRenderSingle({ activePageUrl }: ResolverProps): Promise | React.FC<{ lang: string }> | null> { try { return `${activePageUrl}` in pageIndexSingle ? pageIndexSingle[`${activePageUrl}`] : ContentToRenderNoPage } catch (error) { @@ -16,7 +16,7 @@ async function resolveWhichPageToRenderSingle({ activePageUrl }: ResolverProps): return ContentToRenderNoPage } -async function resolveWhichPageToRenderMulti({ activePageUrl }: ResolverProps): Promise | null> { +async function resolveWhichPageToRenderMulti({ activePageUrl }: ResolverProps): Promise | React.FC<{ lang: string }> | null> { const pageToRender = await retrievePageToRender(activePageUrl) // TODO: Retrieve page to render try { const ApplicationToRender = pageIndexMulti[activePageUrl][pageToRender] diff --git a/web_services/client_frontend/src/validations/mutual/dashboard/props.ts b/web_services/client_frontend/src/validations/mutual/dashboard/props.ts index 36a36c2..33ccf99 100644 --- a/web_services/client_frontend/src/validations/mutual/dashboard/props.ts +++ b/web_services/client_frontend/src/validations/mutual/dashboard/props.ts @@ -16,49 +16,9 @@ type ModeTypes = "shortList" | "fullList" | "create" | "update" | "view"; const ModeTypesList = ["shortList", "fullList", "create", "update", "view"]; interface ContentProps { - lang: LanguageTypes; activePageUrl: string; mode?: ModeTypes; - userData: any; - userLoading: boolean; - userError: any; - selectionData: any; - selectionLoading: boolean; - selectionError: any; -} - -interface MenuProps { - lang: LanguageTypes; - availableApplications: string[]; - activePageUrl: string; - onlineData: any; - onlineLoading: boolean; - onlineError: any; - userData: any; - userLoading: boolean; - userError: any; - selectionData: any; - selectionLoading: boolean; - selectionError: any; - menuData: any; - menuLoading: boolean; - menuError: any; -} - -interface FooterProps { - lang: LanguageTypes; - availableApplications: string[]; - activePageUrl: string; - configData: any; - configLoading: boolean; - configError: any; -} - -interface HeaderProps { - lang: LanguageTypes; - activePageUrl: string; - prefix: string; - mode?: ModeTypes; + searchParams: Record; onlineData: any; onlineLoading: boolean; onlineError: any; @@ -67,6 +27,65 @@ interface HeaderProps { userData: any; userLoading: boolean; userError: any; + refreshUser: () => Promise; + updateUser: (newUser: any) => Promise; +} + +interface MenuProps { + availableApplications: string[]; + searchParams: Record; + activePageUrl: string; + prefix?: string; + onlineData: any; + onlineLoading: boolean; + onlineError: any; + refreshOnline: () => Promise; + updateOnline: (newOnline: any) => Promise; + userData: any; + userLoading: boolean; + userError: any; + refreshUser: () => Promise; + updateUser: (newUser: any) => Promise; + selectionData: any; + selectionLoading: boolean; + selectionError: any; + refreshSelection: () => Promise; + updateSelection: (newSelection: any) => Promise; + menuData: any; + menuLoading: boolean; + menuError: any; + refreshMenu: () => Promise; + updateMenu: (newMenu: any) => Promise; +} + +interface FooterProps { + searchParams: Record; + activePageUrl: string; + configData: any; + configLoading: boolean; + configError: any; + refreshConfig: () => Promise; + updateConfig: (newConfig: any) => Promise; + onlineData: any; + onlineLoading: boolean; + onlineError: any; + refreshOnline: () => Promise; + updateOnline: (newOnline: any) => Promise; +} + +interface HeaderProps { + activePageUrl: string; + searchParams: Record; + onlineData: any; + onlineLoading: boolean; + onlineError: any; + refreshOnline: () => Promise; + updateOnline: (newOnline: any) => Promise; + userData: any; + userLoading: boolean; + userError: any; + refreshUser: () => Promise; + updateUser: (newUser: any) => Promise; } export type {