From 7dcdd1b6fb167731c1ca16bbd3bf9d2e1eab4c7a Mon Sep 17 00:00:00 2001 From: quoije Date: Sun, 26 Jan 2025 23:18:13 -0500 Subject: [PATCH] update checklist, update filter --- public/checklist.html | 63 ++++++++++++-------- public/movies.html | 130 ++++++++++++------------------------------ 2 files changed, 74 insertions(+), 119 deletions(-) diff --git a/public/checklist.html b/public/checklist.html index 9f4e3aa..ec324a5 100644 --- a/public/checklist.html +++ b/public/checklist.html @@ -18,18 +18,34 @@ color: #ddd; } .movie-table { - margin-top: 20px; + margin-top: 20px; + } + + /* New styles for the first column */ + .movie-table th:first-child, + .movie-table td:first-child { + width: 1%; /* Shrink to fit the content */ + white-space: nowrap; /* Prevent wrapping */ + } + + .movie-table { + table-layout: auto; /* Allow the browser to size columns automatically */ } .ratio { font-weight: bold; margin-top: 10px; } .navbar-toggler { - border-color: white; /* Make the border white */ + border-color: white; } .navbar-toggler-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='white' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E"); } + /* New styles for table */ + .table-hover tbody tr:hover { + background-color: #f1f1f1; + cursor: pointer; + } @@ -65,12 +81,12 @@
- +
- - + + @@ -93,30 +109,20 @@ if (token) { try { - // Decode the token (using a library like jwt-decode or manually) - const decoded = JSON.parse(atob(token.split('.')[1])); // Manually decoding JWT - - // Access the user's name from the decoded token + const decoded = JSON.parse(atob(token.split('.')[1])); const userName = decoded.name; - - // Update the user name in the navbar document.getElementById('user-name').textContent = userName; - - // Verify JWT Token expiration - const currentTime = Math.floor(Date.now() / 1000); // Current time in seconds + const currentTime = Math.floor(Date.now() / 1000); if (decoded.exp && decoded.exp < currentTime) { - console.warn("Token is expired"); - localStorage.removeItem('auth_token'); // Remove the expired token - window.location.href = '/'; // Redirect to the login page + localStorage.removeItem('auth_token'); + window.location.href = '/'; } } catch (error) { - console.error("Error decoding token:", error); - localStorage.removeItem('auth_token'); // Remove invalid token - window.location.href = '/'; // Redirect to the login page + localStorage.removeItem('auth_token'); + window.location.href = '/'; } } else { - // Handle case if no token is available - window.location.href = '/'; // Redirect to the login page if no token + window.location.href = '/'; } const res = await fetch('/api/movies', { @@ -167,14 +173,23 @@ const watchedDate = watchedMovie ? new Date(watchedMovie.watchedDate).toLocaleString() : ''; const movieRow = document.createElement('tr'); movieRow.innerHTML = ` - + `; + movieTableBody.appendChild(movieRow); + movieRow.addEventListener('click', (event) => { + const checkbox = document.getElementById(`movie-${movie.imdb_id}`); + if (event.target.tagName !== 'INPUT') { + checkbox.checked = !checkbox.checked; + checkbox.dispatchEvent(new Event('change')); + } + }); + const checkbox = document.getElementById(`movie-${movie.imdb_id}`); checkbox.addEventListener('change', async (event) => { const isChecked = event.target.checked; @@ -215,4 +230,4 @@ }; - + \ No newline at end of file diff --git a/public/movies.html b/public/movies.html index a3d728c..3118d19 100644 --- a/public/movies.html +++ b/public/movies.html @@ -87,9 +87,6 @@

Films

-

- -

@@ -98,6 +95,13 @@

Temps avant les Oscars (2 mars 2025) -

+

+
+ + +
+

+
@@ -106,95 +110,65 @@
Titre RegardéDate du visionnage TitreDate du visionnage
${movie.title} ${movie.title} ${watchedDate}