import React, { Component } from "react"; import PropTypes from "prop-types"; import { connect } from "react-redux"; import { setSounds } from "../../actions/generalActions"; import * as Blockly from "blockly/core"; import InputLabel from "@material-ui/core/InputLabel"; import MenuItem from "@material-ui/core/MenuItem"; import FormControl from "@material-ui/core/FormControl"; import Select from "@material-ui/core/Select"; import Typography from "@material-ui/core/Typography"; import FormHelperText from "@material-ui/core/FormHelperText"; class SoundsSelector extends Component { componentDidMount() { // Ensure that Blockly.setLocale is adopted in the component. // Otherwise, the text will not be displayed until the next update of the component. this.forceUpdate(); } render() { return (
{Blockly.Msg.settings_sounds} {Blockly.Msg.settings_sounds_text} {Blockly.Msg.settings_sounds}
); } } SoundsSelector.propTypes = { setSounds: PropTypes.func.isRequired, language: PropTypes.string.isRequired, sounds: PropTypes.string.isRequired, }; const mapStateToProps = (state) => ({ sounds: state.general.sounds, language: state.general.language, }); export default connect(mapStateToProps, { setSounds })(SoundsSelector);