From 1de78d28e81cb962162034ac011e6f3f5a1cde01 Mon Sep 17 00:00:00 2001 From: mama Date: Tue, 5 Dec 2017 12:58:24 +0100 Subject: [PATCH] =?UTF-8?q?Maquette=20de=20la=20nouvelle=20navigation=20pa?= =?UTF-8?q?r=20d=C3=A9filement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/ProgressTip.css | 12 ++ source/components/ProgressTip.js | 46 ++++++ source/components/Results.css | 16 +- source/components/Results.js | 123 ++++++++-------- source/components/ResultsGrid.css | 3 + source/components/ResultsGrid.js | 2 +- source/components/Simulateur.css | 17 +-- .../components/conversation/Conversation.js | 137 ++++++++---------- .../components/conversation/conversation.css | 14 +- source/containers/Layout.js | 92 +++++------- 10 files changed, 243 insertions(+), 219 deletions(-) create mode 100644 source/components/ProgressTip.css create mode 100644 source/components/ProgressTip.js create mode 100644 source/components/ResultsGrid.css diff --git a/source/components/ProgressTip.css b/source/components/ProgressTip.css new file mode 100644 index 000000000..53967d0f5 --- /dev/null +++ b/source/components/ProgressTip.css @@ -0,0 +1,12 @@ + +#sim .tip { + font-style: italic; + margin-bottom: .6em; + text-align: center; +} +#sim .tip p { + margin: 0; +} +#sim .tip progress { + margin-left: 1em; +} diff --git a/source/components/ProgressTip.js b/source/components/ProgressTip.js new file mode 100644 index 000000000..77f47077c --- /dev/null +++ b/source/components/ProgressTip.js @@ -0,0 +1,46 @@ +import React, { Component } from 'react' +import { connect } from "react-redux" +import { withRouter } from "react-router" +import './ProgressTip.css' + +@withRouter +@connect(state => ({ + done: state.done, + foldedSteps: state.foldedSteps, + nextSteps: state.nextSteps, +})) +export default class ProgressTip extends Component { + state = { + nbFoldedStepsForFirstEstimation: null + } + componentWillReceiveProps(newProps) { + if (newProps.done && this.state.nbFoldedStepsForFirstEstimation == null) + this.setState({ + nbFoldedStepsForFirstEstimation: newProps.foldedSteps.length + }) + } + render() { + let {done, nextSteps, foldedSteps} = this.props + if (!done) return null + return ( +
+ {nextSteps.length != 0 && + this.state.nbFoldedStepsForFirstEstimation === + foldedSteps.length && ( +

Votre première estimation est disponible !

+ )} + {nextSteps.length != 0 && ( +

+ Il vous reste environ {nextSteps.length}{' '} + {nextSteps.length === 1 ? 'questions' : 'question'} pour + affiner le calcul + +

+ )} +
+ ) + } +} diff --git a/source/components/Results.css b/source/components/Results.css index b2c1c7c1d..1b2e6ecc0 100644 --- a/source/components/Results.css +++ b/source/components/Results.css @@ -1,20 +1,28 @@ -#resultsWrapper { - height: 40%; +#resultsZone { + height: 49%; display: flex; align-items: flex-end; } #results { + width: 100%; +} +#resultsContent { position: relative; margin: 0 auto; - padding: .1em .3em; - width: 95%; + padding: .6em 0; + width: 100%; max-width: 45em; background: #2975D1; color: white; box-shadow: 0px 0px 20px 2px rgba(0, 0, 0, 0.25); } +#results button { + display: block; + margin: 1em auto; +} + #results-actions { background: #333350; } diff --git a/source/components/Results.js b/source/components/Results.js index 58e102d24..5bfc79e2b 100644 --- a/source/components/Results.js +++ b/source/components/Results.js @@ -1,68 +1,71 @@ -import R from 'ramda' -import React, { Component } from 'react' -import classNames from 'classnames' -import {Link} from 'react-router-dom' -import {connect} from 'react-redux' -import { withRouter } from 'react-router' +import R from "ramda" +import React, { Component } from "react" +import classNames from "classnames" +import { Link } from "react-router-dom" +import { connect } from "react-redux" +import { withRouter } from "react-router" -import './Results.css' -import {clearDict} from 'Engine/traverse' -import {encodeRuleName} from 'Engine/rules' -import RuleValueVignette from './rule/RuleValueVignette' +import "./Results.css" +import { clearDict } from "Engine/traverse" +import { encodeRuleName } from "Engine/rules" +import RuleValueVignette from "./rule/RuleValueVignette" +import ProgressTip from "Components/ProgressTip" @withRouter -@connect( - state => ({ - analysis: state.analysis, - targetName: state.targetName, - conversationStarted: !R.isEmpty(state.form), - conversationFirstAnswer: R.path(['form', 'conversation', 'values'])(state), - situationGate: state.situationGate - }) -) +@connect(state => ({ + analysis: state.analysis, + targetName: state.targetName, + conversationStarted: !R.isEmpty(state.form), + conversationFirstAnswer: R.path(["form", "conversation", "values"])(state), + situationGate: state.situationGate, + done: state.done, +})) export default class Results extends Component { - render() { - let { - analysis, - targetName, - conversationStarted, - conversationFirstAnswer, - location - } = this.props + render() { + let { + analysis, + targetName, + conversationStarted, + conversationFirstAnswer, + location, + done + } = this.props - if (!analysis) return null + if (!analysis) return null - let {targets} = analysis + let { targets } = analysis - let onRulePage = R.contains('/regle/')(location.pathname) - return ( -
-
this.el = el} id="results"> - {onRulePage && conversationStarted ? -
- - Reprendre la simulation - -
- :
-

{targets.length == 1 ? 'Votre objectif' : 'Vos objectifs'}

-
- } - -