import React from 'react'; import {useDispatch, useSelector} from "react-redux"; import {AppDispatch, RootState} from "../store/store"; import {EEvolveRunningState, startEvolve, stopEvolve} from "../store/settingsSlice"; const MainControls: React.FC = () => { const evolveRunningState = useSelector((state: RootState) => state.settings.evolveRunningState); const changedSettings = useSelector((state: RootState) => state.settings.changedSettings); const dispatch = useDispatch(); const dispatchStopEvolving = () => { dispatch(stopEvolve()); }; const hasChangedSettings = (changedSettings.length && evolveRunningState === EEvolveRunningState.Running); const evolveRunningStateElement = (
Running state:
{evolveRunningState === EEvolveRunningState.Running ? : null} {evolveRunningState} {hasChangedSettings ? : null}
) return (
{evolveRunningStateElement}
) }; export default MainControls;