diff --git a/app/auth/forgot/page.jsx b/app/auth/forgot/page.jsx
deleted file mode 100644
index 8cf8631..0000000
--- a/app/auth/forgot/page.jsx
+++ /dev/null
@@ -1,48 +0,0 @@
-// ---------------------------------------------------------------------------------------------------------------------
-//! Imports
-// ---------------------------------------------------------------------------------------------------------------------
-
-// --------------------------------------------------- Components ------------------------------------------------------
-import Image from 'next/image';
-// ---------------------------------------------------------------------------------------------------------------------
-
-// ------------------------------------------------- Assets & Styles ---------------------------------------------------
-import '../styles.scss';
-// ---------------------------------------------------------------------------------------------------------------------
-
-const Forgot = () => {
- return (
-
-
-
-
Connexion
-
-
-
-
-
-
-
- );
-};
-
-export default Forgot;
diff --git a/app/auth/login/page.jsx b/app/auth/login/page.jsx
index 33e9d53..2ff15ed 100644
--- a/app/auth/login/page.jsx
+++ b/app/auth/login/page.jsx
@@ -58,13 +58,6 @@ const Login = () => {
/>
-
-
- Mot de passe oubliƩ ?
-
-
- S'inscrire
-
diff --git a/app/auth/register/hooks/useActions.js b/app/auth/register/hooks/useActions.js
deleted file mode 100644
index 5fc91cc..0000000
--- a/app/auth/register/hooks/useActions.js
+++ /dev/null
@@ -1,12 +0,0 @@
-export const useActions = ({
- usernameRef,
- emailRef,
- passwordRef,
- confpasswordRef,
-}) => {
- const handleSubmit = () => {};
-
- return {
- handleSubmit,
- };
-};
diff --git a/app/auth/register/hooks/useData.js b/app/auth/register/hooks/useData.js
deleted file mode 100644
index 5e33026..0000000
--- a/app/auth/register/hooks/useData.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import { useRef } from 'react';
-
-export const useData = () => {
- const usernameRef = useRef(null);
- const emailRef = useRef(null);
- const passwordRef = useRef(null);
- const confpasswordRef = useRef(null);
-
- return {
- usernameRef,
- emailRef,
- passwordRef,
- confpasswordRef,
- };
-};
diff --git a/app/auth/register/page.jsx b/app/auth/register/page.jsx
deleted file mode 100644
index 5be90f2..0000000
--- a/app/auth/register/page.jsx
+++ /dev/null
@@ -1,110 +0,0 @@
-'use client';
-
-// ---------------------------------------------------------------------------------------------------------------------
-//! Imports
-// ---------------------------------------------------------------------------------------------------------------------
-
-// --------------------------------------------------- Components ------------------------------------------------------
-import Image from 'next/image';
-import Link from 'next/link';
-// ---------------------------------------------------------------------------------------------------------------------
-
-// -------------------------------------------------- Hooks & Utils ----------------------------------------------------
-import { useData } from './hooks/useData';
-import { useActions } from './hooks/useActions';
-// ---------------------------------------------------------------------------------------------------------------------
-
-// ------------------------------------------------- Assets & Styles ---------------------------------------------------
-import '../styles.scss';
-// ---------------------------------------------------------------------------------------------------------------------
-
-const Register = () => {
- const { usernameRef, emailRef, passwordRef, confpasswordRef } = useData();
- const { handleSubmit } = useActions({
- usernameRef,
- emailRef,
- passwordRef,
- confpasswordRef,
- });
-
- return (
-
-
-
-
Inscription
-
-
-
-
-
- Se connecter
-
-
-
-
- );
-};
-
-export default Register;
diff --git a/app/auth/styles.scss b/app/auth/styles.scss
index 5e3fd95..24a9703 100644
--- a/app/auth/styles.scss
+++ b/app/auth/styles.scss
@@ -2,15 +2,16 @@
position: relative;
display: flex;
flex-direction: column;
- justify-content: center;
align-items: center;
+ gap: 50px;
+ padding: 15svh;
width: 100svw;
height: 100svh;
& > .appLogo {
- position: absolute;
- top: 5svh;
+ margin-top: -50px;
width: 30svw;
+ max-width: 150px;
height: auto;
}
@@ -19,10 +20,10 @@
flex-direction: column;
align-items: stretch;
gap: 10px;
- padding: 30px 60px;
+ padding: 20px 30px;
width: 95svw;
max-width: 450px;
- border: 3px solid #fefefa;
+ border: 2px solid #fefefa;
border-radius: 7px;
background-color: #d94253;
@@ -60,7 +61,7 @@
& > .input {
padding: 10px;
- border: 2px solid #fefefa;
+ border: 1px solid #fefefa;
border-radius: 5px;
background-color: #d94253;
outline: none;
@@ -102,8 +103,8 @@
}
& > .buttonsContainer {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
+ display: flex;
+ justify-content: center;
align-items: center;
gap: 30px;
margin-top: 15px;
@@ -113,8 +114,8 @@
justify-content: center;
align-items: center;
gap: 5px;
- padding: 7px 21px;
- border: 2px solid #fefefa;
+ padding: 7px 35px;
+ border: 1px solid #fefefa;
border-radius: 5px;
background-color: #fefefa;
font-size: 0.9rem;
diff --git a/app/layout.jsx b/app/layout.jsx
index 476837d..e85d807 100644
--- a/app/layout.jsx
+++ b/app/layout.jsx
@@ -1,6 +1,6 @@
import { Inter } from 'next/font/google';
+import Provider from './provider';
import './globals.scss';
-import Navbar from '@/components/Navbar/Navbar';
const inter = Inter({ subsets: ['latin'] });
@@ -12,8 +12,7 @@ const RootLayout = ({ children }) => {
return (
- {children}
-
+ {children}
);
diff --git a/app/provider.jsx b/app/provider.jsx
new file mode 100644
index 0000000..8de2a29
--- /dev/null
+++ b/app/provider.jsx
@@ -0,0 +1,48 @@
+'use client';
+
+// ---------------------------------------------------------------------------------------------------------------------
+//! Imports
+// ---------------------------------------------------------------------------------------------------------------------
+
+// -------------------------------------------------- React & Next -----------------------------------------------------
+import { useEffect, useState } from 'react';
+import { redirect, usePathname } from 'next/navigation';
+import Navbar from '@/components/Navbar/Navbar';
+// ---------------------------------------------------------------------------------------------------------------------
+
+const Provider = ({ children }) => {
+ const pathname = usePathname();
+ const [isSuccess, setIsSuccess] = useState(false);
+
+ useEffect(() => {
+ if (pathname.startsWith('/auth')) {
+ setIsSuccess(true);
+ return;
+ }
+
+ const token = localStorage.getItem('token');
+
+ if (!token) {
+ redirect('/auth/login');
+ }
+
+ setIsSuccess(true);
+ }, [pathname]);
+
+ if (!isSuccess) {
+ return;
+ }
+
+ if (pathname.startsWith('/auth')) {
+ return children;
+ }
+
+ return (
+ <>
+ {children}
+
+ >
+ );
+};
+
+export default Provider;
diff --git a/next.config.mjs b/next.config.mjs
index f78d32c..1114f58 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -4,6 +4,9 @@ const nextConfig = {
env: {
MAPBOX_TOKEN: process.env.MAPBOX_TOKEN,
},
+ images: {
+ unoptimized: true,
+ },
};
export default nextConfig;