2017-12-05 11:58:24 +00:00
|
|
|
import React, { Component } from 'react'
|
2018-03-29 07:58:20 +00:00
|
|
|
import { Trans, translate } from 'react-i18next'
|
2017-12-20 15:21:29 +00:00
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import { withRouter } from 'react-router'
|
2017-12-05 11:58:24 +00:00
|
|
|
import './ProgressTip.css'
|
2018-01-24 11:00:15 +00:00
|
|
|
import { Line } from 'rc-progress'
|
2018-03-29 17:26:35 +00:00
|
|
|
import { pick } from 'ramda'
|
2017-12-05 11:58:24 +00:00
|
|
|
|
|
|
|
@withRouter
|
2018-03-29 07:58:20 +00:00
|
|
|
@translate()
|
2018-03-29 17:26:35 +00:00
|
|
|
@connect(
|
|
|
|
pick(['foldedSteps', 'nextSteps', 'themeColours', 'conversationStarted'])
|
|
|
|
)
|
2017-12-05 11:58:24 +00:00
|
|
|
export default class ProgressTip extends Component {
|
|
|
|
render() {
|
2018-03-12 09:38:29 +00:00
|
|
|
let {
|
|
|
|
nextSteps,
|
|
|
|
foldedSteps,
|
2018-04-05 17:19:53 +00:00
|
|
|
themeColours: { colour, textColourOnWhite },
|
2018-03-29 17:26:35 +00:00
|
|
|
conversationStarted
|
2018-03-12 09:38:29 +00:00
|
|
|
} = this.props,
|
2017-12-20 15:21:29 +00:00
|
|
|
nbQuestions = nextSteps.length
|
2018-03-12 09:38:29 +00:00
|
|
|
|
2018-03-29 17:26:35 +00:00
|
|
|
if (!conversationStarted) return null
|
2017-12-05 11:58:24 +00:00
|
|
|
return (
|
2018-03-14 16:10:28 +00:00
|
|
|
<div className="progressTip">
|
2018-04-26 10:36:56 +00:00
|
|
|
{ nbQuestions != 0
|
|
|
|
?
|
2018-04-05 17:19:53 +00:00
|
|
|
<p style={{ color: textColourOnWhite }}>
|
2018-04-24 13:09:36 +00:00
|
|
|
{nbQuestions === 1
|
|
|
|
?
|
|
|
|
<Trans i18nKey="lastQ">dernière question !</Trans>
|
|
|
|
:
|
|
|
|
<Trans i18nKey="questionsLeft" count={nbQuestions}>
|
|
|
|
moins de {{nbQuestions}} questions
|
|
|
|
</Trans>
|
|
|
|
}
|
2017-12-05 11:58:24 +00:00
|
|
|
</p>
|
2018-04-26 10:36:56 +00:00
|
|
|
:
|
|
|
|
<br/>}
|
2018-03-14 16:10:28 +00:00
|
|
|
</div>
|
2017-12-05 11:58:24 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|