From 5cc443ac12f599944c8b0dcd4bbed9abcbc25cc2 Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Wed, 23 Jan 2019 18:04:22 +0100 Subject: [PATCH] =?UTF-8?q?:bug:=20r=C3=A9pare=20le=20site=20embauche.beta?= =?UTF-8?q?.gouv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- netlify.toml | 31 +++++++++++ source/components/AnswerList.js | 7 ++- .../CurrencyInput/CurrencyInput.css | 1 + source/components/PeriodSwitch.js | 41 +++++++++++---- source/components/RulePage.css | 7 +-- source/components/RulePage.js | 28 +++------- .../components/SalaryCompactExplanation.css | 2 +- source/components/SalaryCompactExplanation.js | 2 +- source/components/SalaryFirstExplanation.js | 9 +--- source/components/SearchButton.js | 18 +++---- source/components/TargetSelection.css | 49 +++++++++--------- source/components/TargetSelection.js | 23 +++++---- source/components/rule/Namespace.css | 1 - source/components/rule/Rule.css | 4 +- source/components/rule/Rule.js | 51 +++++++++++++------ source/components/rule/RuleValueVignette.css | 1 - .../simulationConfigs/assimilé.yaml | 5 +- .../simulationConfigs/indépendant.yaml | 5 +- .../simulationConfigs/micro-entreprise.yaml | 5 +- .../rémunération-dirigeant.yaml | 3 ++ .../components/simulationConfigs/salarié.yaml | 3 +- .../simulationConfigs/withSimulationConfig.js | 4 +- source/components/ui/AnimatedTargetValue.css | 1 - source/components/ui/Button/button.css | 6 +++ source/components/ui/Montant.js | 2 +- source/components/ui/animate.js | 29 +++++++++++ source/components/ui/index.css | 6 ++- source/règles/base.yaml | 1 + source/selectors/analyseSelectors.js | 2 +- source/sites/embauche.gouv.fr/App.js | 47 ++++++++++------- source/sites/embauche.gouv.fr/sitePaths.js | 13 +++++ .../pages/SocialSecurity/Salarié.js | 12 +++-- .../sites/mycompanyinfrance.fr/sitePaths.js | 18 +------ source/utils.js | 16 ++++++ yarn.lock | 9 +--- 35 files changed, 290 insertions(+), 172 deletions(-) create mode 100644 source/sites/embauche.gouv.fr/sitePaths.js diff --git a/netlify.toml b/netlify.toml index 533835dc6..fca822ea2 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,3 +1,34 @@ +# 302 Redirect following URL changes (waiting the hostname change to mon-entreprise.fr for 301) +[[redirects]] +from = "https://embauche.beta.gouv.fr/règle/contrat-salarié--salaire--net-après-impôt" +to = "https://embauche.beta.gouv.fr/documentation/contrat-salarié/salaire/net-après-impôt" +status = 302 + +[[redirects]] +from = "https://embauche.beta.gouv.fr/règle/prime-de-fin-de-contrat" +to = "https://embauche.beta.gouv.fr/documentation/contrat-salarié/CDD/prime-de-fin-de-contrat" +status = 302 + +[[redirects]] +from = "https://embauche.beta.gouv.fr/règle/contrat-salarié--salaire--brut-de-base" +to = "https://embauche.beta.gouv.fr/documentation/contrat-salarié/salaire/brut-de-base" +status = 302 + +[[redirects]] +from = "https://embauche.beta.gouv.fr/règle/contrat-salarié--rémunération-total" +to = "https://embauche.beta.gouv.fr/documentation/contrat-salarié/rémunération/total" +status = 302 + +[[redirects]] +from = "https://embauche.beta.gouv.fr/règle/contribution-au-dialogue-social" +to = "https://embauche.beta.gouv.fr/documentation/contrat-salarié/contribution-au-dialogue-social" +status = 302 + +[[redirects]] +from = "https://embauche.beta.gouv.fr/règle/contrat-salarié--CDD--motif--complément-formation" +to = "https://embauche.beta.gouv.fr/documentation/contrat-salarié/CDD/motif/complément-formation" +status = 302 + # InFrance PRODUCTION settings [[redirects]] diff --git a/source/components/AnswerList.js b/source/components/AnswerList.js index 8ef160b4f..9d3d81330 100644 --- a/source/components/AnswerList.js +++ b/source/components/AnswerList.js @@ -48,7 +48,12 @@ const AnswerList = ({

