diff --git a/src/main/java/dao/CommentDao.java b/src/main/java/dao/CommentDao.java index 8325322c1a74aa7df7da02ec335a600e10289c94..3d3f9b28f0d6d30bd0a8da60a8b1cc4d55283cec 100644 --- a/src/main/java/dao/CommentDao.java +++ b/src/main/java/dao/CommentDao.java @@ -242,6 +242,7 @@ public class CommentDao extends Dao { comment.setId(rs.getInt(("Id_Comment"))); comment.setContent(rs.getString("content")); comment.setStatutComment(rs.getInt("status_comment")); + comment.setDatePublish(rs.getDate("date_publish")); Post post = new Post(); post.setId(rs.getInt("Id_Post")); @@ -251,6 +252,8 @@ public class CommentDao extends Dao { author.setId((rs.getInt(("Id_User")))); author.setUsername(rs.getString("username")); author.setStatut((rs.getString("status_user"))); + + comment.setAuthor(author); comments.add(comment); } diff --git a/src/main/java/servlet/VideoServlet.java b/src/main/java/servlet/VideoServlet.java index 7ec6150a76b208dbaeef93a64551bc0ef0f3a5b2..8345a153e4c39c651b12a1127786a3e431192512 100644 --- a/src/main/java/servlet/VideoServlet.java +++ b/src/main/java/servlet/VideoServlet.java @@ -1,6 +1,8 @@ package servlet; +import beans.Comment; import beans.Post; +import dao.CommentDao; import dao.DaoFactory; import dao.PostDao; import jakarta.servlet.ServletException; @@ -9,7 +11,9 @@ import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @@ -17,15 +21,50 @@ import java.util.List; */ @WebServlet(name = "Video", urlPatterns = {"/video"}) public class VideoServlet extends HttpServlet { - + private static final String VIEW = "/WEB-INF/video.jsp"; - + @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PostDao postDao = DaoFactory.getPostDao(); - List posts = postDao.list(); - request.setAttribute("posts", posts); + + // Récupère l'id du Post en paramètre + String idParam = request.getParameter("id"); + + if (idParam == null) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, "ID de vidéo introuvable"); + return; + } + + Long postId; + // Change le String en Long + try { + postId = Long.parseLong(idParam); + } catch (NumberFormatException e) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST); + return; + } + + Post post = postDao.find(postId); + + request.setAttribute("post", post); + + // COMMENTAIRES + CommentDao commentDao = DaoFactory.getCommentDao(); + + // Change le String en int + int postIdInt; + try { + postIdInt = Integer.parseInt(idParam); + } catch (NumberFormatException e) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST); + return; + } + List commentsList = commentDao.listPerPost(postIdInt); + request.setAttribute("comments", commentsList); + + this.getServletContext().getRequestDispatcher(VIEW).forward(request, response); } -} \ No newline at end of file +} diff --git a/src/main/webapp/WEB-INF/home.jsp b/src/main/webapp/WEB-INF/home.jsp index 48563b2b66af538b2c5967c80487b2414e5cdabd..6df8b466e538d7c289f9eb99377c0df1a071e02c 100644 --- a/src/main/webapp/WEB-INF/home.jsp +++ b/src/main/webapp/WEB-INF/home.jsp @@ -46,7 +46,7 @@ @@ -75,7 +75,7 @@ diff --git a/src/main/webapp/WEB-INF/video.jsp b/src/main/webapp/WEB-INF/video.jsp index e009783fe8ef3ce0c9299b296d29d5f48e495799..64921bcdb298fb662e743afece2693a2fee68b57 100644 --- a/src/main/webapp/WEB-INF/video.jsp +++ b/src/main/webapp/WEB-INF/video.jsp @@ -4,6 +4,7 @@ Author : Adrien --%> <%@ taglib prefix="c" uri="jakarta.tags.core" %> +<%@ taglib prefix="fmt" uri="jakarta.tags.fmt" %> <%@page contentType="text/html" pageEncoding="UTF-8"%> @@ -18,24 +19,22 @@
- +
-
360 flip par Jean-Guy
-

13 Octobre 2026

+
${post.title} par @${post.author.username}
+ +

Publié le

thumbs up -

340

+

${post.score}

thumbs down

-

- Dans cette vidéo, je te montre comment réussir ton premier kickflip. On commence par la position des pieds, puis le mouvement de cheville et enfin l'atterrissage. - Regarde les ralentis pour bien comprendre le timing. N'oublie pas de protéger tes genoux et de commencer sur une surface plane. -

+

${post.description}

@@ -47,13 +46,13 @@
- -
+ +
Profile picture
-

Amina Benali

-

13 Octobre 2026

-

"Reception propre comme jamais vue, c’est ça la différence entre un trick qui passe et un trick propre."

+

${thisComment.author.username}

+

Publié le

+

${thisComment.content}

Signaler

diff --git a/src/main/webapp/assets/css/style.css b/src/main/webapp/assets/css/style.css index 4cbf76c7ce38eecc36cd0ad8d285aa277d81c1ce..c0e43bf44c8bdba3db7f53cbb1b7a2724754b2e5 100644 --- a/src/main/webapp/assets/css/style.css +++ b/src/main/webapp/assets/css/style.css @@ -350,30 +350,47 @@ a, button, input[type="submit"], input[type="button"] { /*------------------- JSP REGISTER / LOGIN ------------ */ -.textRegister, .textLogin{ - color: white; - font-family: 'Permanent Marker', cursive; - font-size: 20px; +/*------------------- JSP VIDEO ------------ */ +.main-video { + display: flex; + justify-content: center; + width: 100%; + padding: 40px 20px; + box-sizing: border-box; } -.mainRegister, .mainLogin, .mainProfile{ - margin: 20px 70px 20px 70px; +.main-video .video { + flex: 0 1 900px; + width: 100%; + max-width: 900px; + box-sizing: border-box; } .register-container, .login-container, .addPost-container, .update-container, .deleteAccount-container { background-color: black; padding: 50px; border-radius: 24px; +.main-video .video-player { + width: 100%; + aspect-ratio: 16 / 9; +} + +.main-video .video-player iframe { + display: block; + width: 100%; + height: 100%; + border: none; +} + +.title { display: flex; justify-content: space-between; align-items: center; - gap: 40px; - margin: 20px 70px; + width: 100%; } -.imgRegister, .imgLogin { - width: 40%; - height: auto; +.title > div:first-child { + text-align: left; } .formRegister, .formLogin, .formAddPost, .formUpdate{ @@ -433,35 +450,125 @@ a, button, input[type="submit"], input[type="button"] { } .button-container-profile{ +.title > div:last-child { display: flex; align-items: center; - justify-content: center; - gap: 20px; + gap: 10px; +} + +.title > div:last-child img { + width: 36px; + height: 36px; } -.watchButton{ - padding: 12px 24px; - background-color: #DBFA19; - color: #222; - font-family: 'Permanent Marker', cursive; - text-decoration: none; +.title > div:last-child p { + font-size: 22px; font-weight: bold; - font-size: 25px; - border-radius: 45px; - border: 2px solid #fff176; +} + +.title h5, +.title p { + margin: 5px 0; +} + +.title img { + width: 24px; + height: 24px; + object-fit: contain; +} + +.main-video .video > p { + font-weight: bold; + margin-top: 15px; +} + +.comments { + background-color: black; + width: 66%; + margin: 20px auto; + box-sizing: border-box; + border-radius: 12px; + border: 2px solid #ff9ed0; box-shadow: - 0 0 5px #ffeb3b, - 0 0 10px #ffd500, - 0 0 20px rgba(255, 213, 0, 0.7); + 0 0 8px #ff9ed0, + 0 0 18px #e84393, + 0 0 35px #e84393, + 0 0 55px rgba(232, 67, 147, 0.8); +} +.comments h2 { + font-size: 40px; } -.deleteButton{ - padding: 12px 24px; - background-color: #FA3FA6; - color: #222; - font-family: 'Permanent Marker', cursive; - text-decoration: none; +.comment-form { + display: flex; + align-items: flex-start; + gap: 15px; + width: 100%; + max-width: 800px; + margin: 25px auto; +} + +.comment-avatar { + width: 55px; + height: 55px; + border-radius: 50%; + object-fit: cover; + flex-shrink: 0; +} + +.comment-input { + position: relative; + flex: 1; + min-width: 0; +} + +.comment-input textarea { + display: block; + width: 100%; + box-sizing: border-box; + padding: 15px; + resize: vertical; + + border: 2px solid #ff9ed0; + border-radius: 12px; + background: #1e1e2f; + color: white; + font: inherit; +} + +.comment-input textarea:focus { + outline: none; +} + +.comment-input .yellowButton { + position: absolute; + right: 10px; + bottom: 10px; + cursor: pointer; +} + +.grey { + color: grey; +} + +.user-comment { + display: flex; + gap: 15px; + margin: 25px auto; + max-width: 800px; + color: white; +} + +.user-comment div { + border: 2px solid #ff9ed0; + border-radius: 12px; + background: #1e1e2f; + padding: 15px; +} + +.user-comment p { + margin: 0; font-weight: bold; font-size: 25px; border-radius: 45px; @@ -474,4 +581,29 @@ a, button, input[type="submit"], input[type="button"] { 0 0 10px rgba(232, 67, 147, 0.8); } +.user-comments { + display: flex; + gap: 15px; + margin: 25px auto; + max-width: 800px; + color: white; +} + +.user-comments div { + border: 2px solid #ff9ed0; + border-radius: 12px; + background: #1e1e2f; + padding: 15px; +} + +.user-comments p { + margin: 0; + font-weight: bold; + font-size: 25px; + border-radius: 45px; + cursor: url('../img/cursor.png'), pointer; +} +#message { + margin: 10px 0; +}