✨ Seulement les actions en commun dans actions.js
parent
5d857d2dfa
commit
20a21a7f11
|
@ -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'
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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))
|
||||
})
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue