Skip to content

Commit 2e11501

Browse files
authored
merge branch gh-pages into branch main
Merge gh-pages into default branch == main
2 parents f5b9602 + e4fbee5 commit 2e11501

3 files changed

Lines changed: 171 additions & 16 deletions

File tree

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h1 class="title">TaskManager</h1>
1414
<div class="navbar">
1515
<button class="left">Acceuil</button>
1616
<button class="left">Tasks</button>
17-
<a id="profile"><img src="./icon/profile.png" alt="Profile"></a>
17+
<a id="profile" onclick="alert('Indisponible pour le moment')"><img src="profile.png" alt="Profile"></a>
1818
</div>
1919
<div id="login">
2020
<input type="text" id="name" placeholder="name">

index.js

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ const tasksDiv = document.getElementById('tasks');
99
const seeKanbanBtn = document.getElementById('seeKanban');
1010
const seeTableBtn = document.getElementById('seeTable');
1111

12-
// Objet pour stocker les informations utilisateur
13-
const user = {
14-
name: '',
15-
email: ''
16-
};
12+
// Vérification et chargement des données depuis localStorage
13+
let user = JSON.parse(localStorage.getItem('user')) || { name: '', email: '' };
14+
let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
1715

1816
// Fonction de validation des informations utilisateur
1917
function validateUser() {
@@ -29,6 +27,9 @@ function validateUser() {
2927
user.name = name;
3028
user.email = email;
3129

30+
// Sauvegarder dans localStorage
31+
localStorage.setItem('user', JSON.stringify(user));
32+
3233
message.innerText = `Connexion réussie. Bienvenue, ${user.name} !`;
3334
message.style.color = "green";
3435

@@ -52,10 +53,7 @@ function displayProfile() {
5253
addTaskBtn.addEventListener('click', addTask);
5354
}
5455

55-
// Tableau pour stocker les tâches (vide par défaut)
56-
const tasks = [];
57-
58-
// Fonction pour afficher les tâches en vue Kanban
56+
// Fonction pour afficher les tâches en vue Kanban ou Table
5957
function displayTasks(view) {
6058
tasksDiv.innerHTML = ""; // Réinitialisation des tâches
6159

@@ -112,7 +110,7 @@ function displayTasks(view) {
112110
deleteTask(index);
113111
});
114112
});
115-
113+
116114
// Ajout des événements de modification pour chaque tâche dans le tableau
117115
const modifyBtns = document.querySelectorAll('.modify');
118116
modifyBtns.forEach((btn) => {
@@ -132,6 +130,10 @@ function addTask() {
132130
if (newTask !== '') {
133131
tasks.push(newTask);
134132
taskInput.value = '';
133+
134+
// Sauvegarder dans localStorage
135+
localStorage.setItem('tasks', JSON.stringify(tasks));
136+
135137
displayTasks("kanban"); // On affiche par défaut en Kanban
136138
} else {
137139
alert("Veuillez entrer une tâche valide.");
@@ -141,6 +143,10 @@ function addTask() {
141143
// Fonction pour supprimer une tâche
142144
function deleteTask(index) {
143145
tasks.splice(index, 1);
146+
147+
// Sauvegarder dans localStorage
148+
localStorage.setItem('tasks', JSON.stringify(tasks));
149+
144150
displayTasks("kanban");
145151
}
146152

@@ -150,6 +156,10 @@ function modifyTask(index) {
150156

151157
if (newTask !== null && newTask.trim() !== "") {
152158
tasks[index] = newTask.trim();
159+
160+
// Sauvegarder dans localStorage
161+
localStorage.setItem('tasks', JSON.stringify(tasks));
162+
153163
displayTasks("kanban"); // Mettre à jour la vue Kanban
154164
displayTasks("table"); // Mettre à jour la vue Table
155165
}
@@ -159,3 +169,13 @@ function modifyTask(index) {
159169
seeKanbanBtn.addEventListener("click", () => displayTasks("kanban"));
160170
seeTableBtn.addEventListener("click", () => displayTasks("table"));
161171
validateBtn.addEventListener("click", validateUser);
172+
173+
// Charger les données initiales si disponibles dans localStorage
174+
if (user.name && user.email) {
175+
message.innerText = `Connexion réussie. Bienvenue, ${user.name} !`;
176+
message.style.color = "green";
177+
displayProfile();
178+
} else {
179+
message.innerText = "Veuillez vous connecter.";
180+
message.style.color = "red";
181+
}

styles.css

Lines changed: 140 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ body {
5353

5454
/* Formulaire de login */
5555
#login {
56-
width: 300px;
56+
width: 90%;
57+
max-width: 400px;
5758
margin: 20px auto;
5859
padding: 20px;
5960
background-color: #fff;
@@ -100,7 +101,8 @@ body {
100101

101102
/* Section profil utilisateur */
102103
#profile-sect {
103-
width: 300px;
104+
width: 90%;
105+
max-width: 400px;
104106
margin: 20px auto;
105107
padding: 20px;
106108
background-color: #fff;
@@ -112,7 +114,8 @@ body {
112114

113115
/* Affichage des tâches */
114116
#tasks {
115-
width: 60%;
117+
width: 90%;
118+
max-width: 800px;
116119
margin: 20px auto;
117120
padding: 20px;
118121
background-color: #fff;
@@ -136,7 +139,8 @@ body {
136139
padding: 15px;
137140
border-radius: 8px;
138141
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
139-
width: 200px;
142+
width: 100%;
143+
max-width: 250px;
140144
text-align: center;
141145
margin-bottom: 10px;
142146
transition: transform 0.3s;
@@ -146,9 +150,59 @@ body {
146150
transform: translateY(-5px);
147151
}
148152

153+
.task-card button {
154+
background-color: #f44336;
155+
color: white;
156+
border: none;
157+
padding: 5px 10px;
158+
margin-top: 10px;
159+
cursor: pointer;
160+
border-radius: 5px;
161+
transition: background-color 0.3s;
162+
}
163+
164+
.task-card button:hover {
165+
background-color: #e53935;
166+
}
167+
168+
/* Vue Table */
169+
#tasks table {
170+
width: 100%;
171+
border-collapse: collapse;
172+
margin-top: 20px;
173+
}
174+
175+
#tasks table th,
176+
#tasks table td {
177+
padding: 10px;
178+
text-align: left;
179+
border-bottom: 1px solid #ddd;
180+
}
181+
182+
#tasks table th {
183+
background-color: #4caf50;
184+
color: white;
185+
}
186+
187+
#tasks table td button {
188+
background-color: #f44336;
189+
color: white;
190+
border: none;
191+
padding: 5px 10px;
192+
margin-right: 5px;
193+
cursor: pointer;
194+
border-radius: 5px;
195+
transition: background-color 0.3s;
196+
}
197+
198+
#tasks table td button:hover {
199+
background-color: #e53935;
200+
}
201+
149202
/* Vue options */
150203
#vue {
151-
width: 60%;
204+
width: 90%;
205+
max-width: 800px;
152206
margin: 20px auto;
153207
padding: 20px;
154208
background-color: #fff;
@@ -173,3 +227,84 @@ body {
173227
#vue button:hover {
174228
background-color: #45a049;
175229
}
230+
231+
/* Section Ajouter Tâche */
232+
#profile-sect input[type="text"] {
233+
width: 75%;
234+
padding: 10px;
235+
margin-top: 10px;
236+
border: 1px solid #ccc;
237+
border-radius: 5px;
238+
outline: none;
239+
}
240+
241+
#profile-sect button {
242+
width: 20%;
243+
padding: 10px;
244+
background-color: #4caf50;
245+
color: white;
246+
border: none;
247+
border-radius: 5px;
248+
cursor: pointer;
249+
margin-top: 10px;
250+
font-weight: bold;
251+
}
252+
253+
#profile-sect button:hover {
254+
background-color: #45a049;
255+
}
256+
257+
/* Responsive Design - Mobile First */
258+
@media (max-width: 768px) {
259+
.navbar {
260+
flex-direction: column;
261+
text-align: center;
262+
}
263+
264+
.navbar button {
265+
width: 100%;
266+
margin: 5px 0;
267+
}
268+
269+
#profile-sect input[type="text"],
270+
#profile-sect button {
271+
width: 100%;
272+
}
273+
274+
#tasks {
275+
width: 100%;
276+
}
277+
278+
.task-card {
279+
width: 100%;
280+
max-width: 100%;
281+
}
282+
283+
#vue {
284+
width: 100%;
285+
}
286+
}
287+
288+
/* Responsive Design - Tablettes et au-delà */
289+
@media (min-width: 769px) {
290+
.navbar {
291+
flex-direction: row;
292+
}
293+
294+
.task-card {
295+
width: 45%;
296+
max-width: 250px;
297+
}
298+
299+
#tasks {
300+
width: 60%;
301+
}
302+
303+
#profile-sect {
304+
width: 50%;
305+
}
306+
307+
#vue {
308+
width: 60%;
309+
}
310+
}

0 commit comments

Comments
 (0)