Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3cac65b97 | ||
|
|
a969727a48 | ||
|
|
a1167b436b | ||
|
|
7524e78fc6 | ||
|
|
f8cfb6691b | ||
|
|
abce42f764 | ||
|
|
7c60869124 |
@@ -331,6 +331,7 @@ Blockly.Blocks["sensebox_button"] = {
|
||||
[Blockly.Msg.senseBox_button_isPressed, "isPressed"],
|
||||
[Blockly.Msg.senseBox_button_wasPressed, "wasPressed"],
|
||||
[Blockly.Msg.senseBox_button_longPress, "longPress"],
|
||||
[Blockly.Msg.senseBox_button_switch,"toggleButton"]
|
||||
]),
|
||||
"FUNCTION"
|
||||
)
|
||||
|
||||
@@ -7,6 +7,7 @@ import * as Blockly from "blockly/core";
|
||||
* @return {string} Completed code.
|
||||
*/
|
||||
Blockly.Arduino["arduino_functions"] = function (block) {
|
||||
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
|
||||
// Edited version of Blockly.Generator.prototype.statementToCode
|
||||
function statementToCodeNoTab(block, name) {
|
||||
var targetBlock = block.getInputTargetBlock(name);
|
||||
|
||||
@@ -399,6 +399,7 @@ Blockly.Arduino.sensebox_button = function () {
|
||||
Blockly.Arduino.libraries_[
|
||||
"library_jcButtons"
|
||||
] = `#include <JC_Button.h> // http://librarymanager/All#JC_Button`;
|
||||
|
||||
Blockly.Arduino.definitions_["define_button" + dropdown_pin + ""] =
|
||||
"Button button_" + dropdown_pin + "(" + dropdown_pin + ");";
|
||||
Blockly.Arduino.setupCode_["setup_button" + dropdown_pin + ""] =
|
||||
@@ -413,6 +414,10 @@ Blockly.Arduino.sensebox_button = function () {
|
||||
} else if (dropown_function === "longPress") {
|
||||
var time = this.getFieldValue("time");
|
||||
code = "button_" + dropdown_pin + ".pressedFor(" + time + ")";
|
||||
} else if (dropown_function === "toggleButton") {
|
||||
code = "button_" + dropdown_pin + ".toggleState()";
|
||||
Blockly.Arduino.definitions_["define_button" + dropdown_pin + ""] =
|
||||
"ToggleButton button_" + dropdown_pin + "(" + dropdown_pin + ");";
|
||||
}
|
||||
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
@@ -153,7 +153,7 @@ class ProjectHome extends Component {
|
||||
</Typography>
|
||||
</Link>
|
||||
{this.props.user &&
|
||||
this.props.user.email === project.creator ? (
|
||||
(this.props.user.email === project.creator || this.props.user.role === 'admin') ? (
|
||||
<div>
|
||||
<Divider
|
||||
style={{
|
||||
|
||||
@@ -132,7 +132,7 @@ class SaveProject extends Component {
|
||||
<Tooltip title={this.state.projectType === 'project' ? Blockly.Msg.tooltip_update_project : Blockly.Msg.tooltip_save_project} arrow>
|
||||
<IconButton
|
||||
className={this.props.classes.button}
|
||||
onClick={this.props.user.blocklyRole !== 'user' && (!this.props.project || this.props.user.email === this.props.project.creator) ? (e) => this.toggleMenu(e) : this.state.projectType === 'project' ? () => this.props.updateProject(this.state.projectType, this.props.project._id) : () => { this.setState({ projectType: 'project' }, () => this.saveProject()) }}
|
||||
onClick={this.props.user.blocklyRole === 'admin' && (!this.props.project || this.props.user.email === this.props.project.creator) ? (e) => this.toggleMenu(e) : this.state.projectType === 'project' ? () => this.props.updateProject(this.state.projectType, this.props.project._id) : () => { this.setState({ projectType: 'project' }, () => this.saveProject()) }}
|
||||
size="large">
|
||||
<FontAwesomeIcon icon={faSave} size="xs" />
|
||||
</IconButton>
|
||||
|
||||
@@ -86,7 +86,7 @@ class WorkspaceFunc extends Component {
|
||||
(this.props.projectType === "project" ||
|
||||
this.props.projectType === "gallery") &&
|
||||
this.props.user &&
|
||||
this.props.user.email === this.props.project.creator ? (
|
||||
(this.props.user.email === this.props.project.creator || this.props.user.role === 'admin' ) ? (
|
||||
<DeleteProject
|
||||
project={this.props.project}
|
||||
projectType={this.props.projectType}
|
||||
|
||||
Reference in New Issue
Block a user