diff --git a/source/actions.js b/source/actions.js index 314d7d7cb..10614ee63 100644 --- a/source/actions.js +++ b/source/actions.js @@ -4,16 +4,6 @@ import type { LoadPreviousSimulationAction } from './types/Actions' -// The input "conversation" is composed of "steps" -// 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' - -// $FlowFixMe -export function stepAction(name, step, source) { - return { type: STEP_ACTION, name, step, source } -} - export function resetSimulation(): ResetSimulationAction { return { type: 'RESET_SIMULATION' @@ -25,18 +15,10 @@ export function setExample(name, situation, dottedName) { return { type: 'SET_EXAMPLE', name, situation, dottedName } } -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 } -} export const EXPLAIN_VARIABLE = 'EXPLAIN_VARIABLE' diff --git a/source/components/conversation/FoldedStep.js b/source/components/conversation/FoldedStep.js index f5d0e9840..23e717a98 100644 --- a/source/components/conversation/FoldedStep.js +++ b/source/components/conversation/FoldedStep.js @@ -7,7 +7,6 @@ import { flatRulesSelector, validatedSituationSelector } from 'Selectors/analyseSelectors' -import { stepAction } from '../../actions' import { LinkButton } from 'Components/ui/Button' @translate() @@ -17,7 +16,8 @@ import { LinkButton } from 'Components/ui/Button' situation: validatedSituationSelector(state) }), dispatch => ({ - stepAction: (name, step, source) => dispatch(stepAction(name, step, source)) + stepAction: (name, step, source) => + dispatch({ type: 'STEP_ACTION', name, step, source }) }) ) export default class FoldedStep extends React.Component { diff --git a/source/components/conversation/FormDecorator.js b/source/components/conversation/FormDecorator.js index 37a98b521..f32519611 100644 --- a/source/components/conversation/FormDecorator.js +++ b/source/components/conversation/FormDecorator.js @@ -3,7 +3,6 @@ import { translate } from 'react-i18next' import classNames from 'classnames' import { connect } from 'react-redux' import { Field, change } from 'redux-form' -import { stepAction } from '../../actions' import Explicable from 'Components/conversation/Explicable' import IgnoreStepButton from './IgnoreStepButton' @@ -29,7 +28,7 @@ export var FormDecorator = formType => RenderField => }), dispatch => ({ stepAction: (name, step, source) => - dispatch(stepAction(name, step, source)), + dispatch({ type: 'STEP_ACTION', name, step, source }), setFormValue: (field, value) => dispatch(change('conversation', field, value)) }) diff --git a/source/entry-colour-chooser.js b/source/entry-colour-chooser.js index d8266c291..cd3d22102 100644 --- a/source/entry-colour-chooser.js +++ b/source/entry-colour-chooser.js @@ -1,25 +1,23 @@ import 'core-js/fn/promise' -import { rulesFr } from 'Engine/rules' import React from 'react' import { SliderPicker } from 'react-color' import { render } from 'react-dom' import { connect, Provider } from 'react-redux' import { createStore } from 'redux' -import { changeThemeColour } from './actions' -import Layout from './containers/Layout' import reducers from './reducers/reducers' +import Layout from './containers/Layout' let tracker = { push: () => {}, connectToHistory: history => history } -let store = createStore(reducers(rulesFr)) +let store = createStore(reducers) @connect( state => ({ couleur: state.themeColours.colour }), dispatch => ({ - changeColour: colour => dispatch(changeThemeColour(colour)) + changeColour: colour => dispatch({ type: 'CHANGE_THEME_COLOUR', colour }) }) ) class MyComponent extends React.Component {