diff --git a/web_services/client_frontend/src/app/(AuthLayout)/auth/[lang]/login/page.tsx b/web_services/client_frontend/src/app/(AuthLayout)/auth/[lang]/login/page.tsx
deleted file mode 100644
index 5d6e483..0000000
--- a/web_services/client_frontend/src/app/(AuthLayout)/auth/[lang]/login/page.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-'use server';
-import Login from "@/webPages/auth/Login/page";
-
-const LoginPage = async () => { return };
-
-export default LoginPage;
diff --git a/web_services/client_frontend/src/app/(AuthLayout)/auth/en/[...page]/page.tsx b/web_services/client_frontend/src/app/(AuthLayout)/auth/en/[...page]/page.tsx
new file mode 100644
index 0000000..95b69c2
--- /dev/null
+++ b/web_services/client_frontend/src/app/(AuthLayout)/auth/en/[...page]/page.tsx
@@ -0,0 +1,15 @@
+'use server';
+import { AuthLayout } from "@/layouts/auth/layout";
+import { AuthServerProps } from "@/validations/mutual/pages/props";
+import getPage from "@/webPages/getPage";
+
+const AuthPageEn = async ({ params, searchParams }: AuthServerProps) => {
+ const lang = "en";
+ const awaitedParams = await params;
+ const awaitedSearchParams = await searchParams;
+ const pageUrlFromParams = `/${awaitedParams.page?.join("/")}` || "/login";
+ const FoundPage = getPage(pageUrlFromParams, { language: lang, query: awaitedSearchParams });
+ return
+}
+
+export default AuthPageEn;
diff --git a/web_services/client_frontend/src/app/(AuthLayout)/auth/tr/[...page]/page.tsx b/web_services/client_frontend/src/app/(AuthLayout)/auth/tr/[...page]/page.tsx
new file mode 100644
index 0000000..0932203
--- /dev/null
+++ b/web_services/client_frontend/src/app/(AuthLayout)/auth/tr/[...page]/page.tsx
@@ -0,0 +1,15 @@
+'use server';
+import { AuthServerProps } from "@/validations/mutual/pages/props";
+import { AuthLayout } from "@/layouts/auth/layout";
+import getPage from "@/webPages/getPage";
+
+const AuthPageTr = async ({ params, searchParams }: AuthServerProps) => {
+ const lang = "tr";
+ const awaitedParams = await params;
+ const awaitedSearchParams = await searchParams;
+ const pageUrlFromParams = `/${awaitedParams.page?.join("/")}` || "/login";
+ const FoundPage = getPage(pageUrlFromParams, { language: lang, query: awaitedSearchParams });
+ return
+}
+
+export default AuthPageTr;
diff --git a/web_services/client_frontend/src/app/(AuthLayout)/layout.tsx b/web_services/client_frontend/src/app/(AuthLayout)/layout.tsx
deleted file mode 100644
index 2353a89..0000000
--- a/web_services/client_frontend/src/app/(AuthLayout)/layout.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import type { Metadata } from "next";
-import { Suspense } from "react";
-
-export const metadata: Metadata = {
- title: "WAG Frontend",
- description: "WAG Frontend Application",
-};
-
-export default function AuthLayout({
- children,
-}: {
- children: React.ReactNode;
-}) {
- return (
-
-
-
-
WAG Frontend
-
- Welcome to the WAG Frontend Application
-
-
-
-
- Loading...
}>{children}
-
-
- );
-}
diff --git a/web_services/client_frontend/src/app/(DashboardLayout)/en/[...page]/page.tsx b/web_services/client_frontend/src/app/(DashboardLayout)/panel/en/[...page]/page.tsx
similarity index 100%
rename from web_services/client_frontend/src/app/(DashboardLayout)/en/[...page]/page.tsx
rename to web_services/client_frontend/src/app/(DashboardLayout)/panel/en/[...page]/page.tsx
diff --git a/web_services/client_frontend/src/app/(DashboardLayout)/en/page.tsx b/web_services/client_frontend/src/app/(DashboardLayout)/panel/en/page.tsx
similarity index 100%
rename from web_services/client_frontend/src/app/(DashboardLayout)/en/page.tsx
rename to web_services/client_frontend/src/app/(DashboardLayout)/panel/en/page.tsx
diff --git a/web_services/client_frontend/src/app/(DashboardLayout)/tr/[...page]/page.tsx b/web_services/client_frontend/src/app/(DashboardLayout)/panel/tr/[...page]/page.tsx
similarity index 100%
rename from web_services/client_frontend/src/app/(DashboardLayout)/tr/[...page]/page.tsx
rename to web_services/client_frontend/src/app/(DashboardLayout)/panel/tr/[...page]/page.tsx
diff --git a/web_services/client_frontend/src/app/api/login/email/route.ts b/web_services/client_frontend/src/app/api/login/email/route.ts
index 4ab6d59..1edf11b 100644
--- a/web_services/client_frontend/src/app/api/login/email/route.ts
+++ b/web_services/client_frontend/src/app/api/login/email/route.ts
@@ -1,6 +1,6 @@
import { loginViaAccessKeys } from "@/apicalls/custom/login/login";
import { NextResponse } from "next/server";
-import { loginSchemaEmail } from "@/webPages/auth/Login/schemas";
+import { loginSchemaEmail } from "@/webPages/auth/login/schemas";
export async function POST(req: Request): Promise {
try {
diff --git a/web_services/client_frontend/src/app/api/selection/occupant/route.ts b/web_services/client_frontend/src/app/api/selection/occupant/route.ts
index 37901e9..405c361 100644
--- a/web_services/client_frontend/src/app/api/selection/occupant/route.ts
+++ b/web_services/client_frontend/src/app/api/selection/occupant/route.ts
@@ -1,5 +1,5 @@
import { z } from "zod";
-import { loginSelectOccupant } from "@/apicalls/login/login";
+import { loginSelectOccupant } from "@/apicalls/custom/login/login";
import { NextResponse } from "next/server";
const loginSchemaOccupant = z.object({
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 fccc23c..6c484a0 100644
--- a/web_services/client_frontend/src/components/custom/header/component.tsx
+++ b/web_services/client_frontend/src/components/custom/header/component.tsx
@@ -4,7 +4,7 @@ import { HeaderProps } from "@/validations/mutual/dashboard/props";
import LanguageSelectionComponent from "@/components/mutual/languageSelection/component";
import { langGetKey } from "@/lib/langGet";
-const HeaderComponent: FC = ({ translations, lang, activePageUrl }) => {
+const HeaderComponent: FC = ({ translations, lang, activePageUrl, prefix }) => {
return (
@@ -12,7 +12,7 @@ const HeaderComponent: FC
= ({ translations, lang, activePageUrl })
{langGetKey(translations, 'selectedPage')} :
{langGetKey(translations, 'page')}
-
+
);
};
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 e5af966..1a83e57 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,9 @@ import { LanguageTypes } from "@/validations/mutual/language/validations";
import LanguageSelectionItem from "./languageItem";
-const LanguageSelectionComponent: React.FC<{ lang: LanguageTypes, activePage: string }> = ({ lang, activePage }) => {
+const LanguageSelectionComponent: React.FC<{ lang: LanguageTypes, activePage: string, prefix: string }> = ({ lang, activePage, prefix }) => {
const translations = langGet(lang, languageSelectionTranslation);
- const getPageWithLocale = (locale: LanguageTypes): string => { return `/${locale}/${activePage}` }
+ const getPageWithLocale = (locale: LanguageTypes): string => { return `${prefix}/${locale}/${activePage}` }
const englishButtonProps = {
activeLang: lang,
@@ -30,8 +30,7 @@ const LanguageSelectionComponent: React.FC<{ lang: LanguageTypes, activePage: st
-
-
+
);
diff --git a/web_services/client_frontend/src/layouts/auth/layout.tsx b/web_services/client_frontend/src/layouts/auth/layout.tsx
new file mode 100644
index 0000000..04dc662
--- /dev/null
+++ b/web_services/client_frontend/src/layouts/auth/layout.tsx
@@ -0,0 +1,23 @@
+'use server';
+import { FC, Suspense } from "react";
+import { AuthLayoutProps } from "@/validations/mutual/auth/props";
+import LanguageSelectionComponent from "@/components/mutual/languageSelection/component";
+
+const AuthLayout: FC = async ({ lang, page, activePageUrl }) => {
+ return (
+
+
+
+
WAG Frontend
+
Welcome to the WAG Frontend Application
+
+
+
+
+ Loading...
}>{page}
+
+
+ );
+}
+
+export { AuthLayout };
\ No newline at end of file
diff --git a/web_services/client_frontend/src/layouts/dashboard/layout.tsx b/web_services/client_frontend/src/layouts/dashboard/layout.tsx
index 0f54d34..2e96722 100644
--- a/web_services/client_frontend/src/layouts/dashboard/layout.tsx
+++ b/web_services/client_frontend/src/layouts/dashboard/layout.tsx
@@ -19,7 +19,7 @@ const DashboardLayout: FC = async ({ params, searchParams,
const translations = langGet(lang, langDynamicPagesGet(activePageUrl, dynamicPagesIndex));
const menuTranslationsFlatten = dynamicRetrieveMenuFlattenGet(menuItems);
- const headerProps = { translations: translations.header, lang, activePageUrl }
+ const headerProps = { translations: translations.header, lang, activePageUrl, prefix: "/panel" }
const menuProps = { lang, activePageUrl, menuTranslationsFlatten, menuItems }
const contentProps = { translations: translations.content, lang, activePageUrl, mode, isMulti: true }
diff --git a/web_services/client_frontend/src/pages/multi/index.ts b/web_services/client_frontend/src/pages/multi/index.ts
index e251290..c5831c0 100644
--- a/web_services/client_frontend/src/pages/multi/index.ts
+++ b/web_services/client_frontend/src/pages/multi/index.ts
@@ -4,13 +4,13 @@ import superUserTenantSomethingSecond from "./management/account/tenantSomething
import superUserBuildingPartsTenantSomething from "./building/parts/tenantSomething/page";
const pageIndexMulti: Record>> = {
- "management/account/tenant/something": {
+ "panel/management/account/tenant/something": {
superUserTenantSomething: superUserTenantSomething,
},
- "management/account/tenant/somethingSecond": {
+ "panel/management/account/tenant/somethingSecond": {
superUserTenantSomething: superUserTenantSomethingSecond,
},
- "building/parts/tenant/something": {
+ "panel/building/parts/tenant/something": {
superUserTenantSomething: superUserBuildingPartsTenantSomething,
},
};
diff --git a/web_services/client_frontend/src/validations/mutual/auth/props.ts b/web_services/client_frontend/src/validations/mutual/auth/props.ts
new file mode 100644
index 0000000..2a8169a
--- /dev/null
+++ b/web_services/client_frontend/src/validations/mutual/auth/props.ts
@@ -0,0 +1,13 @@
+import { LanguageTypes } from "../language/validations";
+
+//
+interface AuthLayoutProps {
+ page: React.ReactNode;
+ lang: LanguageTypes;
+ activePageUrl: string;
+}
+interface AuthPageProps {
+ query?: { [key: string]: string | string[] | undefined };
+ language: LanguageTypes;
+}
+export type { AuthLayoutProps, AuthPageProps };
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 16057e5..18eef56 100644
--- a/web_services/client_frontend/src/validations/mutual/dashboard/props.ts
+++ b/web_services/client_frontend/src/validations/mutual/dashboard/props.ts
@@ -1,6 +1,5 @@
import { LanguageTypes } from "@/validations/mutual/language/validations";
-
-type ParamsType = { page: string[] | undefined };
+import { ParamsType } from "@/validations/mutual/pages/props";
interface MaindasboardPageProps {
params: Promise;
@@ -39,6 +38,7 @@ interface HeaderProps {
translations: Record;
lang: LanguageTypes;
activePageUrl: string;
+ prefix: string;
}
export type {
diff --git a/web_services/client_frontend/src/validations/mutual/pages/props.ts b/web_services/client_frontend/src/validations/mutual/pages/props.ts
new file mode 100644
index 0000000..7148508
--- /dev/null
+++ b/web_services/client_frontend/src/validations/mutual/pages/props.ts
@@ -0,0 +1,7 @@
+type ParamsType = { page: string[] | undefined };
+interface AuthServerProps {
+ params: Promise<{ page: string[] | undefined }>;
+ searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
+}
+
+export type { ParamsType, AuthServerProps };
diff --git a/web_services/client_frontend/src/webPages/auth/Login/hook.ts b/web_services/client_frontend/src/webPages/auth/login/hook.ts
similarity index 83%
rename from web_services/client_frontend/src/webPages/auth/Login/hook.ts
rename to web_services/client_frontend/src/webPages/auth/login/hook.ts
index e1b8b1e..43c5768 100644
--- a/web_services/client_frontend/src/webPages/auth/Login/hook.ts
+++ b/web_services/client_frontend/src/webPages/auth/login/hook.ts
@@ -1,9 +1,12 @@
+import { LanguageTypes } from "@/validations/mutual/language/validations";
+
export function loginHook(
startTransition: any,
data: any,
setError: any,
setJsonText: any,
- Router: any
+ Router: any,
+ lang: LanguageTypes
) {
try {
const sendData = { ...data };
@@ -18,7 +21,7 @@ export function loginHook(
response.json().then((data) => {
console.log("data", data); // setJsonText(JSON.stringify(data));
setTimeout(() => {
- Router.push("/auth/en/select");
+ Router.push(`/auth/${lang}/select`);
}, 100);
});
} else {
diff --git a/web_services/client_frontend/src/webPages/auth/Login/language.ts b/web_services/client_frontend/src/webPages/auth/login/language.ts
similarity index 100%
rename from web_services/client_frontend/src/webPages/auth/Login/language.ts
rename to web_services/client_frontend/src/webPages/auth/login/language.ts
diff --git a/web_services/client_frontend/src/webPages/auth/Login/page.tsx b/web_services/client_frontend/src/webPages/auth/login/page.tsx
similarity index 82%
rename from web_services/client_frontend/src/webPages/auth/Login/page.tsx
rename to web_services/client_frontend/src/webPages/auth/login/page.tsx
index 3dbb404..39dd190 100644
--- a/web_services/client_frontend/src/webPages/auth/Login/page.tsx
+++ b/web_services/client_frontend/src/webPages/auth/login/page.tsx
@@ -1,38 +1,27 @@
"use client";
-import { useState, useTransition, useEffect } from "react";
+import { useState, useTransition } from "react";
import { useRouter } from "next/navigation";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { LoginFormData } from "./types";
import { loginSchemaEmail } from "./schemas";
import { loginTranslation } from "./language";
-// import { LanguageSelectionComponent } from "@/components/common/HeaderSelections/LanguageSelectionComponent";
import { loginHook } from "./hook";
-import LanguageSelectionComponent from "@/components/mutual/languageSelection/component";
-
-function Login({ language }: { language: "tr" | "en" }) {
+import { AuthPageProps } from "@/validations/mutual/auth/props";
+function Login({ language }: AuthPageProps) {
const Router = useRouter();
+ const translation = loginTranslation[language];
+
const [isPending, startTransition] = useTransition();
const [error, setError] = useState(null);
const [jsonText, setJsonText] = useState(null);
- const [translation, setTranslation] = useState(loginTranslation[language]);
- const [lang, setLang] = useState(language);
-
- useEffect(() => { setTranslation(loginTranslation[lang]) }, [lang]);
const { register, formState: { errors }, handleSubmit, } = useForm({ resolver: zodResolver(loginSchemaEmail) });
const onSubmit = async (data: LoginFormData) => { loginHook(startTransition, data, setError, setJsonText, Router) };
return (
<>
- {/*
-
-
*/}
{translation.login}
diff --git a/web_services/client_frontend/src/webPages/auth/Login/schemas.ts b/web_services/client_frontend/src/webPages/auth/login/schemas.ts
similarity index 100%
rename from web_services/client_frontend/src/webPages/auth/Login/schemas.ts
rename to web_services/client_frontend/src/webPages/auth/login/schemas.ts
diff --git a/web_services/client_frontend/src/webPages/auth/login/serverPage.tsx b/web_services/client_frontend/src/webPages/auth/login/serverPage.tsx
new file mode 100644
index 0000000..32d3425
--- /dev/null
+++ b/web_services/client_frontend/src/webPages/auth/login/serverPage.tsx
@@ -0,0 +1,8 @@
+'use server';
+import Login from "./page";
+import { FC } from "react";
+import { AuthPageProps } from "@/validations/mutual/auth/props";
+
+const LoginPage: FC
= async ({ query, language }) => { return };
+
+export default LoginPage;
diff --git a/web_services/client_frontend/src/webPages/auth/Login/types.ts b/web_services/client_frontend/src/webPages/auth/login/types.ts
similarity index 100%
rename from web_services/client_frontend/src/webPages/auth/Login/types.ts
rename to web_services/client_frontend/src/webPages/auth/login/types.ts
diff --git a/web_services/client_frontend/src/webPages/auth/Select/LoginEmployee.tsx b/web_services/client_frontend/src/webPages/auth/select/LoginEmployee.tsx
similarity index 98%
rename from web_services/client_frontend/src/webPages/auth/Select/LoginEmployee.tsx
rename to web_services/client_frontend/src/webPages/auth/select/LoginEmployee.tsx
index ab5875e..6a24c64 100644
--- a/web_services/client_frontend/src/webPages/auth/Select/LoginEmployee.tsx
+++ b/web_services/client_frontend/src/webPages/auth/select/LoginEmployee.tsx
@@ -7,7 +7,8 @@ import { selectEmployeeHook } from "./hook";
function LoginEmployee({
selectionList,
- translation
+ translation,
+ lang
}: LoginEmployeeProps) {
const isArrayLengthOne = Array.isArray(selectionList) && selectionList.length === 1;
const isArrayLengthZero = Array.isArray(selectionList) && selectionList.length === 0;
@@ -19,7 +20,7 @@ function LoginEmployee({
const [jsonText, setJsonText] = useState(null);
const onSubmitEmployee = async (uu_id: string) => {
- selectEmployeeHook(startTransition, { company_uu_id: uu_id }, setError, setJsonText, Router)
+ selectEmployeeHook(startTransition, { company_uu_id: uu_id }, setError, setJsonText, Router, lang)
};
// Render a company card with consistent styling
diff --git a/web_services/client_frontend/src/webPages/auth/Select/LoginOccupant.tsx b/web_services/client_frontend/src/webPages/auth/select/LoginOccupant.tsx
similarity index 99%
rename from web_services/client_frontend/src/webPages/auth/Select/LoginOccupant.tsx
rename to web_services/client_frontend/src/webPages/auth/select/LoginOccupant.tsx
index e82d67b..5f5edd5 100644
--- a/web_services/client_frontend/src/webPages/auth/Select/LoginOccupant.tsx
+++ b/web_services/client_frontend/src/webPages/auth/select/LoginOccupant.tsx
@@ -7,6 +7,7 @@ import { selectOccupantHook } from "./hook";
function LoginOccupant({
selectionList,
translation,
+ lang
}: LoginOccupantProps) {
const Router = useRouter();
@@ -15,7 +16,7 @@ function LoginOccupant({
const [jsonText, setJsonText] = useState(null);
const onSubmitOccupant = async (data: any) => {
- selectOccupantHook(startTransition, data, setError, setJsonText, Router)
+ selectOccupantHook(startTransition, data, setError, setJsonText, Router, lang)
};
const isArrayLengthZero = Array.isArray(selectionList) && selectionList.length === 0;
diff --git a/web_services/client_frontend/src/webPages/auth/Select/hook.ts b/web_services/client_frontend/src/webPages/auth/select/hook.ts
similarity index 82%
rename from web_services/client_frontend/src/webPages/auth/Select/hook.ts
rename to web_services/client_frontend/src/webPages/auth/select/hook.ts
index 3953f51..676b054 100644
--- a/web_services/client_frontend/src/webPages/auth/Select/hook.ts
+++ b/web_services/client_frontend/src/webPages/auth/select/hook.ts
@@ -1,12 +1,16 @@
+import { LanguageTypes } from "@/validations/mutual/language/validations";
+
function selectEmployeeHook(
startTransition: any,
data: any,
setError: any,
setJsonText: any,
- Router: any
+ Router: any,
+ lang: LanguageTypes
) {
try {
const sendData = { ...data };
+ const urlToDirect = `/auth/${lang}/panel/building/parts/tenant/something`;
startTransition(() => {
fetch("/api/selection/employee", {
method: "POST",
@@ -18,7 +22,7 @@ function selectEmployeeHook(
response.json().then((data) => {
console.log("data", data); // setJsonText(JSON.stringify(data));
setTimeout(() => {
- Router.push("/en/building/parts/tenant/something");
+ Router.push(urlToDirect);
}, 100);
});
} else {
@@ -39,10 +43,12 @@ function selectOccupantHook(
data: any,
setError: any,
setJsonText: any,
- Router: any
+ Router: any,
+ lang: LanguageTypes
) {
try {
const sendData = { ...data };
+ const urlToDirect = `/auth/${lang}/panel/building/parts/tenant/something`;
startTransition(() => {
fetch("/api/selection/occupant", {
method: "POST",
@@ -54,7 +60,7 @@ function selectOccupantHook(
response.json().then((data) => {
console.log("data", data); // setJsonText(JSON.stringify(data));
setTimeout(() => {
- Router.push("/en/building/parts/tenant/something");
+ Router.push(urlToDirect);
}, 100);
});
} else {
diff --git a/web_services/client_frontend/src/webPages/auth/Select/language.ts b/web_services/client_frontend/src/webPages/auth/select/language.ts
similarity index 100%
rename from web_services/client_frontend/src/webPages/auth/Select/language.ts
rename to web_services/client_frontend/src/webPages/auth/select/language.ts
diff --git a/web_services/client_frontend/src/webPages/auth/Select/page.tsx b/web_services/client_frontend/src/webPages/auth/select/page.tsx
similarity index 56%
rename from web_services/client_frontend/src/webPages/auth/Select/page.tsx
rename to web_services/client_frontend/src/webPages/auth/select/page.tsx
index 3c10a18..d277116 100644
--- a/web_services/client_frontend/src/webPages/auth/Select/page.tsx
+++ b/web_services/client_frontend/src/webPages/auth/select/page.tsx
@@ -5,15 +5,16 @@ import LoginEmployee from "./LoginEmployee";
import { Company, SelectListProps, BuildingMap } from "./types";
import { selectEmployeeTranslation, selectOccupantTranslation } from "./language";
-// import { LanguageSelectionComponent } from "@/components/common/HeaderSelections/LanguageSelectionComponent";
-const Select: React.FC = ({ selectionList, isEmployee, isOccupant, language }) => {
+const Select: React.FC = ({ selectionList, isEmployee, isOccupant, language, query }) => {
+ const isEmployeee = query?.isEmployee == "true";
+ const isOccupante = query?.isOccupant == "true";
+ const userType = isEmployeee || isOccupante ? isEmployeee ? "employee" : "occupant" : "employee";
- const isEmployeeTrue = isEmployee && Array.isArray(selectionList)
- const isOccupantTrue = isOccupant && !Array.isArray(selectionList)
- const initTranslation = isEmployee ? selectEmployeeTranslation[language as "en" | "tr"] : selectOccupantTranslation[language as "en" | "tr"]
+ const isEmployeeTrue = userType == "employee" && Array.isArray(selectionList)
+ const isOccupantTrue = userType == "occupant" && !Array.isArray(selectionList)
+ const initTranslation = userType == "employee" ? selectEmployeeTranslation[language] : selectOccupantTranslation[language]
- const [lang, setLang] = useState(language);
const [translation, setTranslation] = useState(initTranslation);
const [listEmployeeSelection, setListEmployeeSelection] = useState(selectionList as Company[]);
const [listOccupantSelection, setListOccupantSelection] = useState(selectionList as BuildingMap);
@@ -24,23 +25,15 @@ const Select: React.FC = ({ selectionList, isEmployee, isOccupa
}, []);
useEffect(() => {
- setTranslation(isEmployee ? selectEmployeeTranslation[lang as "en" | "tr"] : selectOccupantTranslation[lang as "en" | "tr"]);
- }, [lang]);
+ setTranslation(isEmployee ? selectEmployeeTranslation[language] : selectOccupantTranslation[language]);
+ }, [language]);
return (
<>
- {/*
-
-
*/}
-
- {isEmployeeTrue && }
- {isOccupantTrue && }
+ {isEmployeeTrue && }
+ {isOccupantTrue && }
>
diff --git a/web_services/client_frontend/src/app/(AuthLayout)/auth/[lang]/select/page.tsx b/web_services/client_frontend/src/webPages/auth/select/serverPage.tsx
similarity index 68%
rename from web_services/client_frontend/src/app/(AuthLayout)/auth/[lang]/select/page.tsx
rename to web_services/client_frontend/src/webPages/auth/select/serverPage.tsx
index 78a49bb..e5d4507 100644
--- a/web_services/client_frontend/src/app/(AuthLayout)/auth/[lang]/select/page.tsx
+++ b/web_services/client_frontend/src/webPages/auth/select/serverPage.tsx
@@ -1,11 +1,12 @@
"use server";
-import React from "react";
-import Select from "@/webPages/auth/Select/page";
+import React, { FC } from "react";
+import Select from "./page";
import { redirect } from "next/navigation";
import { checkAccessTokenIsValid, retrieveUserType } from "@/apicalls/mutual/cookies/token";
+import { AuthPageProps } from "@/validations/mutual/auth/props";
-const SelectPage = async () => {
+const SelectPage: FC = async ({ query, language }) => {
const token_is_valid = await checkAccessTokenIsValid();
const selection = await retrieveUserType();
const isEmployee = selection?.userType == "employee";
@@ -13,7 +14,7 @@ const SelectPage = async () => {
const selectionList = selection?.selectionList;
if (!selectionList || !token_is_valid) { redirect("/auth/en/login") }
- return
+ return
}
export default SelectPage;
diff --git a/web_services/client_frontend/src/webPages/auth/Select/types.ts b/web_services/client_frontend/src/webPages/auth/select/types.ts
similarity index 81%
rename from web_services/client_frontend/src/webPages/auth/Select/types.ts
rename to web_services/client_frontend/src/webPages/auth/select/types.ts
index a4bed4f..100b302 100644
--- a/web_services/client_frontend/src/webPages/auth/Select/types.ts
+++ b/web_services/client_frontend/src/webPages/auth/select/types.ts
@@ -1,3 +1,5 @@
+import { LanguageTypes } from "@/validations/mutual/language/validations";
+
interface Company {
uu_id: string;
public_name: string;
@@ -31,17 +33,20 @@ interface SelectListProps {
selectionList: Company[] | BuildingMap;
isEmployee: boolean;
isOccupant: boolean;
- language?: "en" | "tr";
+ language: LanguageTypes;
+ query?: { [key: string]: string | string[] | undefined };
}
interface LoginOccupantProps {
selectionList: BuildingMap;
translation: any;
+ lang: LanguageTypes;
}
interface LoginEmployeeProps {
selectionList: Company[];
translation: any;
+ lang: LanguageTypes;
}
export type {
diff --git a/web_services/client_frontend/src/webPages/getPage.tsx b/web_services/client_frontend/src/webPages/getPage.tsx
new file mode 100644
index 0000000..2cbb421
--- /dev/null
+++ b/web_services/client_frontend/src/webPages/getPage.tsx
@@ -0,0 +1,15 @@
+import LoginPage from "./auth/login/serverPage";
+import SelectPage from "./auth/select/serverPage";
+
+export default function getPage(pageName: string, props: any) {
+ switch (pageName) {
+ case "/login":
+ return ;
+ case "/select":
+ return ;
+ default:
+ return ;
+ }
+ return <>>
+}
+