🎨 On cache les résultats avant la 1ère saisie

pull/444/head
Mael 2019-01-07 10:29:40 +01:00
parent 42ac466089
commit fb3e559e9f
3 changed files with 23 additions and 8 deletions

View File

@ -8,7 +8,8 @@ import ComparativeTargets from 'Components/ComparativeTargets'
import './ComparativeSimulation.css'
import {
nextStepsSelector,
analysisWithDefaultsSelector
analysisWithDefaultsSelector,
noUserInputSelector
} from 'Selectors/analyseSelectors'
import simulationConfig from './simulateur-rémunération-dirigeant.yaml'
import { createMarkdownDiv } from 'Engine/marked'
@ -18,7 +19,8 @@ export default compose(
connect(state => ({
previousAnswers: state.conversationSteps.foldedSteps,
noNextSteps: nextStepsSelector(state, simulationConfig).length == 0,
analyses: analysisWithDefaultsSelector(state, simulationConfig)
analyses: analysisWithDefaultsSelector(state, simulationConfig),
noUserInput: noUserInputSelector(state)
}))
)(
class extends React.Component {
@ -26,7 +28,13 @@ export default compose(
displayAnswers: false
}
render() {
let { colours, noNextSteps, previousAnswers, analyses } = this.props
let {
colours,
noNextSteps,
previousAnswers,
analyses,
noUserInput
} = this.props
return (
<div id="ComparativeSimulation" className="ui__ container">
@ -58,7 +66,8 @@ export default compose(
<p>Vous avez atteint l'estimation la plus précise.</p>
</>
)}
<ComparativeTargets />
<ComparativeTargets hide={noUserInput} />
</div>
</div>
)

View File

@ -41,10 +41,12 @@ export default compose(
analyses,
target,
setSituationBranch,
chiffreAffaires
chiffreAffaires,
hide
} = this.props
console.log(hide)
return (
<div id="targets">
<div id="targets" style={{ display: hide ? 'none' : 'block' }}>
<h3>{target.title}</h3>
<PeriodSwitch />
<ul>

View File

@ -23,7 +23,8 @@ import {
isEmpty,
pick,
reduce,
intersection
intersection,
dissoc
} from 'ramda'
import { getFormValues } from 'redux-form'
import { createSelector, createSelectorCreator, defaultMemoize } from 'reselect'
@ -63,7 +64,10 @@ export let situationSelector = createDeepEqualSelector(
export let noUserInputSelector = createSelector(
[situationSelector],
situation => !situation || isEmpty(situation)
situation =>
!situation ||
console.log(situation) ||
isEmpty(dissoc('période', situation))
)
export let formattedSituationSelector = createSelector(