Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEP #259

Merged
merged 11 commits into from
Dec 2, 2024
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
})();
</script>
<script type="module" src="/src/index.js"></script>
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
</body>
</html>
101 changes: 43 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-testing-library": "^6.2.2",
"eslint-plugin-vitest": "^0.4.1",
"jsdom": "^24.1.0",
"jsdom": "^25.0.1",
"vitest": "^2.0.0",
"vitest-dom": "^0.1.1"
},
Expand Down
6 changes: 3 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ function App() {
<Router>
<Routes>
<Route path="/accueil" element={<GestionHash />}/>
<Route path="/nouveau-formulaire-conseiller" element={<PageCandidatureConseiller />}/>
<Route path="/nouveau-formulaire-structure" element={<PageCandidatureStructure />}/>
<Route path="/nouveau-formulaire-coordinateur" element={<PageCandidatureCoordinateur />}/>
<Route path="/candidature-conseiller" element={<PageCandidatureConseiller />}/>
<Route path="/candidature-poste-conseiller" element={<PageCandidatureStructure />}/>
<Route path="/candidature-poste-coordinateur" element={<PageCandidatureCoordinateur />}/>
<Route path="/candidature-validee-conseiller" element={<PageCandidatureValideeConseiller />}/>
<Route path="/candidature-validee-structure" element={<PageCandidatureValideeStructure />}/>
<Route path="/candidature-confirmer-conseiller/:token" element={<PageConfirmationEmailCandidatureConseiller />}/>
Expand Down
18 changes: 15 additions & 3 deletions src/components/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ function Menu() {
aria-expanded={activeMenu === 'cnfs'}
aria-controls="menu-cnfs"
onClick={onClickMenu}
{...(location.pathname.startsWith('/aide-candidat') || location.pathname.startsWith('/aide-structure') ? { 'aria-current': true } : {})}>
Recrutement
{
...(location.pathname.startsWith('/aide-candidat') ||
location.pathname.startsWith('/aide-structure') ||
location.pathname.startsWith('/candidature-poste-coordinateur') ? { 'aria-current': true } : {})
}>
Candidature
</button>
<div className={`fr-collapse fr-menu ${activeMenu === 'cnfs' ? 'fr-collapse--expanded' : ''}`} id="menu-cnfs">
<ul className="fr-menu__list">
Expand All @@ -115,7 +119,15 @@ function Menu() {
to="/aide-structure"
className="fr-nav__link"
{...(location.pathname.startsWith('/aide-structure') ? { 'aria-current': 'page' } : {})}>
Recruter un conseiller num&eacute;rique
Obtenir un poste de conseiller num&eacute;rique
</Link>
</li>
<li>
<Link
to="/candidature-poste-coordinateur"
className="fr-nav__link"
{...(location.pathname.startsWith('/candidature-poste-coordinateur') ? { 'aria-current': 'page' } : {})}>
Obtenir un poste de coordinateur de conseiller num&eacute;rique
</Link>
</li>
</ul>
Expand Down
7 changes: 4 additions & 3 deletions src/components/commun/BoutonRadio.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';

export default function BoutonRadio({ children, id, nomGroupe }) {
export default function BoutonRadio({ children, id, nomGroupe, onChange, checked }) {
return (
<div className="fr-fieldset__element">
<div className="fr-radio-group">
<input type="radio" id={id} name={nomGroupe} value={id} required />
<input type="radio" id={id} name={nomGroupe} value={id} required onChange={onChange} checked={checked} />
<label className="fr-label" htmlFor={id}>
{children}
</label>
Expand All @@ -18,5 +18,6 @@ BoutonRadio.propTypes = {
children: PropTypes.node,
id: PropTypes.string,
nomGroupe: PropTypes.string,
value: PropTypes.string,
onChange: PropTypes.func,
checked: PropTypes.bool,
};
15 changes: 11 additions & 4 deletions src/components/commun/Captcha.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
import React, { useEffect, useRef } from 'react';
import PropTypes from 'prop-types';

const SITE_KEY = '84e24b30-44ca-488c-9260-ec80c290c166';
const SITE_KEY = '0x4AAAAAAA0pjEgohPDZsyqu';

export default function Captcha() {
export default function Captcha({ setWidgetId }) {
const captchaRef = useRef(null);

useEffect(() => {
if (window.hcaptcha) {
window.hcaptcha.render(captchaRef.current, {
if (window.turnstile) {
window.turnstile.remove();
const widgetId = window.turnstile.render(captchaRef.current, {
sitekey: SITE_KEY,
});
setWidgetId(widgetId);
}
}, []);

return (
<div ref={captchaRef}></div>
);
}

Captcha.propTypes = {
setWidgetId: PropTypes.func,
};
10 changes: 8 additions & 2 deletions src/components/commun/Datepicker.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import React from 'react';
import PropTypes from 'prop-types';

export default function Datepicker({ children, id, isRequired = true, onChange, min }) {
export default function Datepicker({ children, id, isRequired = true, onChange, min, error }) {
return (
<div className="fr-input-group">
<div className={`fr-input-group${error ? ' fr-input-group--error' : ''}`}>
<label className="fr-label" htmlFor={id}>
{children}
</label>
<input className="fr-input cc-datepicker" id={id} type="date" required={isRequired} onChange={onChange} min={min} name={id} />
{error && (
<p id="text-input-error-desc-error" className="fr-error-text">
{error}
</p>
)}
</div>
);
}
Expand All @@ -19,4 +24,5 @@ Datepicker.propTypes = {
onChange: PropTypes.func,
min: PropTypes.string,
name: PropTypes.string,
error: PropTypes.string
};
Loading
Loading