import React from 'react' import './Controls.css' import emoji from 'react-easy-emoji' import { connect } from 'react-redux' import { startConversation } from 'Actions/actions' import { animated, Spring } from 'react-spring' import { makeJsx } from 'Engine/evaluation' import { createMarkdownDiv } from 'Engine/marked' import { currentQuestionSelector } from '../selectors/analyseSelectors' import { reject } from 'ramda' function Controls({ blockingInputControls, controls, startConversation, currentQuestion, foldedSteps }) { let control = !blockingInputControls && do { let relevantControls = reject( c => c.isInputControl && c.dottedName !== currentQuestion )(controls) relevantControls[0] } return (
{blockingInputControls && (

{blockingInputControls[0].message}

)} {styles => !control ? null : (
{do { let { level, message, solution, evaluated } = control ;<>

{level === 'avertissement' ? 'Attention' : 'Information'}

{message && createMarkdownDiv(message)} {!message && (
{makeJsx(evaluated)}
)} {solution && !foldedSteps.includes(solution.cible) && (
{emoji('💡')}
)} }}
) }
) } export default connect( (state, props) => ({ currentQuestion: currentQuestionSelector(state), foldedSteps: state.conversationSteps.foldedSteps, key: props.language }), { startConversation } )(Controls)