diff --git a/source/actions.js b/source/actions.js
index 1d4466155..997c0fc87 100644
--- a/source/actions.js
+++ b/source/actions.js
@@ -1,5 +1,8 @@
/* @flow */
-import type { ResetSimulationAction } from './types/Actions'
+import type {
+ ResetSimulationAction,
+ LoadPreviousSimulationAction
+} from './types/Actions'
// The input "conversation" is composed of "steps"
// The state keeps track of which of them have been submitted
@@ -26,6 +29,11 @@ export const START_CONVERSATION = 'START_CONVERSATION'
export const CHANGE_THEME_COLOUR = 'CHANGE_THEME_COLOUR'
+export function loadPreviousSimulation(): LoadPreviousSimulationAction {
+ return {
+ type: 'LOAD_PREVIOUS_SIMULATION'
+ }
+}
// $FlowFixMe
export function changeThemeColour(colour) {
return { type: CHANGE_THEME_COLOUR, colour }
diff --git a/source/components/News.css b/source/components/Banner.css
similarity index 68%
rename from source/components/News.css
rename to source/components/Banner.css
index 06b5dc9fa..ac14b659b 100644
--- a/source/components/News.css
+++ b/source/components/Banner.css
@@ -1,17 +1,19 @@
-.news-header {
+.banner {
display: flex;
align-items: center;
- max-width: 30em;
margin: 0 auto;
+ margin-top: 1em;
+ width: 40em;
justify-content: center;
- animation: fade-in 2s;
+ animation: fade-in 1s;
}
-.news-header p {
+.banner p {
+ text-align: center;
color: #4b4b66;
font-size: 85%;
}
-.news-header i {
+.banner i {
margin-right: 1em;
}
diff --git a/source/components/Banner.js b/source/components/Banner.js
new file mode 100644
index 000000000..b974289c0
--- /dev/null
+++ b/source/components/Banner.js
@@ -0,0 +1,48 @@
+/* @flow */
+
+import React from 'react'
+import type { Node } from 'react'
+import { connect } from 'react-redux'
+import { compose } from 'ramda'
+import withColours from './withColours'
+import './Banner.css'
+import type { State } from '../types/State'
+
+type PropTypes = {
+ hidden: boolean,
+ fontAwesomeIcon: string,
+ children: Node
+}
+
+type ConnectedPropTypes = PropTypes & {
+ colours: { textColourOnWhite: string }
+}
+
+let Banner = ({
+ hidden,
+ fontAwesomeIcon,
+ colours: { textColourOnWhite },
+ children
+}: ConnectedPropTypes) =>
+ !hidden ? (
+
+ ) : null
+
+export default compose(
+ withColours,
+ connect(
+ (state: State, { hidden }: PropTypes) => ({
+ hidden: hidden || state.conversationStarted
+ }),
+ {}
+ )
+)(Banner)
diff --git a/source/components/News.js b/source/components/News.js
deleted file mode 100644
index 6f5b15a78..000000000
--- a/source/components/News.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import React from 'react'
-import { connect } from 'react-redux'
-import { compose } from 'ramda'
-import withColours from './withColours'
-import { Trans, translate } from 'react-i18next'
-import './News.css'
-
-let News = ({ hidden, colours: { textColourOnWhite } }) =>
- !hidden ? (
-
-
-
-
- Le simulateur vous propose désormais une estimation instantanée !
-
-
-
- ) : null
-
-export default compose(
- withColours,
- translate(),
- connect(state => ({
- hidden: state.conversationStarted
- }))
-)(News)
diff --git a/source/components/PreviousSimulationBanner.js b/source/components/PreviousSimulationBanner.js
new file mode 100644
index 000000000..3ced8149b
--- /dev/null
+++ b/source/components/PreviousSimulationBanner.js
@@ -0,0 +1,33 @@
+/* @flow */
+import React from 'react'
+import type { SavedSimulation } from '../types/State'
+import { loadPreviousSimulation } from '../actions'
+import Banner from './Banner'
+import { connect } from 'react-redux'
+import { Trans } from 'react-i18next'
+
+type ConnectedPropTypes = {
+ previousSimulation: SavedSimulation,
+ loadPreviousSimulation: () => void
+}
+const PreviousSimulationBanner = ({
+ previousSimulation,
+ loadPreviousSimulation
+}: ConnectedPropTypes) => (
+
+
+ Votre précédente simulation a été automatiquement sauvegardée.
+
+
+
+)
+
+export default connect(({ previousSimulation }) => ({ previousSimulation }), {
+ loadPreviousSimulation
+})(PreviousSimulationBanner)
diff --git a/source/components/Simu.css b/source/components/Simu.css
index c13e0b010..3455b2195 100644
--- a/source/components/Simu.css
+++ b/source/components/Simu.css
@@ -1,7 +1,5 @@
#simu {
margin: 0 auto;
+ margin-top: 1em;
max-width: 40em;
}
-
-#focusZone {
-}
diff --git a/source/components/conversation/Conversation.js b/source/components/conversation/Conversation.js
index 333ddc876..5f6d3b74f 100644
--- a/source/components/conversation/Conversation.js
+++ b/source/components/conversation/Conversation.js
@@ -2,7 +2,7 @@ import React, { Component } from 'react'
import { translate } from 'react-i18next'
import { pick } from 'ramda'
import Aide from '../Aide'
-import { reduxForm, reset } from 'redux-form'
+import { reduxForm } from 'redux-form'
import { getInputComponent } from 'Engine/generateQuestions'
import { connect } from 'react-redux'
import './conversation.css'
@@ -24,13 +24,7 @@ import './conversation.css'
'analysis',
'flatRules',
'conversationStarted'
- ]),
- dispatch => ({
- reinitialise: () => {
- dispatch(reset('conversation'))
- dispatch({ type: 'SET_CONVERSATION_TARGETS', reset: true })
- }
- })
+ ])
)
export default class Conversation extends Component {
render() {
diff --git a/source/components/conversation/FoldedSteps.js b/source/components/conversation/FoldedSteps.js
index f9445788a..d2a9444ff 100644
--- a/source/components/conversation/FoldedSteps.js
+++ b/source/components/conversation/FoldedSteps.js
@@ -30,8 +30,8 @@ import { scroller, Element, animateScroll } from 'react-scroll'
@translate()
export default class FoldedSteps extends Component {
handleSimulationReset = () => {
- this.props.resetForm()
this.props.resetSimulation()
+ this.props.resetForm()
}
render() {
let {
@@ -97,8 +97,8 @@ export class GoToAnswers extends Component {