import { goToQuestion, hideControl } from 'Actions/actions' import { makeJsx } from 'Engine/evaluation' import { createMarkdownDiv } from 'Engine/marked' import { compose } from 'ramda' import React from 'react' import emoji from 'react-easy-emoji' import { withTranslation } from 'react-i18next' import { connect } from 'react-redux' import { analysisWithDefaultsSelector } from 'Selectors/analyseSelectors' import animate from 'Ui/animate' import './Controls.css' import withColours from './utils/withColours' function Controls({ controls, goToQuestion, hideControl, foldedSteps, hiddenControls, t, inversionFail }) { if (!controls) { return null } let messages = [ ...controls, ...(inversionFail ? [ { message: t([ 'simulateurs.inversionFail', 'Le montant saisi est trop faible ou aboutit à une situation impossible, essayez en un autre' ]), level: 'avertissement' } ] : []) ] if (!messages?.length) return null return (
) } export default compose( connect( (state, props) => ({ foldedSteps: state.conversationSteps.foldedSteps, controls: analysisWithDefaultsSelector(state)?.controls, inversionFail: analysisWithDefaultsSelector(state)?.cache?.inversionFail, key: props.language, hiddenControls: state.simulation.hiddenControls }), { goToQuestion, hideControl } ), withColours, withTranslation() )(Controls)