import React, { Component } from "react"; import PropTypes from "prop-types"; import { connect } from "react-redux"; import Dialog from "./Dialog"; import { withStyles } from "@material-ui/core/styles"; import * as Blockly from "blockly"; import { IconButton, Grid, Avatar, Typography } from "@material-ui/core"; import { setBoard } from "../actions/boardAction"; const styles = (theme) => ({ link: { color: theme.palette.primary.main, textDecoration: "none", "&:hover": { color: theme.palette.primary.main, textDecoration: `underline`, }, }, label: { fontSize: "0.9rem", color: "grey", }, }); class DeviceSeclection extends Component { constructor(props) { super(props); this.state = { open: props.selectedBoard ? false : true, selectedBoard: "", saveSettings: false, }; } toggleDialog = () => { this.props.setBoard(this.state.selectedBoard) }; onChange = (e) => { if (e.target.checked) { this.setState({ saveSettings: true }); } else { this.setState({ saveSettings: false }); } }; onclick = (e, value) => { this.setState({ selectedBoard: value }) this.props.setBoard(value) this.setState({ open: !this.state }); }; render() { return (
this.onclick(e, "mcu")}>

senseBox MCU

{/* this.onclick(e, "esp")}>

Sensebox ESP

*/} this.onclick(e, "mini")}>

senseBox MCU:mini

{Blockly.Msg.deviceselection_footnote} Arduino UNO {Blockly.Msg.deviceselection_footnote_02} senseBox MCU
); } } DeviceSeclection.propTypes = { pageVisits: PropTypes.number.isRequired, }; const mapStateToProps = (state) => ({ pageVisits: state.general.pageVisits, selectedBoard: state.board.board }); export default connect( mapStateToProps, { setBoard } )(withStyles(styles, { withTheme: true })(DeviceSeclection));