From 8d481f49b94ea00bff51aa5c38a5bdf22280242a Mon Sep 17 00:00:00 2001 From: Benjamin Arias Date: Mon, 9 Jan 2023 15:31:00 +0100 Subject: [PATCH] Corrige l'affichage du bouton custom pour simulateur salaire (#2444) * fix: Affichage du bouton custom pour simulateur salaire + position top iframe * feat: Ajoute version RGAA compatible logo --- site/source/components/Feedback/index.tsx | 20 ++++--- site/source/components/JeDonneMonAvis.tsx | 9 +++- .../donner-votre-avis-services-publics.svg | 54 +++++++++++++++++++ 3 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 site/source/images/donner-votre-avis-services-publics.svg diff --git a/site/source/components/Feedback/index.tsx b/site/source/components/Feedback/index.tsx index 01f10d984..37c38de97 100644 --- a/site/source/components/Feedback/index.tsx +++ b/site/source/components/Feedback/index.tsx @@ -14,7 +14,7 @@ import { H4 } from '@/design-system/typography/heading' import { StyledLink } from '@/design-system/typography/link' import { Body } from '@/design-system/typography/paragraphs' import { useOnClickOutside } from '@/hooks/useClickOutside' -import { CurrentSimulatorDataContext } from '@/pages/Simulateurs/metadata' +import { useSitePaths } from '@/sitePaths' import * as safeLocalStorage from '../../storage/safeLocalStorage' import { JeDonneMonAvis } from '../JeDonneMonAvis' @@ -44,6 +44,8 @@ const getShouldAskFeedback = (url: string) => { ) } +const IFRAME_SIMULATEUR_EMBAUCHE_PATH = '/iframes/simulateur-embauche' + const FeedbackButton = ({ isEmbedded }: { isEmbedded?: boolean }) => { const [isFormOpen, setIsFormOpen] = useState(false) const [isShowingThankMessage, setIsShowingThankMessage] = useState(false) @@ -53,7 +55,12 @@ const FeedbackButton = ({ isEmbedded }: { isEmbedded?: boolean }) => { const url = useLocation().pathname const tag = useContext(TrackingContext) const containerRef = useRef(null) - const currentSimulatorData = useContext(CurrentSimulatorDataContext) + + const { absoluteSitePaths } = useSitePaths() + const currentPath = useLocation().pathname + const isSimulateurSalaire = + currentPath.includes(absoluteSitePaths.simulateurs.salariƩ) || + currentPath.includes(IFRAME_SIMULATEUR_EMBAUCHE_PATH) const { shouldShowRater, customTitle } = useFeedback() @@ -146,8 +153,8 @@ const FeedbackButton = ({ isEmbedded }: { isEmbedded?: boolean }) => { )} - {currentSimulatorData?.pathId === 'simulateurs.salariƩ' ? ( - + {isSimulateurSalaire ? ( + ) : (