{emoji('🗑')}{' '} -

diff --git a/source/components/CurrencyInput/CurrencyInput.css b/source/components/CurrencyInput/CurrencyInput.css index 471a82e59..9228c3fe7 100644 --- a/source/components/CurrencyInput/CurrencyInput.css +++ b/source/components/CurrencyInput/CurrencyInput.css @@ -10,6 +10,7 @@ border: none; text-align: inherit; font-family: inherit; + padding: 0; font-weight: inherit; min-width: 0; outline: none; diff --git a/source/components/PeriodSwitch.js b/source/components/PeriodSwitch.js index 86d6caf72..2dad991c3 100644 --- a/source/components/PeriodSwitch.js +++ b/source/components/PeriodSwitch.js @@ -1,6 +1,6 @@ import { findRuleByDottedName, nestedSituationToPathMap } from 'Engine/rules' import { compose, filter, map, toPairs } from 'ramda' -import React from 'react' +import React, { useEffect } from 'react' import emoji from 'react-easy-emoji' import { Trans, translate } from 'react-i18next' import { connect } from 'react-redux' @@ -8,27 +8,50 @@ import { batchActions } from 'redux-batched-actions' import { change, Field, reduxForm } from 'redux-form' import { flatRulesSelector, - situationSelector + situationSelector, + situationsWithDefaultsSelector } from 'Selectors/analyseSelectors' import './PeriodSwitch.css' export default compose( reduxForm({ form: 'conversation', - destroyOnUnmount: false, - initialValues: { période: 'année' } + destroyOnUnmount: false }), translate(), connect( - state => ({ - rules: flatRulesSelector(state), - situation: nestedSituationToPathMap(situationSelector(state)) - }), + state => { + let situation = situationsWithDefaultsSelector(state) + if (Array.isArray(situation)) { + situation = situation[0] + } + + return { + rules: flatRulesSelector(state), + situation: nestedSituationToPathMap(situationSelector(state)), + initialPériode: situation.période + } + }, dispatch => ({ batchPeriodChange: actions => dispatch(batchActions(actions)) }) ) -)(function PeriodSwitch({ situation, rules, batchPeriodChange }) { +)(function PeriodSwitch({ + situation, + rules, + batchPeriodChange, + initialPériode +}) { + useEffect(() => { + !situation.période && + updateSituation( + initialPériode || 'année', + batchPeriodChange, + situation, + rules + ) + return + }) return (
{this.state.resultView === 'payslip' ? ( diff --git a/source/components/SalaryFirstExplanation.js b/source/components/SalaryFirstExplanation.js index 5e66792d0..341dae82a 100644 --- a/source/components/SalaryFirstExplanation.js +++ b/source/components/SalaryFirstExplanation.js @@ -2,17 +2,10 @@ import Distribution from 'Components/Distribution' import PaySlip from 'Components/PaySlip' -import SearchButton from 'Components/SearchButton' -import withTracker from 'Components/utils/withTracker' -import { compose } from 'ramda' import React, { Component } from 'react' import { Trans } from 'react-i18next' -import { connect } from 'react-redux' -import ficheDePaieSelectors from 'Selectors/ficheDePaieSelectors' -import type { Tracker } from 'Components/utils/withTracker' - -export default class SalaryFirstExplanation extends Component { +export default class SalaryFirstExplanation extends Component { render() { return ( <> diff --git a/source/components/SearchButton.js b/source/components/SearchButton.js index 45112ee0f..38f16fa88 100644 --- a/source/components/SearchButton.js +++ b/source/components/SearchButton.js @@ -1,12 +1,11 @@ import { compose } from 'ramda' import React, { Component } from 'react' +import emoji from 'react-easy-emoji' import { Trans, withNamespaces } from 'react-i18next' import { connect } from 'react-redux' import { flatRulesSelector } from 'Selectors/analyseSelectors' -import { LinkButton } from 'Ui/Button' import Overlay from './Overlay' import SearchBar from './SearchBar' -import emoji from 'react-easy-emoji' export default compose( connect(state => ({ @@ -49,15 +48,12 @@ export default compose( /> ) : ( - this.setState({ visible: true })} - className={this.props.className} - style={this.props.style}> - {emoji('🔍 ')} - - Rechercher - - + ) } } diff --git a/source/components/TargetSelection.css b/source/components/TargetSelection.css index 15593720f..22b65b208 100644 --- a/source/components/TargetSelection.css +++ b/source/components/TargetSelection.css @@ -1,8 +1,3 @@ -#targetsContainer { - border-radius: 0.6em; - box-shadow: 0 1px 3px 0 #d4d4d5, 0 0 0 1px #d4d4d5; -} - #targetSelection h1 { margin: 0.6em; color: inherit; @@ -12,17 +7,22 @@ #targetSelection #targets { list-style: none; - padding: 0 0.5em; + padding: 0; + margin: 0; } #targetSelection #targets > li:last-child { - margin-bottom: 0; + margin-bottom: -1rem; border-bottom: none; } +#targetSelection #targets > li:first-child { + margin-top: -1rem; +} #targetSelection #targets > li { - padding: 0.6em; border-bottom: 1px solid rgba(255, 255, 255, 0.5); - margin: 0; + padding: 0.6rem 1rem; + margin-left: -1rem; + margin-right: -1rem; } #targetSelection #targets > li .main { display: flex; @@ -72,18 +72,16 @@ text-decoration: underline; } -@media (hover: none) { - - #targetSelection .optionTitle { - border: 1px solid rgba(255, 255, 255, 0.3); - border-radius: 0.25em; - padding: 0.05em .4em; - font-size: 125%; - font-weight: 400; - } +@media (hover: none) { + #targetSelection .optionTitle { + border: 1px solid rgba(255, 255, 255, 0.3); + border-radius: 0.25em; + padding: 0.05em 0.4em; + font-size: 125%; + font-weight: 400; + } } - #targetSelection #labelNew { background: #e2011c; /* Couleur de la marianne */ border-radius: 0.3em; @@ -103,14 +101,16 @@ #targetSelection #aidesGlimpse a { font-weight: 300; } -#targetSelection .editable { +#targetSelection .editable:not(.attractClick) { + border: 2px solid rgba(0, 0, 0, 0); border-bottom: 1px dashed #ffffff91; min-width: 2.5em; + margin: 0.2rem 0.6rem; display: inline-block; } -#targetSelection .attractClick.editable { - height: 2.6rem; +#targetSelection .attractClick.editable::before { + content: '€'; } #targetSelection .attractClick, @@ -120,10 +120,9 @@ text-align: right; background: rgba(255, 255, 255, 0.2); cursor: text; - font-weight: 500; padding: 0; - padding: 0.2em 0.5em; - border-radius: 0.2em; + padding: 0.2rem 0.6rem; + border-radius: 0.3rem; border: 2px solid; font-size: inherit; } diff --git a/source/components/TargetSelection.js b/source/components/TargetSelection.js index 6c4e69ed7..d88078aa3 100644 --- a/source/components/TargetSelection.js +++ b/source/components/TargetSelection.js @@ -18,10 +18,11 @@ import { flatRulesSelector, noUserInputSelector } from 'Selectors/analyseSelectors' +import Animate from 'Ui/animate' import AnimatedTargetValue from 'Ui/AnimatedTargetValue' import CurrencyInput from './CurrencyInput/CurrencyInput' -import './TargetSelection.css' import QuickLinks from './QuickLinks' +import './TargetSelection.css' export default compose( translate(), @@ -59,7 +60,7 @@ export default compose( {/* */}
{activeInput === target.dottedName && !conversationStarted && ( - - this.props.setFormValue(target.dottedName, '' + value) - } - rulePeriod={target.période} - colouredBackground={true} - /> + + + this.props.setFormValue(target.dottedName, '' + value) + } + rulePeriod={target.période} + colouredBackground={true} + /> + )} ))} diff --git a/source/components/rule/Namespace.css b/source/components/rule/Namespace.css index 5b6946e91..3344135e3 100644 --- a/source/components/rule/Namespace.css +++ b/source/components/rule/Namespace.css @@ -1,7 +1,6 @@ #namespace { padding: 0; margin: 0; - font-size: medium; } #namespace li { diff --git a/source/components/rule/Rule.css b/source/components/rule/Rule.css index c7f59a8ce..6d5dc9faa 100644 --- a/source/components/rule/Rule.css +++ b/source/components/rule/Rule.css @@ -1,6 +1,3 @@ -#rule { - margin: 1rem auto; -} .reportErrorContainer { text-align: center; padding: 0.3em 0.6em; @@ -25,6 +22,7 @@ h2 small { #rule #ruleValue { font-weight: 400; + text-align: center; font-size: 200%; color: inherit; margin-bottom: 0.6em; diff --git a/source/components/rule/Rule.js b/source/components/rule/Rule.js index 871d87a57..75bc93188 100644 --- a/source/components/rule/Rule.js +++ b/source/components/rule/Rule.js @@ -9,7 +9,7 @@ import { findRuleByDottedName, findRuleByNamespace } from 'Engine/rules' -import { compose, isEmpty } from 'ramda' +import { compose, isEmpty, isNil } from 'ramda' import React, { Component, Suspense } from 'react' import emoji from 'react-easy-emoji' import Helmet from 'react-helmet' @@ -24,13 +24,13 @@ import { ruleAnalysisSelector } from 'Selectors/analyseSelectors' import Animate from 'Ui/animate' +import Montant from 'Ui/Montant' import { AttachDictionary } from '../AttachDictionary' import Algorithm from './Algorithm' import Examples from './Examples' import RuleHeader from './Header' import References from './References' import './Rule.css' -import sitePaths from '../../sites/mycompanyinfrance.fr/sitePaths' let LazySource = React.lazy(() => import('./RuleSource')) @@ -44,6 +44,7 @@ export default compose( })), AttachDictionary(knownMecanisms), withNamespaces(), + withSitePaths, withLanguage )( class Rule extends Component { @@ -54,6 +55,7 @@ export default compose( currentExample, flatRules, valuesToShow, + sitePaths, analysedExample, analysedRule, language @@ -63,7 +65,8 @@ export default compose( namespaceRules = findRuleByNamespace(flatRules, dottedName) let displayedRule = analysedExample || analysedRule - + let ruleFormat = displayedRule.format || displayedRule.explanation?.format + console.log('ruleFormat', ruleFormat) return ( <> {this.state.viewSource ? ( @@ -97,26 +100,44 @@ export default compose( {this.renderToggleSourceButton()}
- {displayedRule.nodeValue ? ( + {!isNil(displayedRule.nodeValue) && (
- {displayedRule.format === 'euros' || displayedRule.formule - ? Intl.NumberFormat(language, { - style: 'currency', - currency: 'EUR' - }).format(displayedRule.nodeValue) - : typeof displayedRule.nodeValue !== 'object' - ? displayedRule.nodeValue - : null} + {['euros', 'pourcentage'].includes(ruleFormat) || + displayedRule.formule ? ( + + {displayedRule.nodeValue} + + ) : typeof displayedRule.nodeValue !== 'object' ? ( + displayedRule.nodeValue + ) : null}
- ) : null} - + )} {displayedRule.defaultValue != null && typeof displayedRule.defaultValue !== 'object' ? (
Valeur par défaut : {displayedRule.defaultValue}
) : null} - + {!valuesToShow && ( +
+ + Simuler ma situation + +
+ )} {//flatRule.question && // Fonctionnalité intéressante, à implémenter correctement false && } diff --git a/source/components/rule/RuleValueVignette.css b/source/components/rule/RuleValueVignette.css index eb3d805fc..9c5c027e5 100644 --- a/source/components/rule/RuleValueVignette.css +++ b/source/components/rule/RuleValueVignette.css @@ -15,7 +15,6 @@ } .Rule-value { transition: background 0.8s; - font-size: 105%; } .Rule-value .unsatisfied { font-style: italic; diff --git a/source/components/simulationConfigs/assimilé.yaml b/source/components/simulationConfigs/assimilé.yaml index 3ab314aec..05462463d 100644 --- a/source/components/simulationConfigs/assimilé.yaml +++ b/source/components/simulationConfigs/assimilé.yaml @@ -2,10 +2,10 @@ objectifs: - entreprise . chiffre d'affaires - revenu disponible -questions: +questions: - entreprise . charges -questions à l'affiche: +questions à l'affiche: Charges: entreprise . charges situation: @@ -16,3 +16,4 @@ situation: contrat salarié . CDD: non contrat salarié . temps partiel: non contrat salarié . ATMP . taux réduit: oui + période: année diff --git a/source/components/simulationConfigs/indépendant.yaml b/source/components/simulationConfigs/indépendant.yaml index f2f270c8e..a55522311 100644 --- a/source/components/simulationConfigs/indépendant.yaml +++ b/source/components/simulationConfigs/indépendant.yaml @@ -2,11 +2,11 @@ objectifs: - entreprise . chiffre d'affaires - revenu disponible -questions: +questions: - entreprise . charges - entreprise . catégorie d'activité -questions à l'affiche: +questions à l'affiche: Charges: entreprise . charges Commerçant, artisan, ou libéral ?: entreprise . catégorie d'activité @@ -14,3 +14,4 @@ situation: indépendant: oui micro entreprise: non contrat salarié: non + période: année diff --git a/source/components/simulationConfigs/micro-entreprise.yaml b/source/components/simulationConfigs/micro-entreprise.yaml index 6a78ebd38..53c8ae3d3 100644 --- a/source/components/simulationConfigs/micro-entreprise.yaml +++ b/source/components/simulationConfigs/micro-entreprise.yaml @@ -2,11 +2,11 @@ objectifs: - entreprise . chiffre d'affaires - revenu disponible -questions: +questions: - entreprise . catégorie d'activité - entreprise . charges -questions à l'affiche: +questions à l'affiche: Charges: entreprise . charges Commerçant, artisan, ou libéral ?: entreprise . catégorie d'activité @@ -14,3 +14,4 @@ situation: micro entreprise: oui indépendant: non contrat salarié: non + période: année diff --git a/source/components/simulationConfigs/rémunération-dirigeant.yaml b/source/components/simulationConfigs/rémunération-dirigeant.yaml index 231078c8f..fb9f1296f 100644 --- a/source/components/simulationConfigs/rémunération-dirigeant.yaml +++ b/source/components/simulationConfigs/rémunération-dirigeant.yaml @@ -9,6 +9,9 @@ questions: - entreprise . catégorie d'activité - entreprise . charges +situation: + période: année + branches: - nom: Micro-entreprise situation: diff --git a/source/components/simulationConfigs/salarié.yaml b/source/components/simulationConfigs/salarié.yaml index 83383ca43..a23231b29 100644 --- a/source/components/simulationConfigs/salarié.yaml +++ b/source/components/simulationConfigs/salarié.yaml @@ -4,7 +4,7 @@ objectifs: - contrat salarié . salaire . net - contrat salarié . salaire . net après impôt -questions à l'affiche: +questions à l'affiche: CDD: contrat salarié . CDD Cadre: contrat salarié . statut cadre Temps partiel: contrat salarié . temps partiel @@ -15,3 +15,4 @@ situation: contrat salarié . assimilé salarié: non indépendant: non micro entreprise: non + période: mois diff --git a/source/components/simulationConfigs/withSimulationConfig.js b/source/components/simulationConfigs/withSimulationConfig.js index be33ffada..0d0304a09 100644 --- a/source/components/simulationConfigs/withSimulationConfig.js +++ b/source/components/simulationConfigs/withSimulationConfig.js @@ -14,8 +14,10 @@ export default config => SimulationComponent => constructor(props) { super(props) if (config !== props.config) { - props.resetSimulation() props.setSimulationConfig(config) + if (props.config) { + props.resetSimulation() + } } } render() { diff --git a/source/components/ui/AnimatedTargetValue.css b/source/components/ui/AnimatedTargetValue.css index e4f074e8d..9ecd8fdc2 100644 --- a/source/components/ui/AnimatedTargetValue.css +++ b/source/components/ui/AnimatedTargetValue.css @@ -1,5 +1,4 @@ .Rule-value { - font-size: 105%; position: relative; } diff --git a/source/components/ui/Button/button.css b/source/components/ui/Button/button.css index 6669b494b..1487bf25e 100644 --- a/source/components/ui/Button/button.css +++ b/source/components/ui/Button/button.css @@ -119,6 +119,12 @@ font-family: inherit; margin: 0; } +.ui__.link-button img[src*='twemoji.maxcdn'], +.ui__.dashed-button img[src*='twemoji.maxcdn'], +.ui__.text-button img[src*='twemoji.maxcdn'] { + margin-right: 0.2rem !important; + margin-left: 0.2rem !important; +} .ui__.link-button, .ui__.text-button { text-decoration: none; diff --git a/source/components/ui/Montant.js b/source/components/ui/Montant.js index 9784c15d7..d857d45b0 100644 --- a/source/components/ui/Montant.js +++ b/source/components/ui/Montant.js @@ -6,7 +6,7 @@ import './Montant.css' type Props = { children: number, className?: string, - type: 'currency' | 'percent', + type: 'currency' | 'percent' | 'decimal', style?: { [string]: string }, numFractionDigit?: number } & ConnectedProps diff --git a/source/components/ui/animate.js b/source/components/ui/animate.js index bae7718dc..bfd9b0292 100644 --- a/source/components/ui/animate.js +++ b/source/components/ui/animate.js @@ -46,6 +46,34 @@ export const fromBottom = ({ ))} ) +export const fromTop = ({ + children, + config = configPresets.stiff, + style: inheritedStyle = {}, + delay = 0 +}: Props) => ( + i)} + native={true} + delay={delay} + config={config} + leave={{ opacity: 0, y: 50 }} + from={{ opacity: 0, y: -50 }} + to={{ opacity: 1, y: 0 }}> + {/* eslint-disable-next-line react/display-name */} + {React.Children.map(children, (item, i) => ({ y, ...style }) => ( + `translate3d(0, ${y}px,0)`), + ...style, + ...inheritedStyle + }}> + {item} + + ))} + +) export const leftToRight = ({ children, @@ -122,5 +150,6 @@ export default { appear, fromBottom, leftToRight, + fromTop, fadeIn } diff --git a/source/components/ui/index.css b/source/components/ui/index.css index 2838009e5..17ce7adbe 100644 --- a/source/components/ui/index.css +++ b/source/components/ui/index.css @@ -40,8 +40,10 @@ button { .ui__.container { width: 100%; max-width: 800px; - margin: auto; - padding: 0 0.6rem; + margin-right: auto; + margin-left: auto; + padding-right: 0.6rem; + padding-left: 0.6rem; } .ui__.container .ui__.full-width { margin: 0 calc((800px - 100vw) / 2); diff --git a/source/règles/base.yaml b/source/règles/base.yaml index 469e121fa..ecf0ebf16 100644 --- a/source/règles/base.yaml +++ b/source/règles/base.yaml @@ -2782,6 +2782,7 @@ - espace: indépendant . cotisations nom: retraite complémentaire période: année + format: euros notes: Pour les professions libérales, nous avons retenu un des 8 régimes de retraite, celui de la CIPAV, la caisse interprofessionnelle. formule: variations: diff --git a/source/selectors/analyseSelectors.js b/source/selectors/analyseSelectors.js index 3401e8c85..2d4751616 100644 --- a/source/selectors/analyseSelectors.js +++ b/source/selectors/analyseSelectors.js @@ -118,7 +118,7 @@ export let validatedSituationBranchesSelector = createSituationBrancheSelector( validatedSituationSelector ) -let situationsWithDefaultsSelector = createSelector( +export let situationsWithDefaultsSelector = createSelector( [ruleDefaultsSelector, situationBranchesSelector], (defaults, situations) => mapOrApply(situation => ({ ...defaults, ...situation }), situations) diff --git a/source/sites/embauche.gouv.fr/App.js b/source/sites/embauche.gouv.fr/App.js index a060d3ee8..5303706f4 100644 --- a/source/sites/embauche.gouv.fr/App.js +++ b/source/sites/embauche.gouv.fr/App.js @@ -7,6 +7,7 @@ import { defaultTracker } from 'Components/utils/withTracker' import createRavenMiddleware from 'raven-for-redux' import Raven from 'raven-js' import React, { Component } from 'react' +import { withNamespaces } from 'react-i18next' import { Redirect, Route, Switch } from 'react-router-dom' import 'Ui/index.css' import Provider from '../../Provider' @@ -28,6 +29,7 @@ import Integration from './pages/Integration' import IntegrationTest from './pages/IntegrationTest' import Route404 from './pages/Route404' import RulesList from './pages/RulesList' +import sitePaths from './sitePaths' if (process.env.NODE_ENV === 'production') { Raven.config( @@ -56,42 +58,53 @@ if (process.env.NODE_ENV === 'production') { } const middlewares = [createRavenMiddleware(Raven), trackDomainActions(tracker)] - +const paths = sitePaths() class EmbaucheRoute extends Component { render() { return ( {!inIframe() &&
} {inIframe() && } - - - - - - - - - - - - - - - + {inIframe() && } ) } } +const RouterSwitch = withNamespaces()(() => ( + + + + + + + + + + + + + + + +)) let ExportedApp = EmbaucheRoute diff --git a/source/sites/embauche.gouv.fr/sitePaths.js b/source/sites/embauche.gouv.fr/sitePaths.js new file mode 100644 index 000000000..31f4db991 --- /dev/null +++ b/source/sites/embauche.gouv.fr/sitePaths.js @@ -0,0 +1,13 @@ +/* @flow */ +import { constructSitePaths } from '../../utils' + +const sitePath = constructSitePaths('', { + index: '', + documentation: { + index: '/documentation', + exemples: '/exemples' + }, + contact: '/contact' +}) + +export default () => sitePath diff --git a/source/sites/mycompanyinfrance.fr/pages/SocialSecurity/Salarié.js b/source/sites/mycompanyinfrance.fr/pages/SocialSecurity/Salarié.js index b8240fc1a..9036fe188 100644 --- a/source/sites/mycompanyinfrance.fr/pages/SocialSecurity/Salarié.js +++ b/source/sites/mycompanyinfrance.fr/pages/SocialSecurity/Salarié.js @@ -16,11 +16,13 @@ export let SalarySimulation = withSitePaths(({ sitePaths }) => ( Vous pouvez maintenant concrétiser votre projet d'embauche. -
- - Connaître les démarches - -
+ {sitePaths.démarcheEmbauche && ( +
+ + Connaître les démarches + +
+ )} } targets={} diff --git a/source/sites/mycompanyinfrance.fr/sitePaths.js b/source/sites/mycompanyinfrance.fr/sitePaths.js index d154dd95e..423872c3c 100644 --- a/source/sites/mycompanyinfrance.fr/sitePaths.js +++ b/source/sites/mycompanyinfrance.fr/sitePaths.js @@ -1,6 +1,7 @@ /* @flow */ -import { map, reduce, toPairs, zipObj } from 'ramda' +import { reduce, toPairs, zipObj } from 'ramda' import i18n from '../../i18n' +import { constructSitePaths } from '../../utils' import type { LegalStatus } from 'Selectors/companyStatusSelectors' export const LANDING_LEGAL_STATUS_LIST: Array = [ @@ -88,21 +89,6 @@ const constructLocalizedSitePath = language => { } }) } -const constructSitePaths = ( - root: string, - { index, ...sitePaths }: { index: string } -) => ({ - index: root + index, - ...map( - value => - typeof value === 'string' - ? root + index + value - : typeof value === 'function' - ? (...args) => root + index + value(...args) - : constructSitePaths(root + index, value), - sitePaths - ) -}) let sitePath = constructLocalizedSitePath() i18n.on('languageChanged', () => { diff --git a/source/utils.js b/source/utils.js index 13314c1e8..8e4749603 100644 --- a/source/utils.js +++ b/source/utils.js @@ -82,3 +82,19 @@ export function softCatch( } } } + +export const constructSitePaths = ( + root: string, + { index, ...sitePaths }: { index: string } +) => ({ + index: root + index, + ...map( + value => + typeof value === 'string' + ? root + index + value + : typeof value === 'function' + ? (...args) => root + index + value(...args) + : constructSitePaths(root + index, value), + sitePaths + ) +}) diff --git a/yarn.lock b/yarn.lock index ed28ad6c0..3773e05b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1521,7 +1521,7 @@ babel-polyfill@^6.26.0: core-js "^2.5.0" regenerator-runtime "^0.10.5" -babel-runtime@6.x, babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtime@^6.25.0, babel-runtime@^6.26.0: +babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtime@^6.25.0, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" dependencies: @@ -6880,13 +6880,6 @@ raw-loader@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa" -rc-progress@^2.2.6: - version "2.2.6" - resolved "https://registry.yarnpkg.com/rc-progress/-/rc-progress-2.2.6.tgz#d5d07c07333b352a9ef13230c5940e13336c1e62" - dependencies: - babel-runtime "6.x" - prop-types "^15.5.8" - rc@^1.0.1, rc@^1.1.6, rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"