diff --git a/src/actions/generalActions.js b/src/actions/generalActions.js index f4dd22f..346d9f7 100644 --- a/src/actions/generalActions.js +++ b/src/actions/generalActions.js @@ -1,4 +1,11 @@ -import { VISIT, LANGUAGE, RENDERER, STATISTICS, PLATFORM } from "./types"; +import { + VISIT, + LANGUAGE, + RENDERER, + SOUNDS, + STATISTICS, + PLATFORM, +} from "./types"; export const visitPage = () => (dispatch) => { dispatch({ @@ -30,6 +37,13 @@ export const setRenderer = (renderer) => (dispatch) => { }); }; +export const setSounds = (sounds) => (dispatch) => { + dispatch({ + type: SOUNDS, + payload: sounds, + }); +}; + export const setStatistics = (showStatistics) => (dispatch) => { dispatch({ type: STATISTICS, diff --git a/src/actions/types.js b/src/actions/types.js index 223154d..6a10987 100644 --- a/src/actions/types.js +++ b/src/actions/types.js @@ -45,6 +45,7 @@ export const VISIT = "VISIT"; export const LANGUAGE = "LANGUAGE"; export const PLATFORM = "PLATFORM"; export const RENDERER = "RENDERER"; +export const SOUNDS = "SOUNDS"; export const STATISTICS = "STATISTICS"; // messages diff --git a/src/components/Blockly/BlocklyWindow.js b/src/components/Blockly/BlocklyWindow.js index 5580abe..c69fc9d 100644 --- a/src/components/Blockly/BlocklyWindow.js +++ b/src/components/Blockly/BlocklyWindow.js @@ -72,6 +72,7 @@ class BlocklyWindow extends Component { this.props.trashcan !== undefined ? this.props.trashcan : true } renderer={this.props.renderer} + sounds={this.props.sounds} maxInstances={getMaxInstances()} zoom={{ // https://developers.google.com/blockly/guides/configure/web/zoom @@ -123,11 +124,13 @@ BlocklyWindow.propTypes = { onChangeWorkspace: PropTypes.func.isRequired, clearStats: PropTypes.func.isRequired, renderer: PropTypes.string.isRequired, + sounds: PropTypes.string.isRequired, language: PropTypes.string.isRequired, }; const mapStateToProps = (state) => ({ renderer: state.general.renderer, + sounds: state.general.sounds, language: state.general.language, }); diff --git a/src/components/Blockly/generator/sensebox-web.js b/src/components/Blockly/generator/sensebox-web.js index 85fc289..08e19d7 100644 --- a/src/components/Blockly/generator/sensebox-web.js +++ b/src/components/Blockly/generator/sensebox-web.js @@ -6,8 +6,8 @@ Blockly.Arduino.sensebox_wifi = function (block) { var ssid = this.getFieldValue("SSID"); Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include "; Blockly.Arduino.libraries_["library_WiFi"] = "#include "; - Blockly.Arduino.variables_["ssid"] = `char ssid[] = ${ssid};`; - Blockly.Arduino.variables_["pass"] = `char pass[] = ${pw};`; + Blockly.Arduino.variables_["ssid"] = `char ssid[] = "${ssid}";`; + Blockly.Arduino.variables_["pass"] = `char pass[] = "${pw}";`; Blockly.Arduino.variables_["wifi_Status"] = "int status = WL_IDLE_STATUS;"; if (pw === "") { Blockly.Arduino.setupCode_["wifi_begin"] = ` @@ -53,6 +53,7 @@ Blockly.Arduino.sensebox_get_ip = function () { Blockly.Arduino.sensebox_startap = function (block) { var ssid = this.getFieldValue("SSID"); Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include "; + Blockly.Arduino.libraries_["library_WiFi"] = "#include "; Blockly.Arduino.setupCode_["wifi_startAP"] = `WiFi.beginAP(${ssid});`; var code = ""; return code; diff --git a/src/components/Blockly/msg/de/ui.js b/src/components/Blockly/msg/de/ui.js index 545208f..db7da8f 100644 --- a/src/components/Blockly/msg/de/ui.js +++ b/src/components/Blockly/msg/de/ui.js @@ -177,6 +177,9 @@ export const UI = { "Der Tablet Modus deaktiviert die Code anzeige und aktiviert die Möglichkeit den Programmcode über die senseBox Connect App zu übertragen. Weitere Informationen dazu findest du unter: ", settings_ota_on: "Aktiviert", settings_ota_off: "Deaktiviert", + settings_sounds: "Töne", + settings_sounds_text: + "Aktiviere oder Deaktiviere Töne beim hinzufügen und löschen von Blöcken. Standardmäßig deaktiviert", /** * 404 diff --git a/src/components/Blockly/msg/en/ui.js b/src/components/Blockly/msg/en/ui.js index b573b00..79708da 100644 --- a/src/components/Blockly/msg/en/ui.js +++ b/src/components/Blockly/msg/en/ui.js @@ -167,11 +167,14 @@ export const UI = { "The display of statistics on the usage of the blocks above the workspace can be shown or hidden.", settings_statistics_on: "On", settings_statistics_off: "Off", - settings_ota_head: "tablet mode", + settings_ota_head: "Tablet mode", settings_ota_text: "Tablet mode disables the code display and enables the possibility to transfer the program code via the senseBox Connect app. You can find more information on: ", settings_ota_on: "Activated", settings_ota_off: "Deactivated", + settings_sounds: "Sound", + settings_sounds_text: + "Enable or disable sounds when adding and deleting blocks. Disabled by default", /** * 404 diff --git a/src/components/Blockly/toolbox/Toolbox.js b/src/components/Blockly/toolbox/Toolbox.js index 9186bc8..2162019 100644 --- a/src/components/Blockly/toolbox/Toolbox.js +++ b/src/components/Blockly/toolbox/Toolbox.js @@ -601,11 +601,11 @@ class Toolbox extends React.Component { colour={getColour().variables} custom="CREATE_TYPED_VARIABLE" > - + {/* - + */} + + +