From 517341d0d16b9381994257485e9f9b91fb6c3bfa Mon Sep 17 00:00:00 2001 From: cassiopeelaurie Date: Tue, 6 Feb 2024 16:55:32 +0100 Subject: [PATCH 1/5] details home page --- frontend/src/components/CardModel/CardOffer.jsx | 8 +++++++- frontend/src/pages/HomeOffer/Home.jsx | 7 ++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/CardModel/CardOffer.jsx b/frontend/src/components/CardModel/CardOffer.jsx index 91d837d..c890a79 100644 --- a/frontend/src/components/CardModel/CardOffer.jsx +++ b/frontend/src/components/CardModel/CardOffer.jsx @@ -5,6 +5,12 @@ import "./card-model.css"; import { useGlobalContext } from "../../contexts/GlobalContext"; function CardOffer() { + const trimText = (chaine, limite) => { + if (chaine.length <= limite) { + return chaine; + } + return `${chaine.slice(0, limite)}...`; + }; const globalContext = useGlobalContext(); const [offers, setOffers] = useState([]); useEffect(() => { @@ -30,7 +36,7 @@ function CardOffer() { {offer.type} - {offer.city}

{offer.company}

-

{offer.mission}

+

{trimText(offer.mission, 250)}

))} diff --git a/frontend/src/pages/HomeOffer/Home.jsx b/frontend/src/pages/HomeOffer/Home.jsx index b56f8eb..34a2e7b 100644 --- a/frontend/src/pages/HomeOffer/Home.jsx +++ b/frontend/src/pages/HomeOffer/Home.jsx @@ -80,12 +80,9 @@ function Home() { /> )) ) : ( - <> +
- - - - +
)} From 671d0db990aa1621982840dbf92e4ada142a22bc Mon Sep 17 00:00:00 2001 From: cassiopeelaurie Date: Tue, 6 Feb 2024 17:25:54 +0100 Subject: [PATCH 2/5] redirect login for offer --- .../src/components/CardModel/CardOffer.jsx | 33 +++---------------- frontend/src/pages/HomeOffer/Home.jsx | 30 +---------------- 2 files changed, 5 insertions(+), 58 deletions(-) diff --git a/frontend/src/components/CardModel/CardOffer.jsx b/frontend/src/components/CardModel/CardOffer.jsx index c890a79..727d75e 100644 --- a/frontend/src/components/CardModel/CardOffer.jsx +++ b/frontend/src/components/CardModel/CardOffer.jsx @@ -1,10 +1,13 @@ import PropTypes from "prop-types"; import { useEffect, useState } from "react"; +import { useNavigate } from "react-router-dom"; import ButtonMini from "../Boutons/ButtonMini"; import "./card-model.css"; import { useGlobalContext } from "../../contexts/GlobalContext"; function CardOffer() { + const navigate = useNavigate(); + const handleClickPostuler = () => navigate("/login"); const trimText = (chaine, limite) => { if (chaine.length <= limite) { return chaine; @@ -37,41 +40,13 @@ function CardOffer() {

{offer.company}

{trimText(offer.mission, 250)}

- + ))} ); } -// return ( -//
-// {offers.map((offer) => ( -//
-// {" "} -// {/* Ajoutez une clé unique pour chaque élément de la liste */} -//

{offer.title}

{" "} -// {/* Utilisez la propriété 'title' pour afficher le titre de l'offre */} -//
-// {/* Affichez les compétences de l'offre si nécessaire */} -// {offer.competences.map((competence) => ( -//

{competence.name}

-// ))} -//
-//
-// {offer.type} - {offer.city} -//
-//

{offer.company}

{" "} -// {/* Utilisez la propriété 'company' pour afficher le nom de l'entreprise */} -//

{offer.description}

