Skip to content

Commit

Permalink
issues with admin-bar and login OK now
Browse files Browse the repository at this point in the history
  • Loading branch information
rezozero59 committed Aug 28, 2023
1 parent 2a758dd commit e23deae
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 84 deletions.
14 changes: 0 additions & 14 deletions FrontEnd/FactoryFunction.js

This file was deleted.

17 changes: 17 additions & 0 deletions FrontEnd/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,23 @@ a {
color: inherit;
}

/* Barre d'édition admin */
.admin-bar {
background-color: #000000;
color: white;
padding: 10px;

top: 0;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}

.hidden {
display: none;
}

nav ul {
display: flex;
align-items: center;
Expand Down
4 changes: 4 additions & 0 deletions FrontEnd/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<link rel="stylesheet" href="./assets/style.css" />
</head>
<body>
<div id="admin-bar" class="admin-bar hidden">
<button id="edit-mode-btn">Mode édition</button>
<button id="publish-changes-btn">Publier les changements</button>
</div>
<header>
<h1>Sophie Bluel <span>Architecte d'inteérieur</span></h1>
<nav>
Expand Down
9 changes: 8 additions & 1 deletion FrontEnd/login2.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ async function handleFormSubmission(event) {
function checkTokenLogin() {
const tokenAuth = localStorage.getItem("token");
const loginLink = document.getElementById("login-link");
const adminBar = document.getElementById("admin-bar");

loginLink.textContent = tokenAuth ? "logout" : "login";
if (tokenAuth) {
loginLink.textContent = "logout";
adminBar.classList.remove("hidden");
} else {
loginLink.textContent = "login";
adminBar.classList.add("hidden");
}
}

// Ajout de l'écouteur d'événements pour la soumission du formulaire
Expand Down
2 changes: 1 addition & 1 deletion FrontEnd/main2.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { initWorks } from "./works2.js";
import { initLoginForm, checkTokenLogin } from "./login2.js";

// Vérifier l'état de connexion de l'utilisateur
checkTokenLogin();
document.addEventListener("DOMContentLoaded", checkTokenLogin);

// Lancer l'initialisation des travaux
initWorks();
Expand Down
68 changes: 0 additions & 68 deletions FrontEnd/test-pattern-works.js

This file was deleted.

0 comments on commit e23deae

Please sign in to comment.