Skip to content

Commit

Permalink
Retours supplémentaires de code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Alezco committed Sep 5, 2024
1 parent 8f2119f commit 49aff14
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 19 deletions.
6 changes: 5 additions & 1 deletion src/views/candidature-conseiller/CandidatureConseiller.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import SommaireConseiller from './SommaireConseiller';
import InformationsDeContact from './InformationsDeContact';
import SituationEtExperience from './SituationEtExperience';
Expand Down Expand Up @@ -28,6 +28,10 @@ export default function CandidatureConseiller() {
const navigate = useNavigate();
useScrollToSection();

useEffect(() => {
document.title = 'Conseiller numérique - Devenir conseiller numérique';
}, []);

const estSituationRemplie = formData => {
const demandeurEmploi = formData.get('estDemandeurEmploi');
const enEmploi = formData.get('estEnEmploi');
Expand Down
8 changes: 5 additions & 3 deletions src/views/candidature-conseiller/useGeoApi.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { useState } from 'react';

export const useGeoApi = () => {
const urlBase = 'https://geo.api.gouv.fr/communes?limit=10&fields=nom,code,codesPostaux,centre,codeDepartement,codeRegion,codeCom&';
const baseUrl = new URL('https://geo.api.gouv.fr/communes');
baseUrl.searchParams.set('limit', '10');
baseUrl.searchParams.set('fields', 'nom,code,codesPostaux,centre,codeDepartement,codeRegion,codeCom');

const [villes, setVilles] = useState([]);

const searchByName = async rechercheUtilisateur => {
const url = `${urlBase}&nom=${rechercheUtilisateur}`;
const url = `${baseUrl.toString()}&nom=${rechercheUtilisateur}`;
const villes = await fetch(url);
const resultat = await villes.json();
setVilles(resultat);
};

const getVilleParCode = async codePostal => {
const url = `${urlBase}&code=${codePostal}`;
const url = `${baseUrl.toString()}&code=${codePostal}`;
const ville = await fetch(url);
return await ville.json();
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import SommaireCoordinateur from './SommaireCoordinateur';
import InformationsDeContact from '../candidature-structure/InformationsDeContact';
import InformationsDeStructure from '../candidature-structure/InformationsDeStructure';
Expand All @@ -19,6 +19,10 @@ import '../candidature-conseiller/CandidatureConseiller.css';
export default function CandidatureCoordinateur() {
useScrollToSection();

useEffect(() => {
document.title = 'Conseiller numérique - Devenir coordinateur de conseillers numériques';
}, []);

return (
<div className="fr-container fr-mt-5w fr-mb-5w">
<div className="fr-grid-row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import React from 'react';
import BoutonRadio from '../../components/commun/BoutonRadio';
import Datepicker from '../../components/commun/Datepicker';
import Input from '../../components/commun/Input';
import PropTypes from 'prop-types';

export default function BesoinEnConseillerNumerique({ setDateAccueilConseillerNumerique }) {
export default function BesoinEnConseillerNumerique() {
return (
<fieldset className="fr-border cc-section fr-p-3w fr-mb-3w" id="votre-besoin-en-conseiller-numerique">
<legend className="fr-h5">Votre besoin en conseiller(s) numérique(s)</legend>
Expand All @@ -24,13 +23,9 @@ export default function BesoinEnConseillerNumerique({ setDateAccueilConseillerNu
</BoutonRadio>
<hr />
<p className="fr-mb-3w cc-bold">À partir de quand êtes vous prêt à accueillir votre conseiller numerique ?<span className="cc-obligatoire">*</span></p>
<Datepicker id="choisir-date" onChange={event => setDateAccueilConseillerNumerique(event.target.value)}>
<Datepicker id="choisir-date">
Choisir une date
</Datepicker>
</fieldset >
);
}

BesoinEnConseillerNumerique.propTypes = {
setDateAccueilConseillerNumerique: PropTypes.func,
};
8 changes: 5 additions & 3 deletions src/views/candidature-structure/CandidatureStructure.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useEffect } from 'react';
import SommaireStructure from './SommaireStructure';
import InformationsDeContact from './InformationsDeContact';
import InformationsDeStructure from './InformationsDeStructure';
Expand All @@ -17,7 +17,9 @@ import '@gouvfr/dsfr/dist/component/sidemenu/sidemenu.min.css';
import '../candidature-conseiller/CandidatureConseiller.css';

export default function CandidatureStructure() {
const [dateAccueilConseillerNumerique, setDateAccueilConseillerNumerique] = useState();
useEffect(() => {
document.title = 'Conseiller numérique - Engager un conseiller numérique';
}, []);

useScrollToSection();

Expand All @@ -33,7 +35,7 @@ export default function CandidatureStructure() {
<form aria-label="Candidature structure" >
<InformationsDeStructure />
<InformationsDeContact />
<BesoinEnConseillerNumerique setDateAccueilConseillerNumerique={setDateAccueilConseillerNumerique} />
<BesoinEnConseillerNumerique />
<Motivation />
<Engagement />
<button className="fr-btn cc-envoyer" type="submit">
Expand Down
5 changes: 1 addition & 4 deletions src/views/candidature-validee/CandidatureValidee.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
.cv-contenu {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
}

.cv-titre {
Expand Down
1 change: 1 addition & 0 deletions src/views/candidature-validee/CandidatureValidee.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import './CandidatureValidee.css';
export default function CandidatureValidee() {
useEffect(() => {
window.scrollTo({ top: 0, behavior: 'smooth' });
document.title = 'Conseiller numérique - Candidature validée';
}, []);

return (
Expand Down

0 comments on commit 49aff14

Please sign in to comment.