diff --git a/source/actions/actions.js b/source/actions/actions.js index d78f04c07..ce67350df 100644 --- a/source/actions/actions.js +++ b/source/actions/actions.js @@ -9,7 +9,6 @@ import type { } from 'Types/ActionsTypes' import { reset } from 'redux-form' import { deletePersistedSimulation } from '../storage/persistSimulation' -import { normalizeBasePath } from '../utils' import type { RouterHistory } from 'react-router-dom' @@ -51,19 +50,12 @@ export const deletePreviousSimulation = () => ( export const startConversation = (priorityNamespace: ?string) => ( dispatch: StartConversationAction => void, - _: any, - history: RouterHistory + _: any ) => { dispatch({ type: 'START_CONVERSATION', ...(priorityNamespace ? { priorityNamespace } : {}) }) - const currentPath = normalizeBasePath(history.location.pathname) - if (currentPath.endsWith('/simulation/')) { - return - } - - history.push(currentPath + 'simulation') } // $FlowFixMe diff --git a/source/components/QuickLink.js b/source/components/QuickLinks.js similarity index 78% rename from source/components/QuickLink.js rename to source/components/QuickLinks.js index 61f65780c..f8a157a95 100644 --- a/source/components/QuickLink.js +++ b/source/components/QuickLinks.js @@ -16,26 +16,21 @@ type Props = { validInputEntered: boolean } -let quickLinks = { - CDD: 'contrat salarié . CDD', - Cadre: 'contrat salarié . statut cadre', - 'Temps partiel': 'contrat salarié . temps partiel', - Localisation: 'établissement . localisation', - Autres: null -} - -const QuickLink = ({ +const QuickLinks = ({ startConversation, location, - validInputEntered + validInputEntered, + quickLinks, + conversationStarted }: Props) => { - const show = !location.pathname.endsWith('/simulation') && validInputEntered + const show = validInputEntered && !conversationStarted return ( {styles => ( ({ key: props.language, - validInputEntered: validInputEnteredSelector(state) + validInputEntered: validInputEnteredSelector(state), + conversationStarted: state.conversationStarted, + quickLinks: state.simulation?.config["questions à l'affiche"] }), { startConversation } ) -)(QuickLink) +)(QuickLinks) diff --git a/source/components/RulePage.js b/source/components/RulePage.js index 6ad6a59d1..86b459e15 100644 --- a/source/components/RulePage.js +++ b/source/components/RulePage.js @@ -95,7 +95,6 @@ const BackToSimulation = compose( let { goBackToSimulation } = this.props return ( +

+ + )} +

+ + {this.props.period === 'mois' + ? 'Fiche de paie mensuelle' + : 'Détail annuel des cotisations'} + +

+ + + ) + } +} diff --git a/source/components/SalarySimulation.js b/source/components/SalarySimulation.js deleted file mode 100644 index a0ef16968..000000000 --- a/source/components/SalarySimulation.js +++ /dev/null @@ -1,239 +0,0 @@ -import { startConversation } from 'Actions/actions' -import { Component, React, T } from 'Components' -import AnswerList from 'Components/AnswerList' -import Distribution from 'Components/Distribution' -import PaySlip from 'Components/PaySlip' -import { ScrollToTop } from 'Components/utils/Scroll' -import withColours from 'Components/utils/withColours' -import withLanguage from 'Components/utils/withLanguage' -import withSitePaths from 'Components/utils/withSitePaths' -import { compose } from 'ramda' -import emoji from 'react-easy-emoji' -import { Trans, withNamespaces } from 'react-i18next' -import { connect } from 'react-redux' -import { Redirect, withRouter } from 'react-router' -import { Link } from 'react-router-dom' -import { formValueSelector } from 'redux-form' -import { - blockingInputControlsSelector, - nextStepsSelector, - noUserInputSelector, - validInputEnteredSelector -} from 'Selectors/analyseSelectors' -import * as Animate from 'Ui/animate' -import { normalizeBasePath } from '../utils' -import Conversation from './conversation/Conversation' -import PageFeedback from './Feedback/PageFeedback' -import QuickLink from './QuickLink' -import ResultView from './ResultView' -import './SalarySimulation.css' -import TargetSelection from './TargetSelection' - -export default compose( - withRouter, - withColours, - withNamespaces(), // Triggers rerender when the language changes - connect( - state => ({ - blockingInputControls: blockingInputControlsSelector(state), - conversationStarted: state.conversationStarted, - validInputEntered: validInputEnteredSelector(state), - arePreviousAnswers: state.conversationSteps.foldedSteps.length !== 0, - nextSteps: state.conversationStarted && nextStepsSelector(state), - noUserInput: noUserInputSelector(state), - period: formValueSelector('conversation')(state, 'période') - }), - { - startConversation - } - ), - withLanguage, - withSitePaths -)( - class Simulation extends Component { - state = { - displayPreviousAnswers: false - } - render() { - let { - colours, - conversationStarted, - arePreviousAnswers, - nextSteps, - blockingInputControls, - displayHiringProcedures, - match, - validInputEntered, - - period, - location, - sitePaths, - noUserInput - } = this.props - const displayConversation = conversationStarted && !blockingInputControls - const simulationCompleted = - !blockingInputControls && conversationStarted && !nextSteps.length - const displayPreviousAnswers = - arePreviousAnswers && this.state.displayPreviousAnswers - const simulationHomePath = normalizeBasePath(match.path).replace( - /\/simulation\/$/, - '' - ) - return ( - <> -
- {noUserInput && ( -

- {emoji('🌟')}{' '} - - Le simulateur est à jour aux taux 2019 –{' '} - - détails - - -

- )} - - {location.pathname.endsWith('/simulation') && ( - <> - {!conversationStarted && } - -