rewrite board check

This commit is contained in:
fbruc03 2022-11-15 16:30:13 +01:00
parent 5974608fd8
commit 2de54c0e9b

View File

@ -29,7 +29,7 @@ class DeviceSeclection extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
open: true, open: props.selectedBoard ? false : true,
selectedBoard: "", selectedBoard: "",
saveSettings: false, saveSettings: false,
@ -58,39 +58,34 @@ class DeviceSeclection extends Component {
}; };
render() { render() {
const board = this.props.selectedBoard; return (
if (board) { <Dialog
return null; style={{ zIndex: 9999999 }}
} fullWidth
else { maxWidth={"xl"}
return ( open={this.state.open}
<Dialog title={Blockly.Msg.deviceselection_head}
style={{ zIndex: 9999999 }} content={""}
fullWidth onClick={this.toggleDialog}
maxWidth={"xl"} disabled={this.state.selectedBoard === ""}
open={this.state.open} >
title={Blockly.Msg.deviceselection_head} <div>
content={""} <Grid container spacing={2} style={{ textAlign: "center" }}>
onClick={this.toggleDialog} <Grid item xs={6}>
disabled={this.state.selectedBoard === ""} <IconButton onClick={(e) => this.onclick(e, "mcu")}>
> <Avatar
<div> alt="Sensebox MCU"
<Grid container spacing={2} style={{ textAlign: "center" }}> src="/media/hardware/senseboxmcu.png"
<Grid item xs={6}> style={{
<IconButton onClick={(e) => this.onclick(e, "mcu")}> border: this.state.selectedBoard === "mcu" ? 'medium solid DeepSkyBlue' : "0.1px solid lightgray",
<Avatar width: "20vw",
alt="Sensebox MCU" height: "20vw"
src="/media/hardware/senseboxmcu.png" }}
style={{ />
border: this.state.selectedBoard === "mcu" ? 'medium solid DeepSkyBlue' : "0.1px solid lightgray", </IconButton>
width: "20vw", <p>senseBox MCU</p>
height: "20vw" </Grid>
}} {/* <Grid item xs={4}>
/>
</IconButton>
<p>senseBox MCU</p>
</Grid>
{/* <Grid item xs={4}>
<IconButton onClick={(e) => this.onclick(e, "esp")}> <IconButton onClick={(e) => this.onclick(e, "esp")}>
<Avatar <Avatar
alt="Sensebox ESP" alt="Sensebox ESP"
@ -104,23 +99,23 @@ class DeviceSeclection extends Component {
</IconButton> </IconButton>
<p>Sensebox ESP</p> <p>Sensebox ESP</p>
</Grid> */} </Grid> */}
<Grid item xs={6}> <Grid item xs={6}>
<IconButton onClick={(e) => this.onclick(e, "mini")}> <IconButton onClick={(e) => this.onclick(e, "mini")}>
<Avatar <Avatar
alt="Sensebox Mini" alt="Sensebox Mini"
src="/media/hardware/senseboxmcumini.png" src="/media/hardware/senseboxmcumini.png"
style={{ style={{
border: this.state.selectedBoard === "mini" ? 'medium solid DeepSkyBlue' : "0.1px solid lightgray", border: this.state.selectedBoard === "mini" ? 'medium solid DeepSkyBlue' : "0.1px solid lightgray",
width: "20vw", width: "20vw",
height: "20vw" height: "20vw"
}} }}
/> />
</IconButton> </IconButton>
<p>senseBox MCU:mini</p> <p>senseBox MCU:mini</p>
</Grid>
</Grid> </Grid>
</div> </Grid>
{/* <FormControlLabel </div>
{/* <FormControlLabel
style={{ marginTop: "20px" }} style={{ marginTop: "20px" }}
classes={{ label: this.props.classes.label }} classes={{ label: this.props.classes.label }}
control={ control={
@ -135,12 +130,11 @@ class DeviceSeclection extends Component {
} }
label={Blockly.Msg.deviceselection_keep_selection} label={Blockly.Msg.deviceselection_keep_selection}
/> */} /> */}
<Typography variant="body1" > <Typography variant="body1" >
{Blockly.Msg.deviceselection_footnote} <a href="https://sensebox.github.io/blockly/">Arduino UNO</a> {Blockly.Msg.deviceselection_footnote_02} <a href="https://sensebox-blockly.netlify.app/ardublockly/?board=sensebox-mcu">senseBox MCU</a> {Blockly.Msg.deviceselection_footnote} <a href="https://sensebox.github.io/blockly/">Arduino UNO</a> {Blockly.Msg.deviceselection_footnote_02} <a href="https://sensebox-blockly.netlify.app/ardublockly/?board=sensebox-mcu">senseBox MCU</a>
</Typography> </Typography>
</Dialog> </Dialog>
); );
}
} }
} }