From 8d1fbf797cae7f6431840c832a22411b54931ad6 Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Wed, 14 Oct 2020 15:46:17 +0200 Subject: [PATCH] =?UTF-8?q?R=C3=A9ecris=20la=20logique=20d'affichage=20ent?= =?UTF-8?q?re=20retour=20simulateur=20et=20retour=20contenu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Feedback/PageFeedback.tsx | 8 +--- .../layout/Footer/Footer.tsx | 39 ++++++++++++------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/mon-entreprise/source/components/Feedback/PageFeedback.tsx b/mon-entreprise/source/components/Feedback/PageFeedback.tsx index 61689d98b..c98cc692d 100644 --- a/mon-entreprise/source/components/Feedback/PageFeedback.tsx +++ b/mon-entreprise/source/components/Feedback/PageFeedback.tsx @@ -13,7 +13,7 @@ type PageFeedbackProps = { } const localStorageKey = (feedback: [string, string]) => - `app::feedback::${feedback.join('::')}` + `app::feedback::v2::${feedback.join('::')}` const saveFeedbackOccurrenceInLocalStorage = ([name, path, rating]: [ string, string, @@ -29,7 +29,6 @@ const feedbackAlreadyGiven = (feedback: [string, string]) => { } export default function PageFeedback({ - blacklist = [], customMessage, customEventName }: PageFeedbackProps) { @@ -73,11 +72,6 @@ export default function PageFeedback({ if (state.feedbackAlreadyGiven && !state.showForm && !state.showThanks) { return null } - const pathname = location.pathname === '/' ? '' : location.pathname - - if (blacklist.includes(pathname)) { - return null - } return (
{ + const currentPath = useLocation().pathname + const sitePath = useContext(SitePathsContext) + const simulators = useSimulatorsData() + if ( + [ + simulators['aide-déclaration-indépendant'], + simulators['comparaison-statuts'], + simulators['demande-mobilité'] + ] + .map(s => s.path) + .includes(currentPath) + ) { + return true + } + return ![ + sitePath.index, + ...Object.values(simulators).map(s => s.path) + ].includes(currentPath) +} const Footer = () => { const sitePaths = useContext(SitePathsContext) + const showFeedback = useShowFeedback() const hrefLink = hrefLangLink[i18n.language as AvailableLangs][ decodeURIComponent( @@ -46,10 +58,7 @@ const Footer = () => { ))}