Corresction path et header responsive

This commit is contained in:
Mathis 2025-04-08 12:38:58 +02:00
parent b7772ad627
commit 11ac854f88
10 changed files with 120 additions and 53 deletions

View File

@ -1,4 +1,4 @@
{
"liveServer.settings.port": 8081,
"java.configuration.updateBuildConfiguration": "interactive"
"java.configuration.updateBuildConfiguration": "automatic"
}

View File

@ -88,10 +88,10 @@
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-auth-jwt</artifactId>
<version>4.5.13</version>
</dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-auth-jwt</artifactId>
<version>4.5.13</version>
</dependency>
</dependencies>

View File

@ -4,7 +4,6 @@ import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.RoutingContext;
import at.favre.lib.crypto.bcrypt.BCrypt;
import io.vertx.ext.auth.jwt.JWTAuth;
import com.example.starter.auth.JwtAuthProvider;
import io.vertx.sqlclient.Tuple;
public class AuthHandler {

View File

@ -3,8 +3,7 @@ package com.example.starter;
import io.vertx.core.Vertx;
import io.vertx.jdbcclient.JDBCConnectOptions;
import io.vertx.jdbcclient.JDBCPool;
import io.vertx.ext.auth.jwt.JWTAuth;
import io.vertx.ext.auth.jwt.JWTAuthOptions;
import io.vertx.sqlclient.PoolOptions;
public class DatabaseService {
@ -13,7 +12,7 @@ public class DatabaseService {
public DatabaseService(Vertx vertx) {
pool = JDBCPool.pool(vertx,
new JDBCConnectOptions()
.setJdbcUrl("jdbc:postgresql://localhost:5432/users?useUnicode=true&characterEncoding=UTF-8") //Url de la bdd
.setJdbcUrl("jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=UTF-8") //Url de la bdd
.setUser("postgres") // Nom d'utilisateur PostgreSQL
.setPassword("admin"), // Mot de passe PostgreSQL
new PoolOptions()

View File

@ -1,10 +1,10 @@
package com.example.starter.auth;
package com.example.starter;
import io.vertx.core.Vertx;
import io.vertx.ext.auth.jwt.JWTAuth;
import io.vertx.ext.auth.jwt.JWTAuthOptions;
import io.vertx.ext.auth.KeyStoreOptions;
import com.example.starter.auth.JwtAuthProvider;
import com.example.starter.JwtAuthProvider;
public class JwtAuthProvider {

View File

@ -7,7 +7,6 @@ import io.vertx.ext.web.Router;
import io.vertx.ext.web.handler.BodyHandler;
import io.vertx.ext.web.handler.CorsHandler;
import io.vertx.ext.auth.jwt.JWTAuth;
import com.example.starter.auth.JwtAuthProvider;
import io.vertx.ext.web.handler.JWTAuthHandler;

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="./src/img/cloud-alert.svg"/>
<link rel="icon" href="./src/img/cloud-sun-rain.svg"/>
<title>Projet Dev Web</title>
</head>
<body>

View File

@ -1,58 +1,128 @@
import React, { useState, useEffect } from "react";
import { LogIn, UserPlus, LogOut, Settings } from "lucide-react";
import { X, Menu, LogIn, UserPlus, LogOut, Settings } from "lucide-react";
import { Link } from "react-router-dom";
import { useAuth } from "../AuthContext";
function Header() {
const { token, logout } = useAuth();
const [isMenuOpen, setIsMenuOpen] = useState(false);
return (
<header className="bg-white shadow-sm">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
<div className="flex justify-between items-center">
<h1 className="text-2xl font-bold text-indigo-600">VigiMétéo</h1>
<nav>
<ul className="flex gap-4">
<li>
<Link to="/" className="text-gray-600 hover:text-indigo-600">Accueil</Link>
</li>
<li>
<Link to="/about" className="text-gray-600 hover:text-indigo-600">A propos</Link>
</li>
<li>
<Link to="/gestion" className="text-gray-600 hover:text-indigo-600">Gestion</Link>
</li>
</ul>
</nav>
<div className="flex gap-4">
{token ? (
<>
<Link to="/settings" className="flex items-center gap-2 text-gray-600 hover:text-indigo-600">
<Settings size={20} />
<span></span>
</Link>
<button
onClick={logout}
className="flex items-center gap-2 text-gray-600 hover:text-red-600"
<div className=" max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-4 flex justify-between items-center">
<h1 className="text-2xl font-bold text-indigo-600">VigiMétéo</h1>
<button
className="sm:hidden text-gray-600 hover:text-indigo-600"
onClick={() => setIsMenuOpen(!isMenuOpen)}
>
{isMenuOpen ? <X size={24} /> : <Menu size={24} />}
</button>
<nav
className={`${
isMenuOpen ? "block" : "hidden"
} absolute top-16 left-0 w-full bg-white shadow-md sm:static sm:w-auto sm:flex sm:gap-6 sm:shadow-none`}
>
<ul className="flex flex-col sm:flex-row gap-4 sm:gap-6 text-gray-600 p-4 sm:p-0">
<li>
<Link to="/" className="text-gray-600 hover:text-indigo-600">
Accueil
</Link>
</li>
<li>
<Link to="/about" className="text-gray-600 hover:text-indigo-600">
A propos
</Link>
</li>
<li>
<Link
to="/gestion"
className="text-gray-600 hover:text-indigo-600"
>
<LogOut size={20} />
<span>Déconnexion</span>
</button>
Gestion
</Link>
</li>
{!token ? (
<>
<li className="sm:hidden">
<Link
to="/login"
className="hover:text-indigo-600 flex items-center gap-2"
>
<LogIn size={20} />
Connexion
</Link>
</li>
<li className="sm:hidden">
<Link
to="/signup"
className="flex items-center gap-2 bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700"
>
<UserPlus size={20} />
Inscription
</Link>
</li>
</>
) : (
<>
<Link to="/login" className="flex items-center gap-2 text-gray-600 hover:text-indigo-600">
<LogIn size={20} />
<span>Connexion</span>
</Link>
<Link to="/signup" className="flex items-center gap-2 bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700">
<UserPlus size={20} />
<span>Inscription</span>
</Link>
<li className="sm:hidden">
<Link
to="/settings"
className="flex items-center gap-2 text-gray-600 hover:text-indigo-600"
>
<Settings size={20} />
<span></span>
</Link>
</li>
<li className="sm:hidden">
<button
onClick={logout}
className="flex items-center gap-2 text-gray-600 hover:text-red-600"
>
<LogOut size={20} />
<span>Déconnexion</span>
</button>
</li>
</>
)}
<li></li>
</ul>
</nav>
{!token ? (
<div className="hidden sm:flex gap-4">
<Link
to="/login"
className="hover:text-indigo-600 flex items-center gap-2"
>
<LogIn size={20} />
Connexion
</Link>
<Link
to="/signup"
className="flex items-center gap-2 bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700"
>
<UserPlus size={20} />
Inscription
</Link>
</div>
</div>
) : (
<div className="hidden sm:flex gap-4">
<Link
to="/settings"
className="flex items-center gap-2 text-gray-600 hover:text-indigo-600"
>
<Settings size={20} />
<span></span>
</Link>
<button
onClick={logout}
className="flex items-center gap-2 text-gray-600 hover:text-red-600"
>
<LogOut size={20} />
<span>Déconnexion</span>
</button>
</div>
)}
</div>
</header>
);

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-cloud-alert-icon lucide-cloud-alert"><path d="M12 12v4"/><path d="M12 20h.01"/><path d="M17 18h.5a1 1 0 0 0 0-9h-1.79A7 7 0 1 0 7 17.708"/></svg>

Before

Width:  |  Height:  |  Size: 347 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-cloud-sun-rain-icon lucide-cloud-sun-rain"><path d="M12 2v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="M20 12h2"/><path d="m19.07 4.93-1.41 1.41"/><path d="M15.947 12.65a4 4 0 0 0-5.925-4.128"/><path d="M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24"/><path d="M11 20v2"/><path d="M7 19v2"/></svg>

After

Width:  |  Height:  |  Size: 494 B