this.props.removeStep(index)}
>
diff --git a/src/components/WorkspaceFunc.js b/src/components/WorkspaceFunc.js
index 3d413b3..62380f5 100644
--- a/src/components/WorkspaceFunc.js
+++ b/src/components/WorkspaceFunc.js
@@ -13,6 +13,7 @@ import { initialXml } from './Blockly/initialXml.js';
import Compile from './Compile';
import SolutionCheck from './Tutorial/SolutionCheck';
import Dialog from './Dialog';
+import Snackbar from './Snackbar';
import withWidth, { isWidthDown } from '@material-ui/core/withWidth';
import { withStyles } from '@material-ui/core/styles';
@@ -59,7 +60,9 @@ class WorkspaceFunc extends Component {
open: false,
file: false,
saveXml: false,
- name: props.name
+ name: props.name,
+ snackbar: false,
+ message: ''
};
}
@@ -73,6 +76,10 @@ class WorkspaceFunc extends Component {
this.setState({ open: !this.state });
}
+ toggleSnackbar = () => {
+ this.setState({ snackbar: !this.state, message: '' });
+ }
+
saveXmlFile = () => {
var code = this.props.xml;
this.toggleDialog();
@@ -121,6 +128,7 @@ class WorkspaceFunc extends Component {
var extensionPosition = xmlFile.name.lastIndexOf('.');
this.props.workspaceName(xmlFile.name.substr(0, extensionPosition));
}
+ this.setState({ snackbar: true, message: 'Das Projekt aus gegebener XML-Datei wurde erfolgreich eingefügt.' });
}
} catch(err){
this.setState({ open: true, file: false, title: 'Ungültige XML', content: 'Die XML-Datei konnte nicht in Blöcke zerlegt werden. Bitte überprüfe den XML-Code und versuche es erneut.' });
@@ -129,6 +137,12 @@ class WorkspaceFunc extends Component {
}
}
+ renameWorkspace = () => {
+ this.props.workspaceName(this.state.name);
+ this.toggleDialog();
+ this.setState({ snackbar: true, message: `Das Projekt wurde erfolgreich in '${this.state.name}' umbenannt.` });
+ }
+
resetWorkspace = () => {
const workspace = Blockly.getMainWorkspace();
Blockly.Events.disable(); // https://groups.google.com/forum/#!topic/blockly/m7e3g0TC75Y
@@ -142,6 +156,7 @@ class WorkspaceFunc extends Component {
if(!this.props.solutionCheck){
this.props.workspaceName(null);
}
+ this.setState({ snackbar: true, message: 'Das Projekt wurde erfolgreich zurückgesetzt.' });
}
render() {
@@ -204,11 +219,18 @@ class WorkspaceFunc extends Component {
{this.state.file ?
-
+
: null}
+
+
);
};