From ea4cd1b4613169230fb64a21c5aa1887114a3107 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Thu, 22 Apr 2021 10:59:10 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=8D=20Favorise=20la=20d=C3=A9couverte?= =?UTF-8?q?=20des=20simulateurs=20connexes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mon-entreprise/source/locales/ui-en.yaml | 3 ++ .../source/pages/Simulateurs/Page.tsx | 52 ++++++++++++------- .../source/pages/Simulateurs/metadata.tsx | 12 ++++- 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/mon-entreprise/source/locales/ui-en.yaml b/mon-entreprise/source/locales/ui-en.yaml index 68e6c8ad7..05eef43f8 100644 --- a/mon-entreprise/source/locales/ui-en.yaml +++ b/mon-entreprise/source/locales/ui-en.yaml @@ -1094,6 +1094,9 @@ pages: avocat: shortname: Lawyer title: Income simulator for private lawyers + cartes: + intégrer module web: <0>Integrate the web module<1>Add this simulator to + your website in one click chirurgien-dentiste: shortname: Dental surgeon title: Income simulator for a private dental surgeon diff --git a/mon-entreprise/source/pages/Simulateurs/Page.tsx b/mon-entreprise/source/pages/Simulateurs/Page.tsx index 656e51322..99cc9f7e2 100644 --- a/mon-entreprise/source/pages/Simulateurs/Page.tsx +++ b/mon-entreprise/source/pages/Simulateurs/Page.tsx @@ -7,10 +7,11 @@ import useSearchParamsSimulationSharing from 'Components/utils/useSearchParamsSi import useSimulationConfig from 'Components/utils/useSimulationConfig' import { default as React, useContext } from 'react' import emoji from 'react-easy-emoji' -import { useTranslation } from 'react-i18next' +import { Trans, useTranslation } from 'react-i18next' import { Link, useLocation } from 'react-router-dom' import { TrackChapter } from '../../ATInternetTracking' -import { SimulatorData } from './metadata' +import { SimulateurCard } from './Home' +import useSimulatorsData, { SimulatorData, SimulatorId } from './metadata' export default function PageData({ meta, @@ -22,6 +23,7 @@ export default function PageData({ iframe, component: Component, seoExplanations, + nextSteps, path, }: SimulatorData[keyof SimulatorData]) { const inIframe = useContext(IsEmbeddedContext) @@ -84,7 +86,7 @@ export default function PageData({ {!inIframe && ( <> {seoExplanations} - + )} @@ -92,29 +94,41 @@ export default function PageData({ ) } -function NextSteps({ iframe }: { iframe: string }) { +type NextStepsProps = { + iframe?: string + nextSteps?: Array +} + +function NextSteps({ iframe, nextSteps }: NextStepsProps) { const sitePaths = useContext(SitePathsContext) - if (!iframe) { + const simulators = useSimulatorsData() + if (!iframe && !nextSteps) { return null } return (

Aller plus loin

- -
{emoji('📱')}
-

Intégrer le module web

-

- Ajouter ce simulateur sur votre site internet en un clic -

-
Découvrir
- + {nextSteps?.map((simulatorId) => ( + + ))} + {iframe && ( + +
{emoji('📱')}
+ +

Intégrer le module web

+

+ Ajouter ce simulateur sur votre site internet en un clic +

+
+ + )}
) diff --git a/mon-entreprise/source/pages/Simulateurs/metadata.tsx b/mon-entreprise/source/pages/Simulateurs/metadata.tsx index 3212b9af6..af14628e3 100644 --- a/mon-entreprise/source/pages/Simulateurs/metadata.tsx +++ b/mon-entreprise/source/pages/Simulateurs/metadata.tsx @@ -61,8 +61,10 @@ const simulateurs = [ 'aides-embauche', ] as const +export type SimulatorId = typeof simulateurs[number] + export type SimulatorData = Record< - typeof simulateurs[number], + SimulatorId, { meta?: { title: string @@ -88,6 +90,7 @@ export type SimulatorData = Record< description?: React.ReactNode config?: SimulationConfig seoExplanations?: React.ReactNode + nextSteps?: Array private?: true component: () => JSX.Element } @@ -199,6 +202,7 @@ export function getSimulatorsData({

), + nextSteps: ['chômage-partiel', 'aides-embauche'], }, 'auto-entrepreneur': { tracking: 'auto_entrepreneur', @@ -305,6 +309,7 @@ export function getSimulatorsData({ ), + nextSteps: ['indépendant', 'comparaison-statuts'], }, indépendant: { config: indépendantConfig, @@ -328,6 +333,7 @@ export function getSimulatorsData({ ), }, component: IndépendantSimulation, + nextSteps: ['is', 'comparaison-statuts'], }, sasu: { config: sasuConfig, @@ -408,6 +414,7 @@ export function getSimulatorsData({

), + nextSteps: ['is', 'comparaison-statuts'], }, 'artiste-auteur': { icône: '👩‍🎨', @@ -543,6 +550,7 @@ export function getSimulatorsData({

), + nextSteps: ['salarié', 'aides-embauche'], }, 'comparaison-statuts': { component: SchemeComparaisonPage, @@ -850,6 +858,7 @@ export function getSimulatorsData({ ), component: AidesEmbauche, + nextSteps: ['salarié'], }, is: { icône: '🗓', @@ -903,6 +912,7 @@ export function getSimulatorsData({

), + nextSteps: ['salarié', 'comparaison-statuts'], }, } }