Utilise le décorateur pour la comparaison et le salarié

pull/444/head
Johan Girod 2019-01-08 11:13:08 +01:00
parent da8ea3bc9b
commit 37e1967a51
3 changed files with 23 additions and 40 deletions

View File

@ -29,10 +29,11 @@ import './Simu.css'
import TargetSelection from './TargetSelection'
import { formValueSelector } from 'redux-form'
import emoji from 'react-easy-emoji'
import SimulationDecorator from 'Components/simulationConfig/SimulationDecorator'
import withSimulationConfig from 'Components/simulationConfigs/withSimulationConfig';
import salariéConfig from 'Components/simulationConfigs/salarié.yaml';
export default compose(
SimulationDecorator,
withSimulationConfig(salariéConfig),
withRouter,
withColours,
withNamespaces(), // Triggers rerender when the language changes

View File

@ -1,5 +1,4 @@
import React from 'react'
import { Helmet } from 'react-helmet'
import { connect } from 'react-redux'
export default config => SimulationComponent =>
@ -15,15 +14,7 @@ export default config => SimulationComponent =>
}
render() {
if (!this.props.simulationConfig) return null
return (
<>
<Helmet>
<title>TITRE PAGE</title>
</Helmet>
<h1>Titre HTML</h1>
<SimulationComponent config={config} />
</>
)
return <SimulationComponent />
}
}
)

View File

@ -1,33 +1,24 @@
import ComparativeSimulation from 'Components/ComparativeSimulation'
import ComparaisonConfig from 'Components/simulationConfigs/rémunération-dirigeant.yaml'
import withSimulationConfig from 'Components/simulationConfigs/withSimulationConfig'
import React from 'react'
import { Helmet } from 'react-helmet'
import { connect } from 'react-redux'
import config from 'Components/simulationConfigs/rémunération-dirigeant.yaml'
export default connect(
state => ({ simulationConfig: state.simulationConfig }),
dispatch => ({
setSimulation: () => dispatch({ type: 'SET_SIMULATION_CONFIG', config })
})
)(
class SchemeComparaisonPage extends React.Component {
componentDidMount() {
this.props.setSimulation()
}
render() {
if (!this.props.simulationConfig) return null
return (
<>
<Helmet>
<title>
Assimilé salarié, indépendant, micro-entreprise : comparaison des
différents régimes
</title>
</Helmet>
<h1>Comparaison des différents régimes de cotisation</h1>
<ComparativeSimulation config={this.props.simulationConfig} />
</>
)
}
}
const Simulation = withSimulationConfig(ComparaisonConfig)(
ComparativeSimulation
)
const SchemeComparaisonPage = () => (
<>
<Helmet>
<title>
Assimilé salarié, indépendant, micro-entreprise : comparaison des
différents régimes
</title>
</Helmet>
<h1>Comparaison des différents régimes de cotisation</h1>
<Simulation />
</>
)
export default SchemeComparaisonPage