diff --git a/client/package.json b/client/package.json
index 608a98f..e14eea9 100644
--- a/client/package.json
+++ b/client/package.json
@@ -44,6 +44,8 @@
"class-variance-authority": "^0.7.0",
"cmdk": "^1.0.0",
"date-fns": "^3.6.0",
+ "i18next": "^23.11.5",
+ "i18next-browser-languagedetector": "^8.0.0",
"joi": "^17.13.1",
"lucide-react": "^0.379.0",
"react": "^18.2.0",
@@ -51,6 +53,7 @@
"react-day-picker": "^8.10.1",
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.5",
+ "react-i18next": "^14.1.2",
"react-resizable-panels": "^2.0.19",
"react-router-dom": "^6.23.1",
"react-secure-storage": "^1.3.2",
diff --git a/client/src/Routes.tsx b/client/src/Routes.tsx
index 15dd2c0..9200db3 100644
--- a/client/src/Routes.tsx
+++ b/client/src/Routes.tsx
@@ -1,23 +1,28 @@
import { RouterProvider, createBrowserRouter } from "react-router-dom";
+import { LoginPage, LogoutPage, StartPage } from "./app";
+import { CatalogList } from "./app/catalog";
+import { DashboardPage } from "./app/dashboard";
import { ProtectedRoute } from "./components";
-import { DashboardPage, LogoutPage } from "./pages";
-import { LoginPage } from "./pages/LoginPage";
export const Routes = () => {
// Define public routes accessible to all users
const routesForPublic = [
{
- path: "/service",
- element:
Service Page
,
- },
- {
- path: "/about-us",
- element: About Us
,
+ path: "/",
+ Component: StartPage,
},
];
// Define routes accessible only to authenticated users
const routesForAuthenticatedOnly = [
+ {
+ path: "/home",
+ Component: DashboardPage,
+ },
+ {
+ path: "/catalog",
+ Component: CatalogList,
+ },
{
path: "/profile",
element: (
@@ -48,10 +53,6 @@ export const Routes = () => {
// Define routes accessible only to non-authenticated users
const routesForNotAuthenticatedOnly = [
- {
- path: "/",
- Component: DashboardPage,
- },
{
path: "/login",
Component: LoginPage,
@@ -61,8 +62,8 @@ export const Routes = () => {
// Combine and conditionally include routes based on authentication status
const router = createBrowserRouter([
...routesForPublic,
- ...routesForNotAuthenticatedOnly,
...routesForAuthenticatedOnly,
+ ...routesForNotAuthenticatedOnly,
]);
// Provide the router configuration using RouterProvider
diff --git a/client/src/pages/ErrorPage.tsx b/client/src/app/ErrorPage.tsx
similarity index 100%
rename from client/src/pages/ErrorPage.tsx
rename to client/src/app/ErrorPage.tsx
diff --git a/client/src/pages/LoginPage.tsx b/client/src/app/LoginPage.tsx
similarity index 81%
rename from client/src/pages/LoginPage.tsx
rename to client/src/app/LoginPage.tsx
index e0e5db2..b683644 100644
--- a/client/src/pages/LoginPage.tsx
+++ b/client/src/app/LoginPage.tsx
@@ -19,12 +19,14 @@ import Joi from "joi";
import { AlertCircleIcon } from "lucide-react";
import { useState } from "react";
import { SubmitHandler, useForm } from "react-hook-form";
+import { Trans, useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import SpanishJoiMessages from "../spanish-joi-messages.json";
type LoginDataForm = ILogin_DTO;
export const LoginPage = () => {
+ const { t } = useTranslation();
const [loading, setLoading] = useState(false);
const { mutate: login } = useLogin({
onSuccess: (data) => {
@@ -55,7 +57,6 @@ export const LoginPage = () => {
});
const onSubmit: SubmitHandler = async (data) => {
- console.log(data);
try {
setLoading(true);
login({ email: data.email, password: data.password });
@@ -74,8 +75,12 @@ export const LoginPage = () => {
- Presupuestador para distribuidores
- Enter your email below to login to your account
+
+
+
+
+
+