{" "} -// {/* Utilisez la propriété 'description' pour afficher la description de l'offre */} -// -//
-// ))} -//
-// ); -// } - CardOffer.propTypes = { offer: PropTypes.shape({ id: PropTypes.number.isRequired, diff --git a/frontend/src/pages/HomeOffer/Home.jsx b/frontend/src/pages/HomeOffer/Home.jsx index 34a2e7b..4e5bd31 100644 --- a/frontend/src/pages/HomeOffer/Home.jsx +++ b/frontend/src/pages/HomeOffer/Home.jsx @@ -4,6 +4,7 @@ import { useGlobalContext } from "../../contexts/GlobalContext"; import "./Home.css"; import CardOffre from "../../components/CardModel/CardOffre"; import { useUserContext } from "../../contexts/UserContext"; + import HomeCard from "../../components/HomeCard/HomeCard"; import CardOffer from "../../components/CardModel/CardOffer"; @@ -13,22 +14,6 @@ function Home() { const [matchingOffers, setMatchingOffers] = useState([]); useEffect(() => { - // const getOffer = async () => { - // try { - // const response = await fetch( - // `${import.meta.env.VITE_BACKEND_URL}/api/offer` - // ); - // if (response.ok) { - // const data = await response.json(); - // setOffers(data); - // } else { - // console.error("Echec de la récupération des données."); - // } - // } catch (err) { - // console.error(err); - // } - // }; - const getOfferMatch = async () => { try { const response = await apiService.get( @@ -41,19 +26,6 @@ function Home() { }; getOfferMatch(); - // getOffer(); - - // const getOffer = async () => { - // try { - // const response = await axios.get(`${import.meta.env.VITE_BACKEND_URL}/api/offer`); - // console.log(response.data); - // setOffers(response.data); - // } catch (err) { - // console.error(err); - // }; - // } - - // getOffer(); }, []); return ( From 00878789fee03503d47c5af5a8a616ef2337d286 Mon Sep 17 00:00:00 2001 From: cassiopeelaurie Date: Tue, 6 Feb 2024 16:55:32 +0100 Subject: [PATCH 3/5] details home page --- frontend/src/components/CardModel/CardOffer.jsx | 8 +++++++- frontend/src/pages/HomeOffer/Home.jsx | 7 ++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/CardModel/CardOffer.jsx b/frontend/src/components/CardModel/CardOffer.jsx index 91d837d..c890a79 100644 --- a/frontend/src/components/CardModel/CardOffer.jsx +++ b/frontend/src/components/CardModel/CardOffer.jsx @@ -5,6 +5,12 @@ import "./card-model.css"; import { useGlobalContext } from "../../contexts/GlobalContext"; function CardOffer() { + const trimText = (chaine, limite) => { + if (chaine.length <= limite) { + return chaine; + } + return `${chaine.slice(0, limite)}...`; + }; const globalContext = useGlobalContext(); const [offers, setOffers] = useState([]); useEffect(() => { @@ -30,7 +36,7 @@ function CardOffer() { {offer.type} - {offer.city}

{offer.company}

-

{offer.mission}

+

{trimText(offer.mission, 250)}

))} diff --git a/frontend/src/pages/HomeOffer/Home.jsx b/frontend/src/pages/HomeOffer/Home.jsx index b56f8eb..34a2e7b 100644 --- a/frontend/src/pages/HomeOffer/Home.jsx +++ b/frontend/src/pages/HomeOffer/Home.jsx @@ -80,12 +80,9 @@ function Home() { /> )) ) : ( - <> +
- - - - +
)} From 52d1a541b116131d60777eb49db019afb2e841d7 Mon Sep 17 00:00:00 2001 From: cassiopeelaurie Date: Wed, 7 Feb 2024 09:34:59 +0100 Subject: [PATCH 4/5] redirect login for offer --- .../src/components/CardModel/CardOffer.jsx | 33 +++---------------- frontend/src/pages/HomeOffer/Home.jsx | 30 +---------------- 2 files changed, 5 insertions(+), 58 deletions(-) diff --git a/frontend/src/components/CardModel/CardOffer.jsx b/frontend/src/components/CardModel/CardOffer.jsx index c890a79..727d75e 100644 --- a/frontend/src/components/CardModel/CardOffer.jsx +++ b/frontend/src/components/CardModel/CardOffer.jsx @@ -1,10 +1,13 @@ import PropTypes from "prop-types"; import { useEffect, useState } from "react"; +import { useNavigate } from "react-router-dom"; import ButtonMini from "../Boutons/ButtonMini"; import "./card-model.css"; import { useGlobalContext } from "../../contexts/GlobalContext"; function CardOffer() { + const navigate = useNavigate(); + const handleClickPostuler = () => navigate("/login"); const trimText = (chaine, limite) => { if (chaine.length <= limite) { return chaine; @@ -37,41 +40,13 @@ function CardOffer() {

{offer.company}

{trimText(offer.mission, 250)}

- + ))} ); } -// return ( -//
-// {offers.map((offer) => ( -//
-// {" "} -// {/* Ajoutez une clé unique pour chaque élément de la liste */} -//

