Merge branch 'development' into development-featSensorWiki
This commit is contained in:
		
						commit
						564dcc4d4a
					
				@ -1,10 +1,15 @@
 | 
				
			|||||||
import {
 | 
					import {
 | 
				
			||||||
    BOARD,
 | 
					  BOARD,
 | 
				
			||||||
  } from "./types";
 | 
					} from "./types";
 | 
				
			||||||
 | 
					import mini_opacity from "../data/mini_opacity.png"
 | 
				
			||||||
 | 
					import mcu_opacity from "../data/mcu_opacity.png"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const setBoard = (board) => (dispatch) => {
 | 
					export const setBoard = (board) => (dispatch) => {
 | 
				
			||||||
    dispatch({
 | 
					  window.sessionStorage.setItem("board", board);
 | 
				
			||||||
      type: BOARD,
 | 
					  const root = document.querySelector(':root');
 | 
				
			||||||
      payload: board,
 | 
					  root.style.setProperty('--url', `url(${board === "mcu" ? mcu_opacity : mini_opacity})`);
 | 
				
			||||||
    });
 | 
					  dispatch({
 | 
				
			||||||
  };
 | 
					    type: BOARD,
 | 
				
			||||||
 | 
					    payload: board,
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@ -11,6 +11,7 @@ import Sidebar from "./Sidebar";
 | 
				
			|||||||
import Dialog from "../Dialog";
 | 
					import Dialog from "../Dialog";
 | 
				
			||||||
import SaveIcon from "./SaveIcon";
 | 
					import SaveIcon from "./SaveIcon";
 | 
				
			||||||
import store from "../../store";
 | 
					import store from "../../store";
 | 
				
			||||||
 | 
					import DeviceSelection from "../DeviceSelection";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const CodeEditor = (props) => {
 | 
					const CodeEditor = (props) => {
 | 
				
			||||||
  //const [filehandle, setFileHandle] = useState();
 | 
					  //const [filehandle, setFileHandle] = useState();
 | 
				
			||||||
@ -192,6 +193,7 @@ void loop() {
 | 
				
			|||||||
            }}
 | 
					            }}
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
        </Grid>
 | 
					        </Grid>
 | 
				
			||||||
 | 
					        <DeviceSelection />
 | 
				
			||||||
        <Grid item lg={4} md={4}>
 | 
					        <Grid item lg={4} md={4}>
 | 
				
			||||||
          <Button
 | 
					          <Button
 | 
				
			||||||
            style={{ padding: "1rem", margin: "1rem" }}
 | 
					            style={{ padding: "1rem", margin: "1rem" }}
 | 
				
			||||||
 | 
				
			|||||||
@ -7,8 +7,6 @@ import { withStyles } from "@material-ui/core/styles";
 | 
				
			|||||||
import * as Blockly from "blockly";
 | 
					import * as Blockly from "blockly";
 | 
				
			||||||
import { IconButton, Grid, Avatar, Typography } from "@material-ui/core";
 | 
					import { IconButton, Grid, Avatar, Typography } from "@material-ui/core";
 | 
				
			||||||
import { setBoard } from "../actions/boardAction";
 | 
					import { setBoard } from "../actions/boardAction";
 | 
				
			||||||
import mini_opacity from "../data/mini_opacity.png"
 | 
					 | 
				
			||||||
import mcu_opacity from "../data/mcu_opacity.png"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const styles = (theme) => ({
 | 
					const styles = (theme) => ({
 | 
				
			||||||
  link: {
 | 
					  link: {
 | 
				
			||||||
@ -29,7 +27,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,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -37,9 +35,7 @@ class DeviceSeclection extends Component {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  toggleDialog = () => {
 | 
					  toggleDialog = () => {
 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.props.setBoard(this.state.selectedBoard)
 | 
					    this.props.setBoard(this.state.selectedBoard)
 | 
				
			||||||
 | 
					 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onChange = (e) => {
 | 
					  onChange = (e) => {
 | 
				
			||||||
@ -51,14 +47,9 @@ class DeviceSeclection extends Component {
 | 
				
			|||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onclick = (e, value) => {
 | 
					  onclick = (e, value) => {
 | 
				
			||||||
    const root = document.querySelector(':root');
 | 
					 | 
				
			||||||
    root.style.setProperty('--url', `url(${value === "mcu" ? mcu_opacity : mini_opacity})`);
 | 
					 | 
				
			||||||
    this.setState({ selectedBoard: value })
 | 
					    this.setState({ selectedBoard: value })
 | 
				
			||||||
    this.props.setBoard(value)
 | 
					    this.props.setBoard(value)
 | 
				
			||||||
    this.setState({ open: !this.state });
 | 
					    this.setState({ open: !this.state });
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  render() {
 | 
					  render() {
 | 
				
			||||||
@ -89,7 +80,6 @@ class DeviceSeclection extends Component {
 | 
				
			|||||||
              </IconButton>
 | 
					              </IconButton>
 | 
				
			||||||
              <p>senseBox MCU</p>
 | 
					              <p>senseBox MCU</p>
 | 
				
			||||||
            </Grid>
 | 
					            </Grid>
 | 
				
			||||||
 | 
					 | 
				
			||||||
            {/* <Grid item xs={4}>
 | 
					            {/* <Grid item xs={4}>
 | 
				
			||||||
            <IconButton onClick={(e) => this.onclick(e, "esp")}>
 | 
					            <IconButton onClick={(e) => this.onclick(e, "esp")}>
 | 
				
			||||||
              <Avatar
 | 
					              <Avatar
 | 
				
			||||||
@ -99,7 +89,7 @@ class DeviceSeclection extends Component {
 | 
				
			|||||||
                  border: this.state.selectedBoard == "esp" ? 'medium solid DeepSkyBlue': "0.1px solid lightgray",
 | 
					                  border: this.state.selectedBoard == "esp" ? 'medium solid DeepSkyBlue': "0.1px solid lightgray",
 | 
				
			||||||
                  width:"20vw",
 | 
					                  width:"20vw",
 | 
				
			||||||
                  height: "20vw"
 | 
					                  height: "20vw"
 | 
				
			||||||
               }}
 | 
					              }}
 | 
				
			||||||
              />
 | 
					              />
 | 
				
			||||||
              </IconButton>
 | 
					              </IconButton>
 | 
				
			||||||
              <p>Sensebox ESP</p>
 | 
					              <p>Sensebox ESP</p>
 | 
				
			||||||
@ -120,21 +110,6 @@ class DeviceSeclection extends Component {
 | 
				
			|||||||
            </Grid>
 | 
					            </Grid>
 | 
				
			||||||
          </Grid>
 | 
					          </Grid>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        {/* <FormControlLabel
 | 
					 | 
				
			||||||
          style={{ marginTop: "20px" }}
 | 
					 | 
				
			||||||
          classes={{ label: this.props.classes.label }}
 | 
					 | 
				
			||||||
          control={
 | 
					 | 
				
			||||||
            <Checkbox
 | 
					 | 
				
			||||||
              size={"small"}
 | 
					 | 
				
			||||||
              value={true}
 | 
					 | 
				
			||||||
              checked={this.state.checked}
 | 
					 | 
				
			||||||
              onChange={(e) => this.onChange(e)}
 | 
					 | 
				
			||||||
              name="dialog"
 | 
					 | 
				
			||||||
              color="primary"
 | 
					 | 
				
			||||||
            />
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          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>
 | 
				
			||||||
 | 
				
			|||||||
@ -18,6 +18,7 @@ import Divider from "@material-ui/core/Divider";
 | 
				
			|||||||
import Typography from "@material-ui/core/Typography";
 | 
					import Typography from "@material-ui/core/Typography";
 | 
				
			||||||
import Backdrop from "@material-ui/core/Backdrop";
 | 
					import Backdrop from "@material-ui/core/Backdrop";
 | 
				
			||||||
import CircularProgress from "@material-ui/core/CircularProgress";
 | 
					import CircularProgress from "@material-ui/core/CircularProgress";
 | 
				
			||||||
 | 
					import DeviceSelection from "../DeviceSelection";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const styles = (theme) => ({
 | 
					const styles = (theme) => ({
 | 
				
			||||||
  link: {
 | 
					  link: {
 | 
				
			||||||
@ -60,9 +61,8 @@ class ProjectHome extends Component {
 | 
				
			|||||||
        this.setState({
 | 
					        this.setState({
 | 
				
			||||||
          snackbar: true,
 | 
					          snackbar: true,
 | 
				
			||||||
          key: Date.now(),
 | 
					          key: Date.now(),
 | 
				
			||||||
          message: `Dein angefragtes ${
 | 
					          message: `Dein angefragtes ${type === "gallery" ? "Galerie-" : ""
 | 
				
			||||||
            type === "gallery" ? "Galerie-" : ""
 | 
					            }Projekt konnte nicht gefunden werden.`,
 | 
				
			||||||
          }Projekt konnte nicht gefunden werden.`,
 | 
					 | 
				
			||||||
          type: "error",
 | 
					          type: "error",
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -108,6 +108,7 @@ class ProjectHome extends Component {
 | 
				
			|||||||
        />
 | 
					        />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <h1>{data}</h1>
 | 
					        <h1>{data}</h1>
 | 
				
			||||||
 | 
					        <DeviceSelection />
 | 
				
			||||||
        {this.props.progress ? (
 | 
					        {this.props.progress ? (
 | 
				
			||||||
          <Backdrop open invisible>
 | 
					          <Backdrop open invisible>
 | 
				
			||||||
            <CircularProgress color="primary" />
 | 
					            <CircularProgress color="primary" />
 | 
				
			||||||
@ -127,9 +128,8 @@ class ProjectHome extends Component {
 | 
				
			|||||||
                        }}
 | 
					                        }}
 | 
				
			||||||
                      >
 | 
					                      >
 | 
				
			||||||
                        <Link
 | 
					                        <Link
 | 
				
			||||||
                          to={`/${
 | 
					                          to={`/${data === "Projekte" ? "project" : "gallery"
 | 
				
			||||||
                            data === "Projekte" ? "project" : "gallery"
 | 
					                            }/${project._id}`}
 | 
				
			||||||
                          }/${project._id}`}
 | 
					 | 
				
			||||||
                          style={{ textDecoration: "none", color: "inherit" }}
 | 
					                          style={{ textDecoration: "none", color: "inherit" }}
 | 
				
			||||||
                        >
 | 
					                        >
 | 
				
			||||||
                          <h3 style={{ marginTop: 0 }}>{project.title}</h3>
 | 
					                          <h3 style={{ marginTop: 0 }}>{project.title}</h3>
 | 
				
			||||||
@ -153,7 +153,7 @@ class ProjectHome extends Component {
 | 
				
			|||||||
                          </Typography>
 | 
					                          </Typography>
 | 
				
			||||||
                        </Link>
 | 
					                        </Link>
 | 
				
			||||||
                        {this.props.user &&
 | 
					                        {this.props.user &&
 | 
				
			||||||
                        this.props.user.email === project.creator ? (
 | 
					                          this.props.user.email === project.creator ? (
 | 
				
			||||||
                          <div>
 | 
					                          <div>
 | 
				
			||||||
                            <Divider
 | 
					                            <Divider
 | 
				
			||||||
                              style={{
 | 
					                              style={{
 | 
				
			||||||
 | 
				
			|||||||
@ -37,6 +37,7 @@ import Tooltip from "@material-ui/core/Tooltip";
 | 
				
			|||||||
import IconButton from "@material-ui/core/IconButton";
 | 
					import IconButton from "@material-ui/core/IconButton";
 | 
				
			||||||
import Snackbar from "../Snackbar";
 | 
					import Snackbar from "../Snackbar";
 | 
				
			||||||
import Divider from "@material-ui/core/Divider";
 | 
					import Divider from "@material-ui/core/Divider";
 | 
				
			||||||
 | 
					import DeviceSelection from "../DeviceSelection";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const styles = (theme) => ({
 | 
					const styles = (theme) => ({
 | 
				
			||||||
  outerDiv: {
 | 
					  outerDiv: {
 | 
				
			||||||
@ -243,14 +244,11 @@ class TutorialHome extends Component {
 | 
				
			|||||||
                            cy="50%"
 | 
					                            cy="50%"
 | 
				
			||||||
                            fill="none"
 | 
					                            fill="none"
 | 
				
			||||||
                            stroke-width="10"
 | 
					                            stroke-width="10"
 | 
				
			||||||
                            stroke-dashoffset={`${
 | 
					                            stroke-dashoffset={`${75 * 2 * Math.PI * (1 - (50 / 100 + success / 2))
 | 
				
			||||||
                              75 * 2 * Math.PI * (1 - (50 / 100 + success / 2))
 | 
					                              }`}
 | 
				
			||||||
                            }`}
 | 
					                            stroke-dasharray={`${75 * 2 * Math.PI * (1 - (50 / 100 - success / 2))
 | 
				
			||||||
                            stroke-dasharray={`${
 | 
					                              } ${75 * 2 * Math.PI * (1 - (50 / 100 + success / 2))
 | 
				
			||||||
                              75 * 2 * Math.PI * (1 - (50 / 100 - success / 2))
 | 
					                              }`}
 | 
				
			||||||
                            } ${
 | 
					 | 
				
			||||||
                              75 * 2 * Math.PI * (1 - (50 / 100 + success / 2))
 | 
					 | 
				
			||||||
                            }`}
 | 
					 | 
				
			||||||
                          ></circle>
 | 
					                          ></circle>
 | 
				
			||||||
                        )}
 | 
					                        )}
 | 
				
			||||||
                        {success < 1 && !error ? (
 | 
					                        {success < 1 && !error ? (
 | 
				
			||||||
@ -265,9 +263,8 @@ class TutorialHome extends Component {
 | 
				
			|||||||
                            cy="50%"
 | 
					                            cy="50%"
 | 
				
			||||||
                            fill="none"
 | 
					                            fill="none"
 | 
				
			||||||
                            stroke-width="10"
 | 
					                            stroke-width="10"
 | 
				
			||||||
                            stroke-dashoffset={`${
 | 
					                            stroke-dashoffset={`${75 * 2 * Math.PI * (1 - (50 / 100 + success / 2))
 | 
				
			||||||
                              75 * 2 * Math.PI * (1 - (50 / 100 + success / 2))
 | 
					                              }`}
 | 
				
			||||||
                            }`}
 | 
					 | 
				
			||||||
                            stroke-dasharray={`${75 * 2 * Math.PI}`}
 | 
					                            stroke-dasharray={`${75 * 2 * Math.PI}`}
 | 
				
			||||||
                          ></circle>
 | 
					                          ></circle>
 | 
				
			||||||
                        ) : null}
 | 
					                        ) : null}
 | 
				
			||||||
@ -279,8 +276,8 @@ class TutorialHome extends Component {
 | 
				
			|||||||
                        tutorialStatus === "Error"
 | 
					                        tutorialStatus === "Error"
 | 
				
			||||||
                          ? this.props.classes.outerDivError
 | 
					                          ? this.props.classes.outerDivError
 | 
				
			||||||
                          : tutorialStatus === "Success"
 | 
					                          : tutorialStatus === "Success"
 | 
				
			||||||
                          ? this.props.classes.outerDivSuccess
 | 
					                            ? this.props.classes.outerDivSuccess
 | 
				
			||||||
                          : null
 | 
					                            : null
 | 
				
			||||||
                      )}
 | 
					                      )}
 | 
				
			||||||
                    >
 | 
					                    >
 | 
				
			||||||
                      <div className={this.props.classes.innerDiv}>
 | 
					                      <div className={this.props.classes.innerDiv}>
 | 
				
			||||||
@ -311,6 +308,7 @@ class TutorialHome extends Component {
 | 
				
			|||||||
            );
 | 
					            );
 | 
				
			||||||
          })}
 | 
					          })}
 | 
				
			||||||
        </Grid>
 | 
					        </Grid>
 | 
				
			||||||
 | 
					        <DeviceSelection />
 | 
				
			||||||
        {this.props.user ? (
 | 
					        {this.props.user ? (
 | 
				
			||||||
          <div>
 | 
					          <div>
 | 
				
			||||||
            <h2>User Tutorials</h2>
 | 
					            <h2>User Tutorials</h2>
 | 
				
			||||||
 | 
				
			|||||||
@ -15,11 +15,13 @@ const compareNumberOfBlocks = (originalBlocks, userBlocks) => {
 | 
				
			|||||||
    var blocks;
 | 
					    var blocks;
 | 
				
			||||||
    if(originalBlocks.length > userBlocks.length){
 | 
					    if(originalBlocks.length > userBlocks.length){
 | 
				
			||||||
      blocks = originalBlocks.length-userBlocks.length;
 | 
					      blocks = originalBlocks.length-userBlocks.length;
 | 
				
			||||||
      return {text: `Es wurde${blocks === 1 ? '' : 'n'} ${blocks} Bl${blocks === 1 ? 'ock' : 'öcke'} zu wenig verwendet.`, type: 'error'};
 | 
					      //return {text: `Es wurde${blocks === 1 ? '' : 'n'} ${blocks} Bl${blocks === 1 ? 'ock' : 'öcke'} zu wenig verwendet.`, type: 'error'};
 | 
				
			||||||
 | 
					      return {text: `Du kannst deinen Programmcode kompilieren, aber es wurde${blocks === 1 ? '' : 'n'} ${blocks} Bl${blocks === 1 ? 'ock' : 'öcke'} weniger verwendet als in der hinterlegten Lösung.`, type: 'success'};
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
      blocks = userBlocks.length-originalBlocks.length;
 | 
					      blocks = userBlocks.length-originalBlocks.length;
 | 
				
			||||||
      return {text: `Es wurde${blocks === 1 ? '' : 'n'} ${blocks} Bl${blocks === 1 ? 'ock' : 'öcke'} zu viel verwendet.`, type: 'error'};
 | 
					      //return {text: `Es wurde${blocks === 1 ? '' : 'n'} ${blocks} Bl${blocks === 1 ? 'ock' : 'öcke'} zu viel verwendet.`, type: 'error'};
 | 
				
			||||||
 | 
					      return {text: `Du kannst deinen Programmcode kompilieren, aber es wurde${blocks === 1 ? '' : 'n'} ${blocks} Bl${blocks === 1 ? 'ock' : 'öcke'} mehr verwendet als in der hinterlegten Lösung.`, type: 'success'};
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -1,12 +1,20 @@
 | 
				
			|||||||
import { BOARD } from '../actions/types';
 | 
					import { BOARD } from '../actions/types';
 | 
				
			||||||
 | 
					import mini_opacity from "../data/mini_opacity.png"
 | 
				
			||||||
 | 
					import mcu_opacity from "../data/mcu_opacity.png"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const initialValue = () => {
 | 
					const initialValue = () => {
 | 
				
			||||||
  if (window.localStorage.getItem("board")) {
 | 
					  if (window.sessionStorage.getItem("board")) {
 | 
				
			||||||
    return window.localStorage.getItem("board");
 | 
					    setBackgroundImage(window.sessionStorage.getItem("board"));
 | 
				
			||||||
 | 
					    return window.sessionStorage.getItem("board");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return "bla";
 | 
					  return null;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const setBackgroundImage = (board) => {
 | 
				
			||||||
 | 
					  const root = document.querySelector(':root');
 | 
				
			||||||
 | 
					  root.style.setProperty('--url', `url(${board === "mcu" ? mcu_opacity : mini_opacity})`);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const initialState = {
 | 
					const initialState = {
 | 
				
			||||||
    board: initialValue()
 | 
					    board: initialValue()
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user