Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #652 from anct-cnum/fixLinkReact
Browse files Browse the repository at this point in the history
Fix : correctif syntaxe Link
  • Loading branch information
Ornella452 authored May 28, 2024
2 parents 4cc6897 + 307c10b commit a4035fe
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 29 deletions.
6 changes: 1 addition & 5 deletions src/components/admin/Territoire.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ function Territoire({ territoire, currentPage, trClass }) {
<td data-tooltip-id="infobulle-menu"
data-tooltip-html="Taux d&rsquo;activation">{territoire?.tauxActivation ?? 0} %</td>
<td>
<Link className="fr-btn details-btn" style={{ boxShadow: 'none' }} to={{
pathname: `/statistiques`,
territoire: territoire,
currentPage: currentPage,
origin: '/territoires' }}>
<Link className="fr-btn details-btn" style={{ boxShadow: 'none' }} state={{ territoire, currentPage }} to="/statistiques">
D&eacute;tails
</Link>
<Tooltip className="infobulle" id="infobulle-menu" arrowColor="white"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,11 @@ function FormulaireInfosProfessionnelles() {
<img src="/logos/home-connected/icone-courriel.svg" />
<div className="infos-user fr-mb-md-6w">
<span>{user.name}</span>
<Link to={{
pathname: '/mot-de-passe-oublie',
state: {
<Link
to="/mot-de-passe-oublie"
state={{
fromModifPassword: true,
},
}} className="modif-password">
}} className="modif-password">
Modification de mon mot de passe <span className="fr-fi-external-link-line fr-link--icon"></span>
</Link>
</div>
Expand Down
11 changes: 6 additions & 5 deletions src/components/connected/permanence/MaPermanence.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ function MaPermanence({ permanence, conseillerId, trClass }) {
</ul>
</td>
<td style={{ textAlign: 'center' }}>
<Link className="fr-btn modifier-btn" style={{ boxShadow: 'none' }} to={{
pathname: `/mon-lieu-activite/${permanence?._id}`,
islieuPrincipal: islieuPrincipal,
idPermanence: permanence?._id
}}>
<Link className="fr-btn modifier-btn" style={{ boxShadow: 'none' }}
to={`/mon-lieu-activite/${permanence?._id}`}
state={{
islieuPrincipal: islieuPrincipal,
idPermanence: permanence?._id
}}>
Modifier
</Link>
<SupprimerPermanence permanence={permanence} isDisabled={islieuPrincipal} count={count?.find(cra => cra.id === permanence?._id)?.count}/>
Expand Down
8 changes: 4 additions & 4 deletions src/components/connected/statistics/Statistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ function Statistics() {
const user = useSelector(state => state?.authentication?.user?.user);
const nomStructure = useSelector(state => state?.structure?.structure?.nom);

const territoire = location?.territoire;
const nomComplet = location?.nomComplet;
const territoire = location.state?.territoire;
const nomComplet = location.state?.nomComplet;
const typeTerritoire = territoire ? useSelector(state => state.filtersAndSorts?.territoire) : '';
let nomTerritoire = null;
if (typeTerritoire) {
nomTerritoire = typeTerritoire === 'codeDepartement' ? territoire.nomDepartement : territoire.nomRegion;
}

useEffect(() => {
if (location?.idUser) {
dispatch(statistiqueActions.getStatsCra(dateDebutStats, dateFinStats, location?.idUser));
if (location.state?.idUser) {
dispatch(statistiqueActions.getStatsCra(dateDebutStats, dateFinStats, location.state?.idUser));
} else if (territoire) {
dispatch(statistiqueActions.getStatsCraTerritoire(dateDebutStats, dateFinStats, typeTerritoire, territoire.conseillerIds));
} else {
Expand Down
21 changes: 11 additions & 10 deletions src/components/connected/statistics/StatisticsBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function StatisticsBanner({ dateDebut, dateFin, idTerritoire, typeStats, codePos
const downloadError = useSelector(state => state.conseiller?.downloadError);
const user = useSelector(state => state.authentication?.user?.user);
const blob = useSelector(state => state.conseiller?.blob);
const territoire = location?.territoire;
const territoire = location.state?.territoire;
let typeTerritoire = territoire ? useSelector(state => state.filtersAndSorts?.territoire) : null;
const isFirefoxForAndroid = isNavigatorFirefoxForAndroid();

Expand Down Expand Up @@ -65,7 +65,7 @@ function StatisticsBanner({ dateDebut, dateFin, idTerritoire, typeStats, codePos
} else {
const conseillerIds = territoire?.conseillerIds ?? undefined;
// eslint-disable-next-line max-len
dispatch(conseillerActions.getStatistiquesAdminCoopCSV(dateDebut, dateFin, type, type !== 'user' ? idTerritoire : location?.idUser, conseillerIds, codePostal));
dispatch(conseillerActions.getStatistiquesAdminCoopCSV(dateDebut, dateFin, type, type !== 'user' ? idTerritoire : location.state?.idUser, conseillerIds, codePostal));
}
}

Expand All @@ -77,7 +77,7 @@ function StatisticsBanner({ dateDebut, dateFin, idTerritoire, typeStats, codePos
} else {
const conseillerIds = territoire?.conseillerIds ?? undefined;
// eslint-disable-next-line max-len
dispatch(conseillerActions.getStatistiquesAdminCoopExcel(dateDebut, dateFin, type, type !== 'user' ? idTerritoire : location?.idUser, conseillerIds, codePostal));
dispatch(conseillerActions.getStatistiquesAdminCoopExcel(dateDebut, dateFin, type, type !== 'user' ? idTerritoire : location.state?.idUser, conseillerIds, codePostal));
}
}

Expand All @@ -87,14 +87,15 @@ function StatisticsBanner({ dateDebut, dateFin, idTerritoire, typeStats, codePos
}
}, [blob, downloadError]);

let linkTo = { currentPage: location?.currentPage, origin: '/statistiques' };
let linkTo = {};
let linkState = { currentPage: location.state?.currentPage };
if (typeTerritoire) {
linkTo.pathname = `/territoires`;
linkTo.conseillerIds = location?.conseillerIds;
linkTo.nomTerritoire = location?.nomDepartement;
} else if (location?.idUser) {
linkState.conseillerIds = location.state?.conseillerIds;
linkState.nomTerritoire = location.state?.nomDepartement;
} else if (location.state?.idUser) {
linkTo.pathname = `/conseiller/${location?.idUser}`;
linkTo.currentPage = location?.currentPage;
linkState.currentPage = location.state?.currentPage;
}

return (
Expand All @@ -117,13 +118,13 @@ function StatisticsBanner({ dateDebut, dateFin, idTerritoire, typeStats, codePos
</div>
</div>
}
{ (typeTerritoire || location?.idUser) &&
{ (typeTerritoire || location.state?.idUser) &&
<div className="fr-grid-row fr-grid-row--center">
<div className="fr-col-xs-6 fr-col-sm-6 fr-col-md-7 fr-col-lg-8 afficher-etapes">
<ul className="fr-footer__bottom-list liste-action">
<li className="fr-footer__bottom-item">
<Link className="fr-footer__bottom-link fr-pr-sm-1w" style={{ boxShadow: 'none', color: '#8585F6', fontSize: '16px' }}
to={linkTo}>
to={linkTo} state={linkState}>
<img className="image-banniere" src="/logos/statistics/logo-fleche-gauche.svg" alt="Revenir &agrave;
l’&eacute;tape pr&eacute;c&eacute;dente"
style={{ verticalAlign: 'super' }} />
Expand Down

0 comments on commit a4035fe

Please sign in to comment.