diff --git a/source/components/ProgressTip.js b/source/components/ProgressTip.js index f205118e9..3c0bc0ea1 100644 --- a/source/components/ProgressTip.js +++ b/source/components/ProgressTip.js @@ -25,7 +25,9 @@ export default class ProgressTip extends Component { nbQuestions = nextSteps.length if (selectingTargets && !conversationVisible) - return

Vous aurez {nextSteps.length} questions !

+ return nbQuestions ? ( +

Vous aurez {nextSteps.length} questions !

+ ) : null if (!conversationVisible) return null return (
diff --git a/source/components/TargetSelection.js b/source/components/TargetSelection.js index 27dba94d6..26523a34f 100644 --- a/source/components/TargetSelection.js +++ b/source/components/TargetSelection.js @@ -64,9 +64,7 @@ export default class TargetSelection extends Component {
{this.props.selectingTargets ? ( !this.props.conversationVisible && ( -

- Cochez un ou plusieurs objectifs -

+

Cochez un ou plusieurs objectifs

) ) : ( <> diff --git a/source/components/conversation/Conversation.js b/source/components/conversation/Conversation.js index 4f213e8f7..80f7f6cd4 100644 --- a/source/components/conversation/Conversation.js +++ b/source/components/conversation/Conversation.js @@ -2,13 +2,14 @@ import React, { Component } from 'react' import { Trans, translate } from 'react-i18next' import { isEmpty, map } from 'ramda' import Aide from '../Aide' -import { reduxForm } from 'redux-form' +import { reduxForm, reset } from 'redux-form' import { scroller, Element } from 'react-scroll' import { getInputComponent } from 'Engine/generateQuestions' import Satisfaction from '../Satisfaction' import { connect } from 'react-redux' import './conversation.css' +import ReactPiwik from '../Tracker' let scroll = () => scroller.scrollTo('myScrollToElement', { duration: 500, @@ -21,17 +22,26 @@ let scroll = () => destroyOnUnmount: false }) @translate() -@connect(state => ({ - currentQuestion: state.currentQuestion, - foldedSteps: state.foldedSteps, - themeColours: state.themeColours, - situationGate: state.situationGate, - targetNames: state.targetNames, - done: state.done, - nextSteps: state.nextSteps, - analysis: state.analysis, - parsedRules: state.parsedRules -})) +@connect( + state => ({ + currentQuestion: state.currentQuestion, + foldedSteps: state.foldedSteps, + themeColours: state.themeColours, + situationGate: state.situationGate, + targetNames: state.targetNames, + done: state.done, + nextSteps: state.nextSteps, + analysis: state.analysis, + parsedRules: state.parsedRules + }), + dispatch => ({ + reinitialise: () => { + ReactPiwik.push(['trackEvent', 'restart', '']) + dispatch(reset('conversation')) + dispatch({ type: 'SET_CONVERSATION_TARGETS', reset: true }) + } + }) +) export default class Conversation extends Component { componentWillReceiveProps(nextProps) { if (nextProps.foldedSteps.length == this.props.foldedSteps.length) @@ -45,7 +55,7 @@ export default class Conversation extends Component { currentQuestion, parsedRules, targetNames, - reinitalise, + reinitialise, textColourOnWhite } = this.props console.log(this.props) @@ -55,7 +65,7 @@ export default class Conversation extends Component {