diff --git a/package.json b/package.json index ce29967dd..6104ac605 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "nearley": "^2.9.2", "npm": "^5.3.0", "ramda": "^0.25.0", + "rc-progress": "^2.2.5", "react": "^16.2.0", "react-addons-css-transition-group": "^15.6.2", "react-color": "^2.13.8", diff --git a/source/actions.js b/source/actions.js index 6516f6bd2..9e187b9ed 100644 --- a/source/actions.js +++ b/source/actions.js @@ -2,8 +2,8 @@ // The state keeps track of which of them have been submitted // The user can also come back to one of his answers and edit it export const STEP_ACTION = 'STEP_ACTION' -export function stepAction(name, step) { - return { type: STEP_ACTION, name, step } +export function stepAction(name, step, source) { + return { type: STEP_ACTION, name, step, source } } export const START_CONVERSATION = 'START_CONVERSATION' diff --git a/source/components/ProgressTip.css b/source/components/ProgressTip.css index 7b6244401..d3853d58b 100644 --- a/source/components/ProgressTip.css +++ b/source/components/ProgressTip.css @@ -1,6 +1,6 @@ #sim .tip { font-style: italic; - margin-bottom: 1em; + margin-bottom: -0.3em; text-align: center; } #sim .tip p { @@ -12,10 +12,3 @@ border-width: 1px; border-style: solid; } - -progress::-webkit-progress-bar { - background: white; -} - -progress::-webkit-progress-value { -} diff --git a/source/components/ProgressTip.js b/source/components/ProgressTip.js index e64b8bf65..3e84ebbd4 100644 --- a/source/components/ProgressTip.js +++ b/source/components/ProgressTip.js @@ -2,13 +2,14 @@ import React, { Component } from 'react' import { connect } from 'react-redux' import { withRouter } from 'react-router' import './ProgressTip.css' +import { Line } from 'rc-progress' @withRouter @connect(state => ({ done: state.done, foldedSteps: state.foldedSteps, nextSteps: state.nextSteps, - textColourOnWhite: state.themeColours.textColourOnWhite + colour: state.themeColours.colour })) export default class ProgressTip extends Component { state = { @@ -21,7 +22,7 @@ export default class ProgressTip extends Component { }) } render() { - let { done, nextSteps, foldedSteps, textColourOnWhite } = this.props, + let { done, nextSteps, foldedSteps, colour } = this.props, nbQuestions = nextSteps.length if (!done) return null return ( @@ -35,10 +36,14 @@ export default class ProgressTip extends Component { {nbQuestions === 1 ? 'Une dernière question !' : `Il reste moins de ${nbQuestions} questions`} -

)} @@ -46,13 +51,3 @@ export default class ProgressTip extends Component { ) } } - -let ProgressBar = ({ foldedSteps, nbQuestions, colour }) => ( - -) diff --git a/source/components/conversation/FormDecorator.js b/source/components/conversation/FormDecorator.js index f477c6c2c..69dac8ee2 100644 --- a/source/components/conversation/FormDecorator.js +++ b/source/components/conversation/FormDecorator.js @@ -25,7 +25,7 @@ export var FormDecorator = formType => RenderField => formValueSelector('conversation')(state, 'inversions.' + dottedName) }), dispatch => ({ - stepAction: (name, step) => dispatch(stepAction(name, step)), + stepAction: (name, step, source) => dispatch(stepAction(name, step, source)), setFormValue: (field, value) => dispatch(change('conversation', field, value)) }) @@ -75,11 +75,11 @@ export var FormDecorator = formType => RenderField => props passées à ce dernier, car React 15.2 n'aime pas les attributes inconnus des balises html, dans notre cas. */ - let submit = () => setTimeout(() => stepAction('fold', fieldName), 1), + //TODO hack, enables redux-form/CHANGE to update the form state before the traverse functions are run + let submit = (cause) => setTimeout(() => stepAction('fold', fieldName, cause), 1), stepProps = { ...this.props.step, inverted, - //TODO hack, enables redux-form/CHANGE to update the form state before the traverse functions are run submit, setFormValue: (value, name = fieldName) => setFormValue(name, value) } @@ -121,7 +121,7 @@ export var FormDecorator = formType => RenderField => { setFormValue(fieldName, '' + defaultValue) - submit() + submit('ignore') }} /> )} @@ -159,7 +159,7 @@ export var FormDecorator = formType => RenderField =>