{offer.title}

{" "} -// {/* Utilisez la propriété 'title' pour afficher le titre de l'offre */} -//
-// {/* Affichez les compétences de l'offre si nécessaire */} -// {offer.competences.map((competence) => ( -//

{competence.name}

-// ))} -//
-//
-// {offer.type} - {offer.city} -//
-//

{offer.company}

{" "} -// {/* Utilisez la propriété 'company' pour afficher le nom de l'entreprise */} -//

{offer.description}

{" "} -// {/* Utilisez la propriété 'description' pour afficher la description de l'offre */} -// -//
-// ))} -//
-// ); -// } - CardOffer.propTypes = { offer: PropTypes.shape({ id: PropTypes.number.isRequired, diff --git a/frontend/src/pages/HomeOffer/Home.jsx b/frontend/src/pages/HomeOffer/Home.jsx index 34a2e7b..4e5bd31 100644 --- a/frontend/src/pages/HomeOffer/Home.jsx +++ b/frontend/src/pages/HomeOffer/Home.jsx @@ -4,6 +4,7 @@ import { useGlobalContext } from "../../contexts/GlobalContext"; import "./Home.css"; import CardOffre from "../../components/CardModel/CardOffre"; import { useUserContext } from "../../contexts/UserContext"; + import HomeCard from "../../components/HomeCard/HomeCard"; import CardOffer from "../../components/CardModel/CardOffer"; @@ -13,22 +14,6 @@ function Home() { const [matchingOffers, setMatchingOffers] = useState([]); useEffect(() => { - // const getOffer = async () => { - // try { - // const response = await fetch( - // `${import.meta.env.VITE_BACKEND_URL}/api/offer` - // ); - // if (response.ok) { - // const data = await response.json(); - // setOffers(data); - // } else { - // console.error("Echec de la récupération des données."); - // } - // } catch (err) { - // console.error(err); - // } - // }; - const getOfferMatch = async () => { try { const response = await apiService.get( @@ -41,19 +26,6 @@ function Home() { }; getOfferMatch(); - // getOffer(); - - // const getOffer = async () => { - // try { - // const response = await axios.get(`${import.meta.env.VITE_BACKEND_URL}/api/offer`); - // console.log(response.data); - // setOffers(response.data); - // } catch (err) { - // console.error(err); - // }; - // } - - // getOffer(); }, []); return ( From a2408fe48b8cf94848a48bef9a700fc056073507 Mon Sep 17 00:00:00 2001 From: cassiopeelaurie Date: Wed, 7 Feb 2024 09:48:18 +0100 Subject: [PATCH 5/5] flex offer home --- frontend/src/components/CardModel/CardOffer.jsx | 4 ++-- frontend/src/pages/HomeOffer/Home.css | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/CardModel/CardOffer.jsx b/frontend/src/components/CardModel/CardOffer.jsx index 727d75e..20b44d8 100644 --- a/frontend/src/components/CardModel/CardOffer.jsx +++ b/frontend/src/components/CardModel/CardOffer.jsx @@ -31,7 +31,7 @@ function CardOffer() { }, []); return ( -
+ <> {offers.map((offer) => (

{offer.title}

@@ -43,7 +43,7 @@ function CardOffer() {
))} -
+ ); } diff --git a/frontend/src/pages/HomeOffer/Home.css b/frontend/src/pages/HomeOffer/Home.css index 60b91ab..e56d693 100644 --- a/frontend/src/pages/HomeOffer/Home.css +++ b/frontend/src/pages/HomeOffer/Home.css @@ -22,3 +22,7 @@ font-style: italic; } } +.offer-container-offer { + display: flex; + flex-wrap: wrap; +}