diff --git a/Site Web/client/public/uploads/profil/undefined.jpg b/Site Web/client/public/uploads/profil/undefined.jpg new file mode 100644 index 00000000..e69de29b diff --git a/Site Web/client/src/actions/post.actions.js b/Site Web/client/src/actions/post.actions.js index 46940b94..e42b12df 100644 --- a/Site Web/client/src/actions/post.actions.js +++ b/Site Web/client/src/actions/post.actions.js @@ -7,7 +7,22 @@ export const getPosts = (num) => { return axios .get(`${process.env.REACT_APP_API_URL}api/post/`) .then((res) => { - const array = res.data.slice(0, num); + let array = res.data.slice(0, num); + dispatch(setPostData(array)); + }) + .catch((err) => console.log(err)) + } +} + +export const getPostsDisc = (num) => { + return (dispatch) => { + return axios + .get(`${process.env.REACT_APP_API_URL}api/post/`) + .then((res) => { + console.log("test"); + let array = res.data.sort((a, b) => b.likers.length - a.likers.length); + array = array.slice(0, num); + console.log(array); dispatch(setPostData(array)); }) .catch((err) => console.log(err)) diff --git a/Site Web/client/src/actions/user.actions.js b/Site Web/client/src/actions/user.actions.js index ed923594..aa0a1414 100644 --- a/Site Web/client/src/actions/user.actions.js +++ b/Site Web/client/src/actions/user.actions.js @@ -20,7 +20,7 @@ export const uploadPicture = (data, id) => { .then((res) => { return axios .get(`${process.env.REACT_APP_API_URL}api/user/${id}`) - .then((res) => { + .then((res) => { dispatch(setUserDataImg(res.data.picture)); }) }) diff --git a/Site Web/client/src/components/AjoutLien.js b/Site Web/client/src/components/AjoutLien.js index 8c192a19..4ef8e33f 100644 --- a/Site Web/client/src/components/AjoutLien.js +++ b/Site Web/client/src/components/AjoutLien.js @@ -19,7 +19,7 @@ const AjoutLien = () => { dispatch(getPosts()); cancelPost(); setDisplayAdd(false); - //window.location.reload(); + window.location.reload(); }else { alert("Veuillez compléter tous les champs.") } diff --git a/Site Web/client/src/components/Configurations/ConfigurationDuCompte.js b/Site Web/client/src/components/Configurations/ConfigurationDuCompte.js index 9482ee9c..a0f2c819 100644 --- a/Site Web/client/src/components/Configurations/ConfigurationDuCompte.js +++ b/Site Web/client/src/components/Configurations/ConfigurationDuCompte.js @@ -14,7 +14,7 @@ const ConfigurationDuCompte =()=>{ return(
-

Modifucation information du compte

+

Modification des information du compte

diff --git a/Site Web/client/src/components/Configurations/ConfigurationDuProfil.js b/Site Web/client/src/components/Configurations/ConfigurationDuProfil.js index 1fd55fb2..b79b8ac7 100644 --- a/Site Web/client/src/components/Configurations/ConfigurationDuProfil.js +++ b/Site Web/client/src/components/Configurations/ConfigurationDuProfil.js @@ -1,8 +1,10 @@ import React, { useState } from 'react'; -import { useSelector } from 'react-redux'; +import { useSelector, useDispatch } from 'react-redux'; import PP from "../../assets/img/unknown.png"; import PLUS from "../../assets/img/plus.png"; import { NavLink } from "react-router-dom"; +import axios from "axios"; +import { uploadPicture } from '../../actions/user.actions'; @@ -10,47 +12,81 @@ const ConfigurationDuProfil = ()=>{ const userData = useSelector((state) => state.user.user); - const [pseudo, setPseudo] = useState(''); - const [nomUtilisateur, setNomUtilisateur] = useState(''); + const [pseudo, setPseudo] = useState(userData.pseudo); + const[userPicture, setUserPicture] = useState(userData.picture) + const [tmpImage, setTmpImage] =useState('') const [displayAdd, setDisplayAdd] = useState(false); - /*const [updateImage, setUpdateImage]= useState(false); - const setimageDeProfile=()=>{ - if(updateImage=true){ - useState(""); + const dispatch = useDispatch(); + + const handleValidationPopup =(e)=>{ + setUserPicture(tmpImage); setDisplayAdd(false); - } - else{ - setDisplayAdd(false); - } - }*/ - var handleLoadFile=(e)=>{ + } + const handleLoadFile=(e)=>{ var image = document.getElementById("output"); image.src = URL.createObjectURL(e.target.files[0]); - + setTmpImage(image.src); + }; + + const handleUpdate = async (e) => { + console.log(userPicture) + e.preventDefault(); + const data = new FormData(); + data.append("pseudo", pseudo); + data.append("userId", userData._id); + data.append("file",userPicture); + + dispatch(uploadPicture(data,userData._id)); + //const pseudoError = document.querySelector(".pseudo.error"); + /* const pictureError =document.querySelector(".picture.error"); + await axios({ + method: "post", + url: `${process.env.REACT_APP_API_URL}api/user/upload`, + data: { + // pseudo, + userPicture, + + } + , + }) + .then((res) => { + console.log(res); + if (res.data.errors) { + //pseudoError.innerHTML = res.data.errors.pseudo; + pictureError.innerHTML = res.data.errors.picture; + } + }) + .catch((err) => console.log(err));*/ }; - var a=PP; + + + + + + + + + + return(
-

Modifucation du Profil

+ +

Modification des informations du Profil

+
+ <> +
+
Pseudo: - Nom d'utilisateur:
- setNomUtilisateur (e.target.value)} - value={nomUtilisateur} - /> { value={pseudo} onChange={(e) => setPseudo (e.target.value)} /> + {/*
*/}
- +
+

Acces au dossiers personnel

- +
@@ -78,27 +116,43 @@ const ConfigurationDuProfil = ()=>{
- -
+
+ +
+
- - + {/* onChange={(e)=> setTmpImage(e.target.files[0].name)} */} +
- - + + +
)}
+ ) + + + + + + + + + + + + } export default ConfigurationDuProfil; \ No newline at end of file diff --git a/Site Web/client/src/components/Configurations/PolitiqueDeConfidentialite.js b/Site Web/client/src/components/Configurations/PolitiqueDeConfidentialite.js index 7dd0a9b4..31f74bff 100644 --- a/Site Web/client/src/components/Configurations/PolitiqueDeConfidentialite.js +++ b/Site Web/client/src/components/Configurations/PolitiqueDeConfidentialite.js @@ -6,17 +6,22 @@ const PolitiqueDeConfidentialite =()=>{ return(
-

Cette politique de confidentialité s’applique au site : Designed By GG. - La présente politique de confidentialité a pour but d’exposer aux utilisateurs du site : - - La manière dont sont collectées et traitées leurs données à caractère - personnel. Doivent être considérées comme données personnelles toutes les données étant susceptibles d’identifier un utilisateur. Il s’agit notamment du prénom et du nom, de l’âge, de l’adresse postale, l’adresse mail, la localisation de l’utilisateur ou encore son adresse IP ; - Quels sont les droits des utilisateurs concernant ces données ; - Qui est responsable du traitement des données à caractère personnes - collectées et traitées ; - A qui ces données sont transmises ; - Eventuellement, la politique du site en matière de fichiers “cookies” -

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc.

+ +

Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

+ +

Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam.

+ +

Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet mauris. Morbi in dui quis est pulvinar ullamcorper. Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus.

+ +

Sed aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo ac, facilisis ac, ultricies eu, pede. Ut orci risus, accumsan porttitor, cursus quis, aliquet eget, justo. Sed pretium blandit orci. Ut eu diam at pede suscipit sodales. Aenean lectus elit, fermentum non, convallis id, sagittis at, neque.

+ +

Nullam mauris orci, aliquet et, iaculis et, viverra vitae, ligula. Nulla ut felis in purus aliquam imperdiet. Maecenas aliquet mollis lectus. Vivamus consectetuer risus et tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum.

+ +

Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor.

+ +

Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti.

+
) } diff --git a/Site Web/client/src/components/Log/Inscription.js b/Site Web/client/src/components/Log/Inscription.js index afc04514..9712e195 100644 --- a/Site Web/client/src/components/Log/Inscription.js +++ b/Site Web/client/src/components/Log/Inscription.js @@ -84,7 +84,7 @@ const Inscription = () => { id="email" onChange={(e) => setEmail(e.target.value)} value={email}/> -
+

diff --git a/Site Web/client/src/components/Post/ActionComment.js b/Site Web/client/src/components/Post/ActionComment.js index 5bb8c085..1b22a76c 100644 --- a/Site Web/client/src/components/Post/ActionComment.js +++ b/Site Web/client/src/components/Post/ActionComment.js @@ -1,6 +1,6 @@ import React, { useContext, useEffect, useState } from 'react'; import { useDispatch } from 'react-redux'; -import { deleteComment } from '../../actions/post.actions'; +import { deleteComment, editComment } from '../../actions/post.actions'; import { UidContext } from '../AppContext'; @@ -14,46 +14,48 @@ const ActionComment = ( { commentaire , postId}) => { const handleEdit = (e) => { e.preventDefault(); if(message){ - //dispatch(); + dispatch(editComment(postId, commentaire._id, message)); setMessage(''); setEdit(false); } }; const handleDelete = () => { - //dispatch(deleteComment(postId, commentaire._id)) + dispatch(deleteComment(postId, commentaire._id)); }; useEffect(() => { const verifCreateur = () => { - if(uid === commentaire.commenterId){ + if(uid === commentaire.commentId){ setCreateur(true); } } + console.log(commentaire); verifCreateur(); + console.log(createur); }, [uid, commentaire.commenterId]); return ( -
+
{createur && edit === false && ( setEdit(!edit)}> - editer + )} {createur && edit && (
+ className="edit-comment-form"> setMessage(e.target.value)} defaultValue={commentaire.text}/> - -
+
+
{ if(window.confirm("Etes-vous sur de supprimer ce commentaire ?")){ handleDelete(); } }}> - Icon supprimer +
diff --git a/Site Web/client/src/components/Post/Comment.js b/Site Web/client/src/components/Post/Comment.js index ae7b03cb..b9a3b727 100644 --- a/Site Web/client/src/components/Post/Comment.js +++ b/Site Web/client/src/components/Post/Comment.js @@ -21,36 +21,68 @@ const Comment = ({ post }) => { } }; - return ( -
- {post.comments.map((comment) => { - return ( -
- ppCommentaire { - if (user._id === comment.commenterId) return user.picture; - else return null; - }).join('') - }/> -

{comment.commenterPseudo}

- {comment.commenterPseudo !== userData._id && ( - )} - - {timestampParser(comment.timestamp)} -

{comment.text}

- + return ( +
+ {post.comments.map((comment) => { + return ( +
+
+ { + if (user._id === comment.commenterId) return user.picture; + else return null; + }) + .join("") + } + alt="commenter-pic" + /> +
+
+
+
+

{comment.commenterPseudo}

+ {comment.commenterId !== userData._id && ( + + )}
- ); - })} - {userData._id && ( - - setMessage(e.target.value)} value={message} placeholder="Ajoutez un commentaire" /> - - - )} + {timestampParser(comment.timestamp)} +
+

{comment.text}

+ +
+
+ ); + })} + {userData._id && ( +
+ setMessage(e.target.value)} + value={message} + placeholder="Laisser un commentaire" + /> +
+ +
+ )}
- ); + ); }; + + export default Comment; \ No newline at end of file diff --git a/Site Web/client/src/components/Post/DisplayPost/DiplayPostDossier.js b/Site Web/client/src/components/Post/DisplayPost/DiplayPostDossier.js new file mode 100644 index 00000000..30bbe569 --- /dev/null +++ b/Site Web/client/src/components/Post/DisplayPost/DiplayPostDossier.js @@ -0,0 +1,32 @@ +import { current } from '@reduxjs/toolkit'; +import React, { useEffect, useState, useContext } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { getPosts } from '../../../actions/post.actions'; +import { isEmpty } from "../../Utils"; +import Post from '../PostNouvelleAffichage'; +import { UidContext } from '../../AppContext'; + +const DiplayPostDossier = () => { + const postsData = useSelector((state) => state.post.post); + const uid = useContext(UidContext); + const dispatch = useDispatch(); + useEffect(() => { + dispatch(getPosts()); + },[dispatch]) + + + return ( +
+
    + {!isEmpty(postsData[0]) && + postsData.map((post) => { + if(post.postedId === uid){ + return + } + })} +
+
+ ); +}; + +export default DiplayPostDossier; \ No newline at end of file diff --git a/Site Web/client/src/components/Post/DisplayPost/DisplayPostLikeProfil.js b/Site Web/client/src/components/Post/DisplayPost/DisplayPostLikeProfil.js new file mode 100644 index 00000000..60b6f9fa --- /dev/null +++ b/Site Web/client/src/components/Post/DisplayPost/DisplayPostLikeProfil.js @@ -0,0 +1,33 @@ +import { current } from '@reduxjs/toolkit'; +import React, { useEffect, useState, useContext } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { getPosts } from '../../../actions/post.actions'; +import { isEmpty } from "../../Utils"; +import Post from '../PostNouvelleAffichage'; +import { UidContext } from '../../AppContext'; + +const DisplayPostLikeProfil = () => { + const postsData = useSelector((state) => state.post.post); + const uid = useContext(UidContext); + const dispatch = useDispatch(); + useEffect(() => { + dispatch(getPosts()); + },[dispatch]) + + + return ( +
+
    + {!isEmpty(postsData[0]) && + postsData.filter(post => post.likers.includes(uid)) + .map((post) => { + return + }) +} + +
+
+ ); +}; + +export default DisplayPostLikeProfil; \ No newline at end of file diff --git a/Site Web/client/src/components/Post/DisplayPost/NouveauDisplayPosts.js b/Site Web/client/src/components/Post/DisplayPost/NouveauDisplayPosts.js new file mode 100644 index 00000000..5cceea77 --- /dev/null +++ b/Site Web/client/src/components/Post/DisplayPost/NouveauDisplayPosts.js @@ -0,0 +1,31 @@ +import { current } from '@reduxjs/toolkit'; +import React, { useEffect, useState, useContext } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { getPosts } from '../../../actions/post.actions'; +import { isEmpty } from "../../Utils"; +import Post from '../PostNouvelleAffichage'; +import { UidContext } from '../../AppContext'; + +const NouveauDisplayPosts = () => { + const postsData = useSelector((state) => state.post.post); + const uid = useContext(UidContext); + const dispatch = useDispatch(); + useEffect(() => { + dispatch(getPosts()); + },[dispatch]) + + return ( +
+
    + {!isEmpty(postsData[0]) && + postsData.map((post) => { + if(post.postedId === uid){ + return + } + })} +
+
+ ); +}; + +export default NouveauDisplayPosts; \ No newline at end of file diff --git a/Site Web/client/src/components/Post/DisplayPosts.js b/Site Web/client/src/components/Post/DisplayPosts.js index 2a96ba93..97b25675 100644 --- a/Site Web/client/src/components/Post/DisplayPosts.js +++ b/Site Web/client/src/components/Post/DisplayPosts.js @@ -1,10 +1,10 @@ import React, { useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { getPosts } from '../../actions/post.actions'; +import { getPosts, getPostsDisc } from '../../actions/post.actions'; import { isEmpty } from "../Utils"; import Post from './Post'; -const DisplayPosts = () => { +const DisplayPosts = ( {type} ) => { const [loadPost, setLoadPost] = useState(true); const [count , setCount] = useState(5); const dispatch = useDispatch(); @@ -17,8 +17,16 @@ const DisplayPosts = () => { } useEffect(() => { + while(postsData== null){ + + } if (loadPost) { - dispatch(getPosts(count)); + if(type === "discover"){ + dispatch(getPostsDisc(count)); + } + else{ + dispatch(getPosts(count)); + } setLoadPost(false); setCount(count + 5); } diff --git a/Site Web/client/src/components/Post/Post.js b/Site Web/client/src/components/Post/Post.js index d2f5aae4..c0899def 100644 --- a/Site Web/client/src/components/Post/Post.js +++ b/Site Web/client/src/components/Post/Post.js @@ -1,11 +1,11 @@ import axios from 'axios'; -import React, { useEffect, useState } from 'react'; +import React, { Component, useEffect, useState } from 'react'; import { useSelector } from 'react-redux'; import FollowHandler from '../UserProfil/FollowHandler'; import { dateParser, isEmpty } from '../Utils'; import ButtonLike from './ButtonLike'; import Comment from './Comment'; - +import Commentaire from '../../assets/img/commentaire.png'; const LinkPreview = ({ link }) => { const [preview, setPreview] = useState({ image: '', title: '', description: '' }); @@ -23,16 +23,19 @@ const LinkPreview = ({ link }) => { }, [link]); if(preview.image === "") { - return (); + return (); } else { return ( -
+ <> +
- {preview.title}/ + {preview.title}/ -

{preview.description}

+
+

{preview.description}

+ ); } }; @@ -48,7 +51,7 @@ const Post = ( { post } ) => { useEffect(() => { - !isEmpty(usersData[0]) && setIsLoading(false) + !isEmpty(usersData[0]) && !isEmpty(userData) && setIsLoading(false) }) return ( @@ -76,8 +79,8 @@ const Post = ( { post } ) => { }).join('') } - {/* {post.postedId !== userData._id && - ()} */} + {post.postedId !== userData._id && + ()}
{dateParser(post.createdAt)}
@@ -94,7 +97,7 @@ const Post = ( { post } ) => {
{post.likers.length}
- setComments(!comments)}/> + setComments(!comments)}/>
{post.comments.length}
diff --git a/Site Web/client/src/components/Post/PostNouvelleAffichage.js b/Site Web/client/src/components/Post/PostNouvelleAffichage.js index ec90d12a..4e4d8d0a 100644 --- a/Site Web/client/src/components/Post/PostNouvelleAffichage.js +++ b/Site Web/client/src/components/Post/PostNouvelleAffichage.js @@ -40,7 +40,6 @@ const LinkPreview = ({ link }) => { const PostNouvelleAffichage = ( { post } ) => { const [isLoading, setIsLoading] = useState(true); const usersData = useSelector((state) => state.users.users); - const userData = useSelector((state) => state.user.user); const [updated,setUpdate] = useState(false); const [message, setMessage] = useState(null); const [comments, setComments] = useState(false); @@ -51,10 +50,11 @@ const PostNouvelleAffichage = ( { post } ) => { }) return ( -
  • +
  • {isLoading ? ( ):( + <>
    {dateParser(post.createdAt)}
    @@ -71,11 +71,12 @@ const PostNouvelleAffichage = ( { post } ) => {
    setComments(!comments)}/> -
    {post.comments.length}
    +
    {post.comments.length}
    - {comments && }
  • + {comments && } + ) } ); diff --git a/Site Web/client/src/components/UserProfil/FollowHandler.js b/Site Web/client/src/components/UserProfil/FollowHandler.js index d2951f4f..026ab498 100644 --- a/Site Web/client/src/components/UserProfil/FollowHandler.js +++ b/Site Web/client/src/components/UserProfil/FollowHandler.js @@ -10,24 +10,26 @@ const FollowHandler = ( { idToFollow , type } ) => { const [isFollowed, setIsFollowed] = useState(false); const dispatch = useDispatch(); - const handleFollow = () => { + const handleFollow = (e) => { - axios.patch(`${process.env.REACT_APP_API_URL}api/user/follow/` + userData._id, {params: {idToFollow: idToFollow}} ) + axios.patch(`${process.env.REACT_APP_API_URL}api/user/follow/` + userData._id, {idToFollow: idToFollow}) .then((res) => { //dispatch(setUserToFollowData({payload: {idToFollow}})); }) .catch((err) => console.log(err)); - setIsFollowed(false); + setIsFollowed(true); + e.preventDefault(); }; - const handleUnFollow = () => { + const handleUnFollow = (e) => { - axios.patch(`${process.env.REACT_APP_API_URL}api/user/unfollow/` + userData._id, {params: {idToFollow: idToFollow}} ) + axios.patch(`${process.env.REACT_APP_API_URL}api/user/unfollow/` + userData._id, {idToUnFollow: idToFollow}) .then((res) => { // dispatch(setUserToUnFollowData({payload: {idToFollow}})); }) .catch((err) => console.log(err)); setIsFollowed(false); + e.preventDefault(); }; diff --git a/Site Web/client/src/components/UserProfil/NavigationProfil/DossiersPersonnels.js b/Site Web/client/src/components/UserProfil/NavigationProfil/DossiersPersonnels.js index 008467b4..f1b7b7fd 100644 --- a/Site Web/client/src/components/UserProfil/NavigationProfil/DossiersPersonnels.js +++ b/Site Web/client/src/components/UserProfil/NavigationProfil/DossiersPersonnels.js @@ -1,4 +1,4 @@ -import NouveauDisplayPosts from "../../Post/NouveauDisplayPosts"; +import DiplayPostDossier from "../../Post/DisplayPost/DiplayPostDossier"; @@ -8,7 +8,7 @@ const DossiersPersonnels=()=>{ return(
    - pppp +
    ) diff --git a/Site Web/client/src/components/UserProfil/NavigationProfil/PostsLikes.js b/Site Web/client/src/components/UserProfil/NavigationProfil/PostsLikes.js index c0e37cdd..bfa79115 100644 --- a/Site Web/client/src/components/UserProfil/NavigationProfil/PostsLikes.js +++ b/Site Web/client/src/components/UserProfil/NavigationProfil/PostsLikes.js @@ -1,4 +1,4 @@ -import NouveauDisplayPosts from "../../Post/NouveauDisplayPosts"; +import DisplayPostLikeProfil from "../../Post/DisplayPost/DisplayPostLikeProfil"; @@ -10,7 +10,7 @@ const PostLikes=()=>{ return(
    - +
    ) diff --git a/Site Web/client/src/components/UserProfil/NavigationProfil/PostsPersonnels.js b/Site Web/client/src/components/UserProfil/NavigationProfil/PostsPersonnels.js index 942a3f41..1b412518 100644 --- a/Site Web/client/src/components/UserProfil/NavigationProfil/PostsPersonnels.js +++ b/Site Web/client/src/components/UserProfil/NavigationProfil/PostsPersonnels.js @@ -1,4 +1,4 @@ -import NouveauDisplayPosts from "../../Post/NouveauDisplayPosts"; +import NouveauDisplayPosts from "../../Post/DisplayPost/NouveauDisplayPosts"; @@ -8,8 +8,7 @@ const PostPersonnels=()=>{ return(
    - oooo - +
    ) } diff --git a/Site Web/client/src/components/UserProfil/SuggestFriends.js b/Site Web/client/src/components/UserProfil/SuggestFriends.js index a21acc13..d4651c7b 100644 --- a/Site Web/client/src/components/UserProfil/SuggestFriends.js +++ b/Site Web/client/src/components/UserProfil/SuggestFriends.js @@ -4,76 +4,95 @@ import { isEmpty } from '../Utils'; import FollowHandler from './FollowHandler'; const SuggestFriends = () => { - // const userData = useSelector((state) => state.user.user); - // const usersData = useSelector((state) => state.users.users); - // const [chargement,setChargement] = useState(true); - // const [change, setChange] = useState(true); - // const [friends, setFriends] = useState([]); + const userData = useSelector((state) => state.user.user); + const usersData = useSelector((state) => state.users.users); + const [chargement,setChargement] = useState(true); + const [change, setChange] = useState(true); + const [friends, setFriends] = useState([]); + useEffect(() => { + const stateFriend = () => { + let array = []; + usersData.map((user) => { + if(user._id !== userData._id && user.followers.includes(userData._id)){ + return array.push(user._id); + } + }) + //mettre dans un ordre aléatoire + array.sort(() => 0.5 - Math.random()); + if(window.innerHeight > 780){ + array.length = 5; + } + if(window.innerHeight > 720){ + array.length = 4; + } + if(window.innerHeight > 660){ + array.length = 3; + } + if(window.innerHeight > 600){ + array.length = 2; + } + if(window.innerHeight > 540){ + array.length = 1; + }else { + array.length = 0; + } + setFriends(array); + } + const stateTopFollowers = () => { + let array = []; + let obj = JSON.parse(JSON.stringify(usersData)); + obj.sort((a, b) => b.followers.length - a.followers.length); + obj.map((user) => { + if(user._id !== userData._id && !user.followers.includes(userData._id)){ + return array.push(user._id); + } + }) + console.log(array); + array = array.splice(0, 5); + setFriends(array); + } - // useEffect(() => { - // const stateFriend = () => { - // let array = []; - // usersData.map((user) => { - // if(user._id !== userData._id && user.followers.includes(userData._id)){ - // return array.push(user._id); - // } - // }) - // //mettre dans un ordre aléatoire - // array.sort(() => 0.5 - Math.random()); - // if(window.innerHeight > 780){ - // array.length = 5; - // } - // if(window.innerHeight > 720){ - // array.length = 4; - // } - // if(window.innerHeight > 660){ - // array.length = 3; - // } - // if(window.innerHeight > 600){ - // array.length = 2; - // } - // if(window.innerHeight > 540){ - // array.length = 1; - // }else { - // array.length = 0; - // } - // setFriends(array); - // } + if(change && !isEmpty(usersData[0]) && userData!=null){ + if(userData.followers.length === 0){ + stateTopFollowers(); + }else{ + stateFriend(); + } + setChargement(false); + setChange(false); + } + }, [userData, usersData, change]) - // if(change && !isEmpty(usersData[0]) && !isEmpty(userData._id)){ - // stateFriend(); - // setChargement(false); - // setChange(false); - // } - // }, [userData, usersData, change]) + return ( +
    +
    + Vous pourriez suivre +
    + {chargement ? ( + + ) : ( +
    + {friends && friends.map((user) => { + for(let i = 0; i < usersData.length; i++){ + if(user === usersData[i]._id){ + return ( +
    + img +

    {usersData[i].pseudo}

    + +
    + ); + } + } + })} - // return ( - //
    - //

    Suggestions

    - // {chargement ? ( - // - // ) : ( - //
      - // {friends && friends.map((user) => { - // for(let i = 0; i < usersData.length; i++){ - // if(user === usersData[i]._id){ - // return ( - //
    • - // img - //

      {usersData[i].pseudo}

      - // - //
    • - // ); - // } - // } - // })} - - //
    - // )} - //
    - //); +
    + )} +
    +
    + ); }; export default SuggestFriends; \ No newline at end of file diff --git a/Site Web/client/src/pages/Configuration.js b/Site Web/client/src/pages/Configuration.js index 7f147372..9c1aeed5 100644 --- a/Site Web/client/src/pages/Configuration.js +++ b/Site Web/client/src/pages/Configuration.js @@ -9,7 +9,7 @@ const Configuration = () => { const [ConfigurationCompte, setConfigurationDuCompte] = useState(false); const [ConfigurationProfil, setConfigurationDuProfil] = useState(true); - const [PolitiqueConfidentialite, setPolitiqueDeConfidentialite] =useState(false) + const [PolitiqueConfidentialite, setPolitiqueDeConfidentialite] =useState(false); const handleModals = (e) => { if (e.target.id === "ConfigurationDuProfil") { diff --git a/Site Web/client/src/pages/Discover.js b/Site Web/client/src/pages/Discover.js index 76b82952..ac7f06f0 100644 --- a/Site Web/client/src/pages/Discover.js +++ b/Site Web/client/src/pages/Discover.js @@ -9,7 +9,7 @@ const Discover = () => {
    - +
    diff --git a/Site Web/client/src/pages/Home.js b/Site Web/client/src/pages/Home.js index 2ad27e0f..484842b9 100644 --- a/Site Web/client/src/pages/Home.js +++ b/Site Web/client/src/pages/Home.js @@ -12,7 +12,7 @@ const Home = () => {
    - +
    diff --git a/Site Web/client/src/reducers/user.reducer.js b/Site Web/client/src/reducers/user.reducer.js index f76bb3b9..4ecf0d6d 100644 --- a/Site Web/client/src/reducers/user.reducer.js +++ b/Site Web/client/src/reducers/user.reducer.js @@ -22,6 +22,7 @@ export const userSlice = createSlice({ (id) => id !== action.payload.idToUnfollow ),}; }, + }, }); diff --git a/Site Web/client/src/styles/_settings.scss b/Site Web/client/src/styles/_settings.scss index a3808849..ca99a006 100644 --- a/Site Web/client/src/styles/_settings.scss +++ b/Site Web/client/src/styles/_settings.scss @@ -8,6 +8,8 @@ $color-5: #AABBCC; $color-6: #5499c7 ; $color-7: #19104f ; $color-8: #FAFAFA; +$color-9: #645b5b; +$color-10:#dddddd; // $color-1: #4cbfa6; @@ -32,7 +34,10 @@ body{ .imageDeProfil{ object-fit: cover; + background-size: cover; + width: 180px; + height: 180px; clip-path:circle(50%); - + } diff --git a/Site Web/client/src/styles/component/_ajoutLien.scss b/Site Web/client/src/styles/component/_ajoutLien.scss index 8a647b91..09903901 100644 --- a/Site Web/client/src/styles/component/_ajoutLien.scss +++ b/Site Web/client/src/styles/component/_ajoutLien.scss @@ -8,16 +8,18 @@ cursor: pointer; } -.popup-profil-container { - z-index: 100; - width: 100%; - top: 0; - left: 0; - height: 100%; - position: fixed; - animation: popup 1s forwards; + +.popup-ajout-container { + position: fixed; + animation: popup 1s forwards; + z-index: 100; + left: 50%; + @keyframes popup { + from{ + backdrop-filter: none; + } to { backdrop-filter: blur(2px); } @@ -49,6 +51,7 @@ top: 25px; right: 25px; transition: 0.1s; + cursor: pointer; &:hover { @@ -57,23 +60,12 @@ } ul { + min-width: 250px; + max-width: 300px; margin: 20px 0 0; max-height: 500px; - overflow-y: scroll; - overflow-x: hidden; + min-height: 200px; - &::-webkit-scrollbar { - width: 2px; - } - &::-webkit-scrollbar-track { - background: $color-4; - } - &::-webkit-scrollbar-thumb { - background: $color-1; - } - &::-webkit-scrollbar-thumb:hover { - background: #555; - } li { display: grid; diff --git a/Site Web/client/src/styles/component/_configurationDuProfil.scss b/Site Web/client/src/styles/component/_configurationDuProfil.scss index 8118274c..42df3a29 100644 --- a/Site Web/client/src/styles/component/_configurationDuProfil.scss +++ b/Site Web/client/src/styles/component/_configurationDuProfil.scss @@ -16,14 +16,15 @@ flex-direction: column; padding-left:5%; font-size: medium; + span{ -} + margin-bottom: 4%; + + } -span{ +} - margin-bottom: 4%; -} .plusButton{ @@ -38,9 +39,10 @@ span{ .imageDeProfilConfigurationPlus { position: relative; + width: 15%; - max-width: 180px; - min-width: 130px; + max-width: 200px; + min-width: 150px; border: none; } @@ -119,8 +121,8 @@ input{ transform: scaleY(0); transform-origin: center; animation: modal .5s forwards; - max-width: 360px; - min-width: 320px; + max-width: 650px; + min-width: 500px; border: 2px solid $color-4; border-bottom-right-radius: 50px; @@ -130,42 +132,33 @@ input{ } } - &:hover { - transform: scale(1.07); - } + } - &::-webkit-scrollbar { - width: 2px; - } - &::-webkit-scrollbar-track { - background: $color-4; - } - &::-webkit-scrollbar-thumb { - background: $color-1; - } - &::-webkit-scrollbar-thumb:hover { - background: #555; - } + .imagesPopup{ display: flex; justify-content: space-between; flex-direction: row; + .imageModifSpace{ + margin-right: 18%; + img{ + max-width: initial; + } + } .profile-pic { + position: relative; + width: 100%; color: transparent; transition: all .3s ease; @include object-center; - position: relative; - transition: all .3s ease; - input{ display:none; } img{ position: absolute; - object-fit: cover; z-index: 0; } .-label { diff --git a/Site Web/client/src/styles/component/_politiqueDeConfidentialite.scss b/Site Web/client/src/styles/component/_politiqueDeConfidentialite.scss index 07f4301e..5de9df34 100644 --- a/Site Web/client/src/styles/component/_politiqueDeConfidentialite.scss +++ b/Site Web/client/src/styles/component/_politiqueDeConfidentialite.scss @@ -1,31 +1,35 @@ .PolitiqueDeConfidentialiteText{ - margin-top: 2%; + display: flex; + justify-content: center; + flex-direction: column; + margin-top: 0.2%; margin-left: 5%; text-indent: 1%; text-align: justify; - display: flex; - justify-content: center; + + background-color: $color-8; border: 0.2px solid $color-5; max-width:85% ; min-width: 380px; height: 550px; + overflow-y: scroll; + scrollbar-width: thin; + scrollbar-gutter: stable both-edges; p{ - animation-duration: 2s; + animation-duration: 1s; animation-name: slide; margin: 1.5%; @keyframes slide { from { - margin-top: 100%; - width: 50%; + width: 80%; } to { - margin-top: 0%; width: 100%; } } diff --git a/Site Web/client/src/styles/component/_postNouvelleAffichage.scss b/Site Web/client/src/styles/component/_postNouvelleAffichage.scss index 913f7dd6..55e07e64 100644 --- a/Site Web/client/src/styles/component/_postNouvelleAffichage.scss +++ b/Site Web/client/src/styles/component/_postNouvelleAffichage.scss @@ -1,4 +1,4 @@ -.conteneur_postes{ +.PostesProfilConteneur{ display: flex; flex-direction: column; .unPosteNouvelleAffichage{ @@ -9,15 +9,20 @@ background: $color-8; border: 0.3px solid $color-5; margin: 0.2% 1%; - padding: 1%; + padding: 1% 3%; + border-radius: 10px; .dateDePublicationDuPost{ - flex: 0.5 0.8 20%; + flex: 0 0 22%; } .LienDunPosteNouvelleAffichage{ display: flex; - justify-content: space-around; + justify-content: space-between; flex-flow: row wrap; flex: 0.9 0 60%; + margin-left: 3%; + p{ + margin-left: 5%; + } } .informationDunPosteNouvelleAffichage{ @@ -25,21 +30,28 @@ flex-direction: row; justify-content: space-between; padding-left: 10%; - flex: 0.5 0.8 auto; + flex: 0.5 0.4 auto; } + + } + .CommentaireProfil{ + background: $color-8; + border: 0.3px solid $color-5; } +} + + + .PreviewPostNouvelleAffichage{ - min-width: 100px; width: 80%; max-height: 48px; } .postPersonnel .dossierPersonnel{ - display: flex; + display: flex; flex-direction: column; - width: 100; - } - -} \ No newline at end of file + width: 100%; + + } \ No newline at end of file diff --git a/Site Web/client/src/styles/component/_poste.scss b/Site Web/client/src/styles/component/_poste.scss index 42ba661d..9c7f6403 100644 --- a/Site Web/client/src/styles/component/_poste.scss +++ b/Site Web/client/src/styles/component/_poste.scss @@ -53,7 +53,6 @@ height:40px; border-radius: 20px; border: 2px solid #555; - margin-bottom: 8%; } #NomProfile{ @@ -77,5 +76,191 @@ align-items:center; } +.alignementLien{ + display: flex; + flex-direction: row; + justify-content: center; + background-color: $color-10; + .LienPostHome{ + min-height:100px ; + height: 100%; + max-height: 300px; + } +} + +.comment-container.client { + background: $color-4; + border: none; + border-radius: 20px 20px 6px 20px; +} + +.comment-container { + display: grid; + grid-template-columns: 50px 1fr; + border: 1px solid $color-2; + padding: 15px; + margin: 5px 0; + border-radius: 20px 20px 20px 6px; + + img { + height: 40px; + width: 40px; + border-radius: 14px; + box-shadow: 1px 1px 3px rgba(51, 51, 51, 0.192); + object-fit: cover; + + } + .comment-header { + display: flex; + justify-content: space-between; + + + .pseudo { + display: flex; + + span { + transform: translate(6px, 4px); + cursor: pointer; + + img { + box-shadow: none; + height: 15px; + width: 15px; + } + } + } + + span { + font-size: 0.9rem; + font-style: italic; + } + } + p { + margin-top: 8px; + } + .edit-comment { + color: $color-2; + img { + float: right; + margin-left: 10px; + cursor: pointer; + transition: 0.15s; + box-shadow: none; + height: 20px; + width: 20px; + + &:hover { + transform: scale(1.1); + } + } + .edit-comment-form { + margin-top: 14px; + label { + background: white; + color: $color-1; + padding: 6px 12px 5px; + border-radius: 20px 20px 20px 6px; + cursor: pointer; + transition: 0.2s; + display: inline-block; + &:hover { + transform: scale(1.05); + } + } + input[type="text"] { + margin: 4px 0; + background: white; + font-size: 1.15rem; + padding: 16px; + width: 100%; + border-radius: 6px 20px 6px 20px; + } + .btn { + display: flex; + align-items: center; + float: right; + + span { + background: white; + padding: 10px 5px; + border-radius: 50px; + margin-right: 6px; + transition: 0.2s; + cursor: pointer; + + &:hover { + background: $color-2; + } + + img { + transform: translate(-5px, 0); + } + } + input[type="submit"] { + background: $color-2; + width: inherit; + transition: 0.2s; + + &:hover { + width: inherit; + background: $color-1; + } + } + } + } + } +} + +.comment-form { + margin-top: 6px; + + input[type="text"] { + width: 100%; + background: $color-4; + border-radius: 20px 20px 6px 20px; + padding: 20px; + font-size: 1.4rem; + + &:focus { + box-shadow: 0 0 2px rgba(51, 51, 51, 0.5); + } + } + input[type="submit"] { + margin-top: 4px; + padding: 12px 16px; + width: 120px; + background: $color-2; + border-radius: 20px 6px 20px 20px; + transition: 0.2s; + float: right; + + &:hover { + background: $color-1; + letter-spacing: 2px; + width: 130px; + } + } + button { + float: right; + background: $color-1; + transition: 0.2s; + + &:hover { + background: $color-2; + } + } +} + +.like-container { + span { + font-size: 1.02rem; + position: absolute; + transform: translate(8px, -1px); + } +} + +.fa-share-alt { + transform: translate(0, 2px); +} \ No newline at end of file diff --git a/Site Web/client/src/styles/pages/_configuration.scss b/Site Web/client/src/styles/pages/_configuration.scss index b34538ea..ac299bc8 100644 --- a/Site Web/client/src/styles/pages/_configuration.scss +++ b/Site Web/client/src/styles/pages/_configuration.scss @@ -39,7 +39,7 @@ input:focus{ background-color:$color-3; } - margin-left: 1%; + margin-left: 6%; } .ligneHorizontal{ diff --git a/Site Web/client/src/styles/pages/_profil.scss b/Site Web/client/src/styles/pages/_profil.scss index 00d42c04..6efa2209 100644 --- a/Site Web/client/src/styles/pages/_profil.scss +++ b/Site Web/client/src/styles/pages/_profil.scss @@ -162,6 +162,7 @@ padding-top: 2%; padding-bottom: 2%; list-style: none; + } .navItemProfil { @@ -317,9 +318,10 @@ margin-top: 1%; } .menuContent{ -background-color: #8c8c8e; +border: 0.3px solid $color-5; +background-color: $color-9; +border-radius: 10px; margin: 0% 0% 0% 2.5%; -border-radius: 25px; width: 95%; height: 85%; } @@ -339,10 +341,12 @@ padding-top: 3%; } .listContent { -/* display: flex; -justify-content: center; */ -padding-left: 2.5%; -padding-top: 2.5%; +padding-left: 1%; +padding-top: 1%; +overflow-y: scroll; +scrollbar-width: thin; +scrollbar-gutter: stable both-edges; + } .basDePage { diff --git a/Site Web/client/src/styles/pages/_trends.scss b/Site Web/client/src/styles/pages/_trends.scss index be391115..a4718530 100644 --- a/Site Web/client/src/styles/pages/_trends.scss +++ b/Site Web/client/src/styles/pages/_trends.scss @@ -1,11 +1,11 @@ #listeNotif{ margin: 2%; - margin-left: 8%; + margin-left: 20%; padding:1%; border-color: $color-5; border-style:solid; border-width: 0.3px; min-width: 410px; - width: 84%; + width: 60%; background: $color-8; } \ No newline at end of file diff --git a/Site Web/controllers/post.controller.js b/Site Web/controllers/post.controller.js index d8a51810..03d83b30 100644 --- a/Site Web/controllers/post.controller.js +++ b/Site Web/controllers/post.controller.js @@ -177,8 +177,8 @@ module.exports.commentPost = async (req, res) => { { $push: { comments: { - commenterId: req.body.commenterId, - commenterPseudo: req.body.commenterPseudo, + commentId: req.body.commenterId, + commentPseudo: req.body.commenterPseudo, text: req.body.text, timestamp: new Date().getTime(), }, diff --git a/Site Web/controllers/upload.controller.js b/Site Web/controllers/upload.controller.js index 8e453b2f..184bc28e 100644 --- a/Site Web/controllers/upload.controller.js +++ b/Site Web/controllers/upload.controller.js @@ -6,23 +6,30 @@ const { uploadErrors } = require('../utils/errors.utils'); module.exports.uploadProfil = async (req, res) => { - try { + console.log(req.body.file); + try { + + console.log(req.body.file); if ( - req.file.detectedMimeType != "image/jpg" && - req.file.detectedMimeType != "image/png" && - req.file.detectedMimeType != "image/jpeg" + req.body.file.detectedMimeType != "image/jpg" && + req.body.file.detectedMimeType != "image/png" && + req.body.file.detectedMimeType != "image/jpeg" ) - throw Error("invalid file"); - - if (req.file.size > 500000) throw Error("max size"); - } catch (err) { - const errors = uploadErrors(err); - return res.status(201).json({ errors }); - } - const fileName = req.body.name + ".jpg"; + throw Error("Invalid file format. Only jpg, jpeg, png formats are allowed."); + + if (req.body.file.size > 500000) throw Error("File size exceeded the maximum limit of 500KB."); + if(req.body.file.size === 0) throw Error("Empty file"); + } catch (err) { + + console.log("File upload failed.") + console.log(err) + return res.status(400).json({ message: err.message }); + + } + const fileName = req.body.file.name + ".jpg"; await pipeline( - req.file.stream, + req.body.file.stream, fs.createWriteStream( `${__dirname}/../client/public/uploads/profil/${fileName}` ) @@ -30,7 +37,7 @@ module.exports.uploadProfil = async (req, res) => { try { await UserModel.findByIdAndUpdate( - req.body.userId, + req.body.file.userId, { $set: { picture: "./uploads/profil/" + fileName } }, { new: true, upsert: true, setDefaultsOnInsert: true }) .then((data) => res.send(data)) diff --git a/Site Web/controllers/user.controller.js b/Site Web/controllers/user.controller.js index 70e22923..ee192b5c 100644 --- a/Site Web/controllers/user.controller.js +++ b/Site Web/controllers/user.controller.js @@ -48,6 +48,24 @@ module.exports.updateUser = async (req, res) => { } }; +// module.exports.compteUpdate = async (req,res)=>{ + +// const{email, password}=req.body + +// try{ +// await UserModel.findOneAndUpdate{ +// {_id: req.params.id} +// {set:{ +// email: req.body.email +// }} +// } +// } + +// } + + + + module.exports.deleteUser = async (req, res) => { if (!ObjectID.isValid(req.params.id)) return res.status(400).send("ID unknown : " + req.params.id); @@ -64,7 +82,6 @@ module.exports.follow = async (req, res) => { if (!ObjectID.isValid(req.params.id) || !ObjectID.isValid(req.body.idToFollow)) { return res.status(400).send("ID unknown : " + req.params.id); } - try { const user = await UserModel.findByIdAndUpdate( req.params.id, @@ -84,68 +101,17 @@ module.exports.follow = async (req, res) => { } }; - -// module.exports.follow = async (req, res) => { -// if ( -// !ObjectID.isValid(req.params.id) || -// !ObjectID.isValid(req.body.idToFollow) -// ) -// return res.status(400).send("ID unknown : " + req.params.id); - -// try { -// // add to the follower list -// await UserModel.findByIdAndUpdate( -// req.params.id, -// { $addToSet: { following: req.body.idToFollow }, }, -// { new: true , upsert: true }, -// (err, docs) => { -// if (!err) return res.send(docs); -// else return res.status(200).send(err); -// } -// ) -// // ajouter à la liste des followers -// await UserModel.findByIdAndUpdate( -// req.body.idToFollow, -// { $addToSet: { followers: req.params.id }, }, -// { new: true , upsert: true}, -// (err, docs) => { -// if (!err) return res.send(docs); -// else return res.status(200).send(err); -// } -// ); -// } catch (err) { -// return res.status(400).send(err); -// } -// }; - module.exports.unfollow = async (req, res) => { - if ( - !ObjectID.isValid(req.params.id) || - !ObjectID.isValid(req.body.idToUnfollow) - ) - return res.status(400).send("ID unknown : " + req.params.id); + console.log(req.body.idToUnFollow); + if (!ObjectID.isValid(req.params.id) || !ObjectID.isValid(req.body.idToUnFollow)) { + return res.status(400).send("Invalid user ID: " + req.params.id); + } try { - await userModel.findByIdAndUpdate( - req.params.id, - { $pull: { following: req.body.idToUnfollow ,} }, - { new: true , upsert: true }, - (err, docs) => { - if (err) return res.status(400).send(err); - } - ); - - // Retirer de la liste des followers - await userModel.findByIdAndUpdate( - req.body.idToUnfollow, - { $pull: { followers: req.params.id } }, - { new: true , upsert: true}, - (err, docs) => { - if (!err) return res.send(docs); - else return res.status(400).send(err); - } - ); + await UserModel.findOneAndUpdate({ _id: req.params.id }, { $pull: { following: req.body.idToUnFollow } }, { new: true }); + await UserModel.findOneAndUpdate({ _id: req.body.idToUnFollow }, { $pull: { followers: req.params.id } }, { new: true }); + res.send({ message: 'unfollow successfull' }); } catch (err) { - return res.status(401).send(err); + return res.status(400).send(err); } } diff --git a/Site Web/models/user.model.js b/Site Web/models/user.model.js index 15873c16..5cabeadd 100644 --- a/Site Web/models/user.model.js +++ b/Site Web/models/user.model.js @@ -51,7 +51,7 @@ const userSchema = new mongoose.Schema( }, picture: { type: String, - default: "/random-user.png" + default: "./random-user.png" }, bio :{ type: String, diff --git a/Site Web/package-lock.json b/Site Web/package-lock.json index 148ecbe6..65899d82 100644 --- a/Site Web/package-lock.json +++ b/Site Web/package-lock.json @@ -22,7 +22,14 @@ "mongoose": "^6.6.6", "multer": "^1.4.5-lts.1", "nodemon": "^2.0.20", - "validator": "^13.7.0" + "react-dom": "^18.2.0", + "react-redux": "^8.0.5", + "react-router-dom": "^6.6.1", + "react-scripts": "^5.0.1", + "sass": "^1.57.1", + "tachyons": "^4.12.0", + "validator": "^13.7.0", + "web-vitals": "^3.1.0" } }, "node_modules/@ampproject/remapping": { @@ -7782,6 +7789,143 @@ "node": ">= 0.8" } }, + "node_modules/enhanced-resolve": { + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz", + "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/error-stack-parser": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.1.4.tgz", + "integrity": "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==", + "dependencies": { + "stackframe": "^1.3.4" + } + }, + "node_modules/es-abstract": { + "version": "1.21.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.1.tgz", + "integrity": "sha512-QudMsPOz86xYz/1dG1OuGBKOELjCh99IIWHLzy5znUB6j8xG2yMA7bfTV86VSqKF+Y/H08vQPR+9jyXpuC6hfg==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.1.3", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.4", + "is-array-buffer": "^3.0.1", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.10", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.2", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.4.3", + "safe-regex-test": "^1.0.0", + "string.prototype.trimend": "^1.0.6", + "string.prototype.trimstart": "^1.0.6", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-array-method-boxes-properly": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", + "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==" + }, + "node_modules/es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "dependencies": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "dependencies": { + "has": "^1.0.3" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -9994,6 +10138,35 @@ "node": ">= 0.10" } }, + "node_modules/is-array-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.1.tgz", + "integrity": "sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-typed-array": "^1.1.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -12195,11 +12368,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/jest-watch-typeahead/node_modules/react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" - }, "node_modules/jest-watch-typeahead/node_modules/slash": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", @@ -15211,6 +15379,11 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/pretty-format/node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -15382,6 +15555,337 @@ "node": ">= 0.8" } }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-app-polyfill": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-3.0.0.tgz", + "integrity": "sha512-sZ41cxiU5llIB003yxxQBYrARBqe0repqPTTYBTmMqTz9szeBbE37BehCE891NZsmdZqqP+xWKdT3eo3vOzN8w==", + "dependencies": { + "core-js": "^3.19.2", + "object-assign": "^4.1.1", + "promise": "^8.1.0", + "raf": "^3.4.1", + "regenerator-runtime": "^0.13.9", + "whatwg-fetch": "^3.6.2" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/react-dev-utils": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz", + "integrity": "sha512-84Ivxmr17KjUupyqzFode6xKhjwuEJDROWKJy/BthkL7Wn6NJ8h4WE6k/exAv6ImS+0oZLRRW5j/aINMHyeGeQ==", + "dependencies": { + "@babel/code-frame": "^7.16.0", + "address": "^1.1.2", + "browserslist": "^4.18.1", + "chalk": "^4.1.2", + "cross-spawn": "^7.0.3", + "detect-port-alt": "^1.1.6", + "escape-string-regexp": "^4.0.0", + "filesize": "^8.0.6", + "find-up": "^5.0.0", + "fork-ts-checker-webpack-plugin": "^6.5.0", + "global-modules": "^2.0.0", + "globby": "^11.0.4", + "gzip-size": "^6.0.0", + "immer": "^9.0.7", + "is-root": "^2.1.0", + "loader-utils": "^3.2.0", + "open": "^8.4.0", + "pkg-up": "^3.1.0", + "prompts": "^2.4.2", + "react-error-overlay": "^6.0.11", + "recursive-readdir": "^2.2.2", + "shell-quote": "^1.7.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/react-dev-utils/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/react-dev-utils/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/react-dev-utils/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/react-dev-utils/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/react-dev-utils/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/react-dev-utils/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/react-dev-utils/node_modules/loader-utils": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.2.1.tgz", + "integrity": "sha512-ZvFw1KWS3GVyYBYb7qkmRM/WwL2TQQBxgCK62rlvm4WpVQ23Nb4tYjApUlfjrEGvOs7KHEsmyUn75OHZrJMWPw==", + "engines": { + "node": ">= 12.13.0" + } + }, + "node_modules/react-dev-utils/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/react-dom": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", + "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.0" + }, + "peerDependencies": { + "react": "^18.2.0" + } + }, + "node_modules/react-error-overlay": { + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", + "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" + }, + "node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" + }, + "node_modules/react-redux": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz", + "integrity": "sha512-Q2f6fCKxPFpkXt1qNRZdEDLlScsDWyrgSj0mliK59qU6W5gvBiKkdMEG2lJzhd1rCctf0hb6EtePPLZ2e0m1uw==", + "dependencies": { + "@babel/runtime": "^7.12.1", + "@types/hoist-non-react-statics": "^3.3.1", + "@types/use-sync-external-store": "^0.0.3", + "hoist-non-react-statics": "^3.3.2", + "react-is": "^18.0.0", + "use-sync-external-store": "^1.0.0" + }, + "peerDependencies": { + "@types/react": "^16.8 || ^17.0 || ^18.0", + "@types/react-dom": "^16.8 || ^17.0 || ^18.0", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0", + "react-native": ">=0.59", + "redux": "^4" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + }, + "redux": { + "optional": true + } + } + }, + "node_modules/react-refresh": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", + "integrity": "sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-router": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.6.2.tgz", + "integrity": "sha512-uJPG55Pek3orClbURDvfljhqFvMgJRo59Pktywkk8hUUkTY2aRfza8Yhl/vZQXs+TNQyr6tu+uqz/fLxPICOGQ==", + "dependencies": { + "@remix-run/router": "1.2.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/react-router-dom": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.6.2.tgz", + "integrity": "sha512-6SCDXxRQqW5af8ImOqKza7icmQ47/EMbz572uFjzvcArg3lZ+04PxSPp8qGs+p2Y+q+b+S/AjXv8m8dyLndIIA==", + "dependencies": { + "@remix-run/router": "1.2.1", + "react-router": "6.6.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, + "node_modules/react-scripts": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.1.tgz", + "integrity": "sha512-8VAmEm/ZAwQzJ+GOMLbBsTdDKOpuZh7RPs0UymvBR2vRk4iZWCskjbFnxqjrzoIvlNNRZ3QJFx6/qDSi6zSnaQ==", + "dependencies": { + "@babel/core": "^7.16.0", + "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3", + "@svgr/webpack": "^5.5.0", + "babel-jest": "^27.4.2", + "babel-loader": "^8.2.3", + "babel-plugin-named-asset-import": "^0.3.8", + "babel-preset-react-app": "^10.0.1", + "bfj": "^7.0.2", + "browserslist": "^4.18.1", + "camelcase": "^6.2.1", + "case-sensitive-paths-webpack-plugin": "^2.4.0", + "css-loader": "^6.5.1", + "css-minimizer-webpack-plugin": "^3.2.0", + "dotenv": "^10.0.0", + "dotenv-expand": "^5.1.0", + "eslint": "^8.3.0", + "eslint-config-react-app": "^7.0.1", + "eslint-webpack-plugin": "^3.1.1", + "file-loader": "^6.2.0", + "fs-extra": "^10.0.0", + "html-webpack-plugin": "^5.5.0", + "identity-obj-proxy": "^3.0.0", + "jest": "^27.4.3", + "jest-resolve": "^27.4.2", + "jest-watch-typeahead": "^1.0.0", + "mini-css-extract-plugin": "^2.4.5", + "postcss": "^8.4.4", + "postcss-flexbugs-fixes": "^5.0.2", + "postcss-loader": "^6.2.1", + "postcss-normalize": "^10.0.1", + "postcss-preset-env": "^7.0.1", + "prompts": "^2.4.2", + "react-app-polyfill": "^3.0.0", + "react-dev-utils": "^12.0.1", + "react-refresh": "^0.11.0", + "resolve": "^1.20.0", + "resolve-url-loader": "^4.0.0", + "sass-loader": "^12.3.0", + "semver": "^7.3.5", + "source-map-loader": "^3.0.0", + "style-loader": "^3.3.1", + "tailwindcss": "^3.0.2", + "terser-webpack-plugin": "^5.2.5", + "webpack": "^5.64.4", + "webpack-dev-server": "^4.6.0", + "webpack-manifest-plugin": "^4.0.2", + "workbox-webpack-plugin": "^6.4.1" + }, + "bin": { + "react-scripts": "bin/react-scripts.js" + }, + "engines": { + "node": ">=14.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + }, + "peerDependencies": { + "react": ">= 16", + "typescript": "^3.2.1 || ^4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/react-scripts/node_modules/dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "engines": { + "node": ">=10" + } + }, + "node_modules/read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", + "dependencies": { + "pify": "^2.3.0" + } + }, "node_modules/readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -15843,16 +16347,126 @@ "resolved": "https://registry.npmjs.org/sanitize.css/-/sanitize.css-13.0.0.tgz", "integrity": "sha512-ZRwKbh/eQ6w9vmTjkuG0Ioi3HBwPFce0O+v//ve+aOq1oeCy7jMV2qzzAlpsNuqpqCBjjriM1lbtZbF/Q8jVyA==" }, - "node_modules/saslprep": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", - "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", - "optional": true, + "node_modules/saslprep": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", + "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", + "optional": true, + "dependencies": { + "sparse-bitfield": "^3.0.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/sass": { + "version": "1.57.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.57.1.tgz", + "integrity": "sha512-O2+LwLS79op7GI0xZ8fqzF7X2m/m8WFfI02dHOdsK5R2ECeS5F62zrwg/relM1rjSLy7Vd/DiMNIvPrQGsA0jw==", + "dependencies": { + "chokidar": ">=3.0.0 <4.0.0", + "immutable": "^4.0.0", + "source-map-js": ">=0.6.2 <2.0.0" + }, + "bin": { + "sass": "sass.js" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/sass-loader": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-12.6.0.tgz", + "integrity": "sha512-oLTaH0YCtX4cfnJZxKSLAyglED0naiYfNG1iXfU5w1LNZ+ukoA5DtyDIN5zmKVZwYNJP4KRc5Y3hkWga+7tYfA==", + "dependencies": { + "klona": "^2.0.4", + "neo-async": "^2.6.2" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "fibers": ">= 3.1.0", + "node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0", + "sass": "^1.3.0", + "sass-embedded": "*", + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "fibers": { + "optional": true + }, + "node-sass": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + } + } + }, + "node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "node_modules/saxes": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz", + "integrity": "sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/scheduler": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==" + }, + "node_modules/selfsigned": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.1.1.tgz", + "integrity": "sha512-GSL3aowiF7wa/WtSFwnUrludWFoNhftq8bUkH9pkzjpN2XSPOAYEgg6e0sS9s0rZwgJzJiQRPU18A6clnoW5wQ==", "dependencies": { - "sparse-bitfield": "^3.0.3" + "node-forge": "^1" }, "engines": { - "node": ">=6" + "node": ">=10" } }, "node_modules/semver": { @@ -17300,6 +17914,59 @@ "node": ">= 0.8" } }, + "node_modules/w3c-hr-time": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", + "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", + "deprecated": "Use your platform's native performance.now() and performance.timeOrigin.", + "dependencies": { + "browser-process-hrtime": "^1.0.0" + } + }, + "node_modules/w3c-xmlserializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz", + "integrity": "sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA==", + "dependencies": { + "xml-name-validator": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dependencies": { + "makeerror": "1.0.12" + } + }, + "node_modules/watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/wbuf": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "dependencies": { + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/web-vitals": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-3.1.1.tgz", + "integrity": "sha512-qvllU+ZeQChqzBhZ1oyXmWsjJ8a2jHYpH8AMaVuf29yscOPZfTQTjQFRX6+eADTdsDE8IanOZ0cetweHMs8/2A==" + }, "node_modules/webidl-conversions": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", @@ -23808,6 +24475,119 @@ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" }, + "enhanced-resolve": { + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz", + "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==", + "requires": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + } + }, + "entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==" + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "error-stack-parser": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.1.4.tgz", + "integrity": "sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==", + "requires": { + "stackframe": "^1.3.4" + } + }, + "es-abstract": { + "version": "1.21.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.1.tgz", + "integrity": "sha512-QudMsPOz86xYz/1dG1OuGBKOELjCh99IIWHLzy5znUB6j8xG2yMA7bfTV86VSqKF+Y/H08vQPR+9jyXpuC6hfg==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.1.3", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.4", + "is-array-buffer": "^3.0.1", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.10", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.2", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.4.3", + "safe-regex-test": "^1.0.0", + "string.prototype.trimend": "^1.0.6", + "string.prototype.trimstart": "^1.0.6", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.9" + } + }, + "es-array-method-boxes-properly": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", + "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==" + }, + "es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" + }, + "es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "requires": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + } + }, + "es-shim-unscopables": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", + "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "requires": { + "has": "^1.0.3" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -25386,6 +26166,29 @@ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, + "is-array-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.1.tgz", + "integrity": "sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-typed-array": "^1.1.10" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" + }, + "is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "requires": { + "has-bigints": "^1.0.1" + } + }, "is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -26966,11 +27769,6 @@ } } }, - "react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" - }, "slash": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", @@ -28988,6 +29786,11 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==" + }, + "react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" } } }, @@ -29119,6 +29922,238 @@ "unpipe": "1.0.0" } }, + "react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "requires": { + "loose-envify": "^1.1.0" + } + }, + "react-app-polyfill": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-3.0.0.tgz", + "integrity": "sha512-sZ41cxiU5llIB003yxxQBYrARBqe0repqPTTYBTmMqTz9szeBbE37BehCE891NZsmdZqqP+xWKdT3eo3vOzN8w==", + "requires": { + "core-js": "^3.19.2", + "object-assign": "^4.1.1", + "promise": "^8.1.0", + "raf": "^3.4.1", + "regenerator-runtime": "^0.13.9", + "whatwg-fetch": "^3.6.2" + } + }, + "react-dev-utils": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz", + "integrity": "sha512-84Ivxmr17KjUupyqzFode6xKhjwuEJDROWKJy/BthkL7Wn6NJ8h4WE6k/exAv6ImS+0oZLRRW5j/aINMHyeGeQ==", + "requires": { + "@babel/code-frame": "^7.16.0", + "address": "^1.1.2", + "browserslist": "^4.18.1", + "chalk": "^4.1.2", + "cross-spawn": "^7.0.3", + "detect-port-alt": "^1.1.6", + "escape-string-regexp": "^4.0.0", + "filesize": "^8.0.6", + "find-up": "^5.0.0", + "fork-ts-checker-webpack-plugin": "^6.5.0", + "global-modules": "^2.0.0", + "globby": "^11.0.4", + "gzip-size": "^6.0.0", + "immer": "^9.0.7", + "is-root": "^2.1.0", + "loader-utils": "^3.2.0", + "open": "^8.4.0", + "pkg-up": "^3.1.0", + "prompts": "^2.4.2", + "react-error-overlay": "^6.0.11", + "recursive-readdir": "^2.2.2", + "shell-quote": "^1.7.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "loader-utils": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.2.1.tgz", + "integrity": "sha512-ZvFw1KWS3GVyYBYb7qkmRM/WwL2TQQBxgCK62rlvm4WpVQ23Nb4tYjApUlfjrEGvOs7KHEsmyUn75OHZrJMWPw==" + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "react-dom": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", + "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "requires": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.0" + } + }, + "react-error-overlay": { + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", + "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" + }, + "react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" + }, + "react-redux": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz", + "integrity": "sha512-Q2f6fCKxPFpkXt1qNRZdEDLlScsDWyrgSj0mliK59qU6W5gvBiKkdMEG2lJzhd1rCctf0hb6EtePPLZ2e0m1uw==", + "requires": { + "@babel/runtime": "^7.12.1", + "@types/hoist-non-react-statics": "^3.3.1", + "@types/use-sync-external-store": "^0.0.3", + "hoist-non-react-statics": "^3.3.2", + "react-is": "^18.0.0", + "use-sync-external-store": "^1.0.0" + } + }, + "react-refresh": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", + "integrity": "sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==" + }, + "react-router": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.6.2.tgz", + "integrity": "sha512-uJPG55Pek3orClbURDvfljhqFvMgJRo59Pktywkk8hUUkTY2aRfza8Yhl/vZQXs+TNQyr6tu+uqz/fLxPICOGQ==", + "requires": { + "@remix-run/router": "1.2.1" + } + }, + "react-router-dom": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.6.2.tgz", + "integrity": "sha512-6SCDXxRQqW5af8ImOqKza7icmQ47/EMbz572uFjzvcArg3lZ+04PxSPp8qGs+p2Y+q+b+S/AjXv8m8dyLndIIA==", + "requires": { + "@remix-run/router": "1.2.1", + "react-router": "6.6.2" + } + }, + "react-scripts": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.1.tgz", + "integrity": "sha512-8VAmEm/ZAwQzJ+GOMLbBsTdDKOpuZh7RPs0UymvBR2vRk4iZWCskjbFnxqjrzoIvlNNRZ3QJFx6/qDSi6zSnaQ==", + "requires": { + "@babel/core": "^7.16.0", + "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3", + "@svgr/webpack": "^5.5.0", + "babel-jest": "^27.4.2", + "babel-loader": "^8.2.3", + "babel-plugin-named-asset-import": "^0.3.8", + "babel-preset-react-app": "^10.0.1", + "bfj": "^7.0.2", + "browserslist": "^4.18.1", + "camelcase": "^6.2.1", + "case-sensitive-paths-webpack-plugin": "^2.4.0", + "css-loader": "^6.5.1", + "css-minimizer-webpack-plugin": "^3.2.0", + "dotenv": "^10.0.0", + "dotenv-expand": "^5.1.0", + "eslint": "^8.3.0", + "eslint-config-react-app": "^7.0.1", + "eslint-webpack-plugin": "^3.1.1", + "file-loader": "^6.2.0", + "fs-extra": "^10.0.0", + "fsevents": "^2.3.2", + "html-webpack-plugin": "^5.5.0", + "identity-obj-proxy": "^3.0.0", + "jest": "^27.4.3", + "jest-resolve": "^27.4.2", + "jest-watch-typeahead": "^1.0.0", + "mini-css-extract-plugin": "^2.4.5", + "postcss": "^8.4.4", + "postcss-flexbugs-fixes": "^5.0.2", + "postcss-loader": "^6.2.1", + "postcss-normalize": "^10.0.1", + "postcss-preset-env": "^7.0.1", + "prompts": "^2.4.2", + "react-app-polyfill": "^3.0.0", + "react-dev-utils": "^12.0.1", + "react-refresh": "^0.11.0", + "resolve": "^1.20.0", + "resolve-url-loader": "^4.0.0", + "sass-loader": "^12.3.0", + "semver": "^7.3.5", + "source-map-loader": "^3.0.0", + "style-loader": "^3.3.1", + "tailwindcss": "^3.0.2", + "terser-webpack-plugin": "^5.2.5", + "webpack": "^5.64.4", + "webpack-dev-server": "^4.6.0", + "webpack-manifest-plugin": "^4.0.2", + "workbox-webpack-plugin": "^6.4.1" + }, + "dependencies": { + "dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" + } + } + }, + "read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", + "requires": { + "pify": "^2.3.0" + } + }, "readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -29448,6 +30483,69 @@ "sparse-bitfield": "^3.0.3" } }, + "sass": { + "version": "1.57.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.57.1.tgz", + "integrity": "sha512-O2+LwLS79op7GI0xZ8fqzF7X2m/m8WFfI02dHOdsK5R2ECeS5F62zrwg/relM1rjSLy7Vd/DiMNIvPrQGsA0jw==", + "requires": { + "chokidar": ">=3.0.0 <4.0.0", + "immutable": "^4.0.0", + "source-map-js": ">=0.6.2 <2.0.0" + } + }, + "sass-loader": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-12.6.0.tgz", + "integrity": "sha512-oLTaH0YCtX4cfnJZxKSLAyglED0naiYfNG1iXfU5w1LNZ+ukoA5DtyDIN5zmKVZwYNJP4KRc5Y3hkWga+7tYfA==", + "requires": { + "klona": "^2.0.4", + "neo-async": "^2.6.2" + } + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "saxes": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz", + "integrity": "sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==", + "requires": { + "xmlchars": "^2.2.0" + } + }, + "scheduler": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "requires": { + "loose-envify": "^1.1.0" + } + }, + "schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + }, + "select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==" + }, + "selfsigned": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.1.1.tgz", + "integrity": "sha512-GSL3aowiF7wa/WtSFwnUrludWFoNhftq8bUkH9pkzjpN2XSPOAYEgg6e0sS9s0rZwgJzJiQRPU18A6clnoW5wQ==", + "requires": { + "node-forge": "^1" + } + }, "semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -30538,6 +31636,52 @@ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" }, + "w3c-hr-time": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", + "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", + "requires": { + "browser-process-hrtime": "^1.0.0" + } + }, + "w3c-xmlserializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz", + "integrity": "sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA==", + "requires": { + "xml-name-validator": "^3.0.0" + } + }, + "walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "requires": { + "makeerror": "1.0.12" + } + }, + "watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "requires": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + } + }, + "wbuf": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "requires": { + "minimalistic-assert": "^1.0.0" + } + }, + "web-vitals": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-3.1.1.tgz", + "integrity": "sha512-qvllU+ZeQChqzBhZ1oyXmWsjJ8a2jHYpH8AMaVuf29yscOPZfTQTjQFRX6+eADTdsDE8IanOZ0cetweHMs8/2A==" + }, "webidl-conversions": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", diff --git a/Site Web/routes/user.routes.js b/Site Web/routes/user.routes.js index 927bcd0f..f528ad2e 100644 --- a/Site Web/routes/user.routes.js +++ b/Site Web/routes/user.routes.js @@ -12,10 +12,11 @@ router.post('/login', authController.signIn); //retirer le token (cookie) router.get('/logout', authController.logout); + // user router.get('/', userController.getAllUsers); router.get('/:id', userController.userInfo); -//put pour faire des updates +router.put("/:id", userController.updateUser); router.put('/:id', userController.updateUser); router.delete('/:id', userController.deleteUser); router.patch('/follow/:id', userController.follow); diff --git a/Site Web/utils/errors.utils.js b/Site Web/utils/errors.utils.js index b6928bd7..dfdb9eb0 100644 --- a/Site Web/utils/errors.utils.js +++ b/Site Web/utils/errors.utils.js @@ -32,24 +32,17 @@ module.exports.signInErrors = (err) => { } module.exports.uploadErrors = (err) => { - let errors = { format: '', maxSize: ""}; + let errors = { format: '', maxSize: "",empty:""}; if (err.message.includes('invalid file')) errors.format = "Format incompatabile"; if (err.message.includes('max size')) errors.maxSize = "Le fichier dépasse 500ko"; + + if(err.message.includes('empty file')) + errors.empty ="Le fichier est vide"; return errors } -module.exports.uploadErrors = (err) => { - let errors = { format: '', maxSize: ""}; - - if (err.message.includes('invalid file')) - errors.format = "Format incompatible"; - - if (err.message.includes('max size')) - errors.maxSize = "Le fichier dépasse 500ko"; - return errors; -} \ No newline at end of file