Réecris la logique d'affichage entre retour simulateur et retour contenu
parent
3ace9da67d
commit
8d1fbf797c
|
@ -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 (
|
||||
<div
|
||||
|
|
|
@ -6,25 +6,37 @@ import React, { useContext } from 'react'
|
|||
import emoji from 'react-easy-emoji'
|
||||
import { Helmet } from 'react-helmet'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
import SocialIcon from 'Components/ui/SocialIcon'
|
||||
import i18n, { AvailableLangs } from '../../../../i18n'
|
||||
import { hrefLangLink } from '../../sitePaths'
|
||||
import './Footer.css'
|
||||
import Privacy from './Privacy'
|
||||
import useSimulatorsData from 'sites/mon-entreprise.fr/pages/Simulateurs/metadata'
|
||||
|
||||
const feedbackBlacklist = [
|
||||
['index'],
|
||||
['entreprise', 'statutJuridique', 'index'],
|
||||
['simulateurs', 'indépendant'],
|
||||
['simulateurs', 'auto-entrepreneur'],
|
||||
['simulateurs', 'sasu'],
|
||||
['simulateurs', 'salarié'],
|
||||
['coronavirus', 'chômagePartiel']
|
||||
].map(lensPath)
|
||||
|
||||
const useShowFeedback = () => {
|
||||
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 = () => {
|
|||
))}
|
||||
</Helmet>
|
||||
<footer className="footer">
|
||||
<PageFeedback
|
||||
blacklist={feedbackBlacklist.map(lens => view(lens, sitePaths))}
|
||||
/>
|
||||
|
||||
{showFeedback && <PageFeedback />}
|
||||
{i18n.language === 'en' && (
|
||||
<p className="ui__ notice" css="text-align: center">
|
||||
This website is provided by the{' '}
|
||||
|
|
Loading…
Reference in New Issue