rétabli le bouton de suppression de toutes les réponses précédentes
parent
f685d0c94c
commit
7e88b0137e
|
@ -1,3 +1,4 @@
|
|||
import { resetSimulation } from 'Actions/actions'
|
||||
import Montant from 'Components/Montant'
|
||||
import Overlay from 'Components/Overlay'
|
||||
import RuleLink from 'Components/RuleLink'
|
||||
|
@ -29,9 +30,21 @@ const formatAnswer = (answer, language) => {
|
|||
return answer.valeur
|
||||
}
|
||||
|
||||
const AnswerList = ({ answers, onClose, language, changeAnswer }) => (
|
||||
const AnswerList = ({
|
||||
answers,
|
||||
onClose,
|
||||
language,
|
||||
changeAnswer,
|
||||
resetSimulation
|
||||
}) => (
|
||||
<Overlay onClose={onClose} className="answer-list">
|
||||
<h2>My answers</h2>
|
||||
<p style={{ textAlign: 'center' }}>
|
||||
🗑{' '}
|
||||
<button className="ui__ link-button" onClick={resetSimulation}>
|
||||
<Trans>Tout supprimer</Trans>
|
||||
</button>
|
||||
</p>
|
||||
<table>
|
||||
<tbody>
|
||||
{answers.map(answer => (
|
||||
|
@ -67,6 +80,7 @@ export default compose(
|
|||
connect(
|
||||
state => ({ answers: answerWithValueSelector(state) }),
|
||||
dispatch => ({
|
||||
resetSimulation: () => dispatch(resetSimulation()),
|
||||
changeAnswer: question =>
|
||||
dispatch({
|
||||
type: 'STEP_ACTION',
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
import withColours from 'Components/utils/withColours'
|
||||
import withTracker from 'Components/utils/withTracker'
|
||||
import React, { Component } from 'react'
|
||||
import { Trans, translate } from 'react-i18next'
|
||||
import { Element, scroller } from 'react-scroll'
|
||||
import { LinkButton } from 'Ui/Button'
|
||||
import './conversation/conversation.css'
|
||||
|
||||
@translate()
|
||||
@withColours
|
||||
@withTracker
|
||||
export default class GoToExplanation extends Component {
|
||||
handleScrollToResults = () => {
|
||||
this.props.tracker.push(['trackEvent', 'simulation', 'goToExplanation'])
|
||||
scroller.scrollTo('resultsScrollElement', {
|
||||
smooth: true,
|
||||
duration: 200,
|
||||
delay: 0
|
||||
})
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<Element name="resultsScrollElement" id="resultsScrollElement">
|
||||
<LinkButton
|
||||
className="scrollIndication down"
|
||||
onClick={this.handleScrollToResults}>
|
||||
<i className="fa fa-long-arrow-down" aria-hidden="true" />
|
||||
<Trans i18nKey="details">Comprendre mes résultats</Trans>
|
||||
</LinkButton>
|
||||
</Element>
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,10 +1,8 @@
|
|||
import { resetSimulation } from 'Actions/actions'
|
||||
import withTracker from 'Components/utils/withTracker'
|
||||
import { isEmpty } from 'ramda'
|
||||
import React, { Component } from 'react'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { connect } from 'react-redux'
|
||||
import { animateScroll, Element, scroller } from 'react-scroll'
|
||||
import { reset } from 'redux-form'
|
||||
import { flatRulesSelector } from 'Selectors/analyseSelectors'
|
||||
import { LinkButton } from 'Ui/Button'
|
||||
|
@ -46,52 +44,3 @@ export default class FoldedSteps extends Component {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
@connect(state => ({
|
||||
foldedSteps: state.conversationSteps.foldedSteps,
|
||||
conversationStarted: state.conversationStarted
|
||||
}))
|
||||
@withTracker
|
||||
export class GoToAnswers extends Component {
|
||||
componentDidUpdate(prevProps) {
|
||||
if (!prevProps.conversationStarted && this.props.conversationStarted) {
|
||||
scroller.scrollTo('myScrollToElement', {
|
||||
duration: 200,
|
||||
delay: 0,
|
||||
smooth: true
|
||||
})
|
||||
this.props.tracker.push(['trackEvent', 'simulation', 'goToAnswers'])
|
||||
|
||||
return
|
||||
}
|
||||
if (prevProps.foldedSteps.length === this.props.foldedSteps.length) return
|
||||
|
||||
scroller.scrollTo('myScrollToElement', {
|
||||
duration: 0,
|
||||
delay: 0,
|
||||
smooth: false
|
||||
})
|
||||
}
|
||||
handleScrollToAnswers = () => {
|
||||
animateScroll.scrollToTop({
|
||||
duration: 200,
|
||||
delay: 0,
|
||||
smooth: true
|
||||
})
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<Element name="myScrollToElement" id="myScrollToElement">
|
||||
<LinkButton
|
||||
onClick={this.handleScrollToAnswers}
|
||||
className="scrollIndication up"
|
||||
style={{
|
||||
visibility: !this.props.foldedSteps.length ? 'hidden' : 'visible'
|
||||
}}>
|
||||
<i className="fa fa-long-arrow-up" aria-hidden="true" />
|
||||
<Trans i18nKey="change">Modifier mes réponses</Trans>
|
||||
</LinkButton>
|
||||
</Element>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue