diff --git a/source/components/Sondage.js b/source/components/Sondage.js index a3951fe80..798e0204d 100644 --- a/source/components/Sondage.js +++ b/source/components/Sondage.js @@ -7,13 +7,16 @@ import Smiley from './SatisfactionSmiley' import TypeFormEmbed from './TypeFormEmbed' import withLanguage from './withLanguage' import { Trans, translate } from 'react-i18next' -import withColours from './withColours'; +import withColours from './withColours' +import { + noUserInputSelector, + nextStepsSelector +} from 'Selectors/analyseSelectors' @connect(state => ({ - targets: state.analysis ? state.analysis.targets : [], - activeInput: state.activeTargetInput, - currentQuestion: state.currentQuestion, - conversationStarted: state.conversationStarted + conversationStarted: state.conversationStarted, + noUserInput: noUserInputSelector(state), + nextSteps: nextStepsSelector(state) })) @translate() @withLanguage @@ -27,9 +30,9 @@ export default class Sondage extends Component { static getDerivedStateFromProps(nextProps, currentState) { let feedbackAlreadyAsked = !!document.cookie.includes('feedback_asked=true') let conditions = { - AFTER_FIRST_ESTIMATE: nextProps.activeInput && nextProps.targets.length, + AFTER_FIRST_ESTIMATE: !nextProps.noUserInput, AFTER_SIMULATION_COMPLETED: - !nextProps.currentQuestion && nextProps.conversationStarted + !nextProps.nextSteps.length && nextProps.conversationStarted } return { visible: conditions[currentState.askFeedbackTime] && !feedbackAlreadyAsked @@ -58,7 +61,10 @@ export default class Sondage extends Component { } render() { let { satisfaction, showForm, visible, askFeedbackTime } = this.state, - { language, colours: {colour} } = this.props + { + language, + colours: { colour } + } = this.props return ( <> @@ -78,7 +84,9 @@ export default class Sondage extends Component { transitionLeaveTimeout={300}> {visible && (