Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
431719f242 |
Generated
+848
-110
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -19,7 +19,6 @@
|
|||||||
"@testing-library/user-event": "^7.2.1",
|
"@testing-library/user-event": "^7.2.1",
|
||||||
"axios": "^0.21.0",
|
"axios": "^0.21.0",
|
||||||
"blockly": "^6.20210701.0",
|
"blockly": "^6.20210701.0",
|
||||||
"diff-js-xml": "^1.0.6",
|
|
||||||
"file-saver": "^2.0.2",
|
"file-saver": "^2.0.2",
|
||||||
"mnemonic-id": "^3.2.7",
|
"mnemonic-id": "^3.2.7",
|
||||||
"moment": "^2.28.0",
|
"moment": "^2.28.0",
|
||||||
@@ -35,7 +34,8 @@
|
|||||||
"reactour": "^1.18.0",
|
"reactour": "^1.18.0",
|
||||||
"redux": "^4.0.5",
|
"redux": "^4.0.5",
|
||||||
"redux-thunk": "^2.3.0",
|
"redux-thunk": "^2.3.0",
|
||||||
"styled-components": "^4.4.1",
|
"rich-markdown-editor": "^11.17.7",
|
||||||
|
"styled-components": "^5.0.0",
|
||||||
"uuid": "^8.3.1"
|
"uuid": "^8.3.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ class BlocklyWindow extends Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const workspace = Blockly.getMainWorkspace();
|
const workspace = Blockly.getMainWorkspace();
|
||||||
if (!this.props.readOnly) {
|
|
||||||
this.props.onChangeWorkspace({});
|
this.props.onChangeWorkspace({});
|
||||||
this.props.clearStats();
|
this.props.clearStats();
|
||||||
workspace.addChangeListener((event) => {
|
workspace.addChangeListener((event) => {
|
||||||
@@ -31,7 +30,6 @@ class BlocklyWindow extends Component {
|
|||||||
Blockly.Events.disableOrphans(event);
|
Blockly.Events.disableOrphans(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
Blockly.svgResize(workspace);
|
Blockly.svgResize(workspace);
|
||||||
const zoomToFit = new ZoomToFitControl(workspace);
|
const zoomToFit = new ZoomToFitControl(workspace);
|
||||||
zoomToFit.init();
|
zoomToFit.init();
|
||||||
@@ -39,7 +37,6 @@ class BlocklyWindow extends Component {
|
|||||||
|
|
||||||
componentDidUpdate(props) {
|
componentDidUpdate(props) {
|
||||||
const workspace = Blockly.getMainWorkspace();
|
const workspace = Blockly.getMainWorkspace();
|
||||||
if (!this.props.readOnly) {
|
|
||||||
var xml = this.props.initialXml;
|
var xml = this.props.initialXml;
|
||||||
// if svg is true, then the update process is done in the BlocklySvg component
|
// if svg is true, then the update process is done in the BlocklySvg component
|
||||||
if (props.initialXml !== xml && !this.props.svg) {
|
if (props.initialXml !== xml && !this.props.svg) {
|
||||||
@@ -56,7 +53,6 @@ class BlocklyWindow extends Component {
|
|||||||
// var toolbox = workspace.getToolbox();
|
// var toolbox = workspace.getToolbox();
|
||||||
// workspace.updateToolbox(toolbox.toolboxDef_);
|
// workspace.updateToolbox(toolbox.toolboxDef_);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Blockly.svgResize(workspace);
|
Blockly.svgResize(workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+64
-40
@@ -1,39 +1,38 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from "react";
|
||||||
|
|
||||||
import Breadcrumbs from './Breadcrumbs';
|
import Breadcrumbs from "./Breadcrumbs";
|
||||||
|
|
||||||
import { withRouter } from 'react-router-dom';
|
import { withRouter } from "react-router-dom";
|
||||||
|
|
||||||
import Button from '@material-ui/core/Button';
|
import Button from "@material-ui/core/Button";
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from "@material-ui/core/Typography";
|
||||||
import * as Blockly from 'blockly'
|
import * as Blockly from "blockly";
|
||||||
import ReactMarkdown from 'react-markdown';
|
import ReactMarkdown from "react-markdown";
|
||||||
import Container from '@material-ui/core/Container';
|
import Container from "@material-ui/core/Container";
|
||||||
import ExpansionPanel from '@material-ui/core/ExpansionPanel';
|
import ExpansionPanel from "@material-ui/core/ExpansionPanel";
|
||||||
import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
|
import ExpansionPanelSummary from "@material-ui/core/ExpansionPanelSummary";
|
||||||
import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
|
import ExpansionPanelDetails from "@material-ui/core/ExpansionPanelDetails";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import { faChevronDown } from "@fortawesome/free-solid-svg-icons";
|
import { faChevronDown } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FaqQuestions } from '../data/faq'
|
import { FaqQuestions } from "../data/faq";
|
||||||
|
import Editor from "rich-markdown-editor";
|
||||||
|
|
||||||
class Faq extends Component {
|
class Faq extends Component {
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
panel: '',
|
panel: "",
|
||||||
expanded: false
|
expanded: false,
|
||||||
}
|
text: "",
|
||||||
|
};
|
||||||
|
|
||||||
handleChange = (panel) => {
|
handleChange = (panel) => {
|
||||||
this.setState({ panel: this.state.panel === panel ? '' : panel });
|
this.setState({ panel: this.state.panel === panel ? "" : panel });
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
// Ensure that Blockly.setLocale is adopted in the component.
|
// Ensure that Blockly.setLocale is adopted in the component.
|
||||||
// Otherwise, the text will not be displayed until the next update of the component.
|
// Otherwise, the text will not be displayed until the next update of the component.
|
||||||
|
|
||||||
window.scrollTo(0, 0)
|
window.scrollTo(0, 0);
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,54 +40,81 @@ class Faq extends Component {
|
|||||||
const { panel } = this.state;
|
const { panel } = this.state;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Breadcrumbs content={[{ link: this.props.location.pathname, title: 'FAQ' }]} />
|
<Breadcrumbs
|
||||||
|
content={[{ link: this.props.location.pathname, title: "FAQ" }]}
|
||||||
|
/>
|
||||||
<Container fixed>
|
<Container fixed>
|
||||||
<div style={{ margin: '0px 24px 0px 24px' }}>
|
<div style={{ margin: "0px 24px 0px 24px" }}>
|
||||||
<h1>FAQ</h1>
|
<h1>FAQ</h1>
|
||||||
{FaqQuestions().map((object, i) => {
|
{FaqQuestions().map((object, i) => {
|
||||||
return (
|
return (
|
||||||
<ExpansionPanel expanded={panel === `panel${i}`} onChange={() => this.handleChange(`panel${i}`)}>
|
<ExpansionPanel
|
||||||
|
expanded={panel === `panel${i}`}
|
||||||
|
onChange={() => this.handleChange(`panel${i}`)}
|
||||||
|
>
|
||||||
<ExpansionPanelSummary
|
<ExpansionPanelSummary
|
||||||
expandIcon={
|
expandIcon={<FontAwesomeIcon icon={faChevronDown} />}
|
||||||
<FontAwesomeIcon icon={faChevronDown} />
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<Typography variant="h6">{object.question}</Typography>
|
<Typography variant="h6">{object.question}</Typography>
|
||||||
</ExpansionPanelSummary>
|
</ExpansionPanelSummary>
|
||||||
<ExpansionPanelDetails>
|
<ExpansionPanelDetails>
|
||||||
<Typography>
|
<Typography>
|
||||||
<ReactMarkdown className="news" allowDangerousHtml="true" children={object.answer}>
|
<ReactMarkdown
|
||||||
</ReactMarkdown>
|
className="news"
|
||||||
|
allowDangerousHtml="true"
|
||||||
|
children={object.answer}
|
||||||
|
></ReactMarkdown>
|
||||||
</Typography>
|
</Typography>
|
||||||
</ExpansionPanelDetails>
|
</ExpansionPanelDetails>
|
||||||
</ExpansionPanel>
|
</ExpansionPanel>
|
||||||
)
|
);
|
||||||
})}
|
})}
|
||||||
{
|
{this.props.button ? (
|
||||||
this.props.button ?
|
|
||||||
<Button
|
<Button
|
||||||
style={{ marginTop: '20px' }}
|
style={{ marginTop: "20px" }}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={() => { this.props.history.push(this.props.button.link) }}
|
onClick={() => {
|
||||||
|
this.props.history.push(this.props.button.link);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{this.props.button.title}
|
{this.props.button.title}
|
||||||
</Button>
|
</Button>
|
||||||
:
|
) : (
|
||||||
<Button
|
<Button
|
||||||
style={{ marginTop: '20px' }}
|
style={{ marginTop: "20px" }}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={() => { this.props.history.push('/') }}
|
onClick={() => {
|
||||||
|
this.props.history.push("/");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{Blockly.Msg.button_back}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
<Editor
|
||||||
|
defaultValue="Hello world!"
|
||||||
|
// value={this.state.text}
|
||||||
|
onChange={(e) => {
|
||||||
|
this.setState({ text: e() });
|
||||||
|
}}
|
||||||
|
uploadImage={async (file) => {}}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
style={{ marginTop: "20px" }}
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
onClick={() => {
|
||||||
|
console.log(this.state.text);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{Blockly.Msg.button_back}
|
{Blockly.Msg.button_back}
|
||||||
</Button>
|
</Button>
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</Container>
|
</Container>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withRouter(Faq);
|
export default withRouter(Faq);
|
||||||
@@ -175,5 +201,3 @@ vitae egestas augue. Duis vel est augue.
|
|||||||
// {Blockly.Msg.button_back}
|
// {Blockly.Msg.button_back}
|
||||||
// </Button>
|
// </Button>
|
||||||
// }}
|
// }}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
-14
@@ -77,7 +77,7 @@ class Home extends Component {
|
|||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.props.clearStats();
|
this.props.clearStats();
|
||||||
// this.props.workspaceName(null);
|
this.props.workspaceName(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange = () => {
|
onChange = () => {
|
||||||
@@ -112,17 +112,10 @@ class Home extends Component {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
<TrashcanButtons />
|
<TrashcanButtons />
|
||||||
<div className='blocklyWindow'>
|
<div className='blocklyWindow'>
|
||||||
{this.props.project ? (
|
{this.props.project ?
|
||||||
<BlocklyWindow
|
< BlocklyWindow blocklyCSS={{ height: '80vH' }} initialXml={this.props.project.xml} />
|
||||||
blocklyCSS={{ height: "80vH" }}
|
: < BlocklyWindow blocklyCSS={{ height: '80vH' }} />
|
||||||
initialXml={this.props.project.xml}
|
}
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<BlocklyWindow
|
|
||||||
blocklyCSS={{ height: "80vH" }}
|
|
||||||
initialXml={this.props.workspaceCode?.xml}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</Grid>
|
</Grid>
|
||||||
{this.state.codeOn ?
|
{this.state.codeOn ?
|
||||||
@@ -153,8 +146,7 @@ Home.propTypes = {
|
|||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
message: state.message,
|
message: state.message,
|
||||||
statistics: state.general.statistics,
|
statistics: state.general.statistics
|
||||||
workspaceCode: state.workspace.code
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,6 @@ 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 Dialog from "../Dialog";
|
|
||||||
import Button from "@material-ui/core/Button";
|
|
||||||
import { initialXml } from "../Blockly/initialXml";
|
|
||||||
import {diffAsXml} from 'diff-js-xml';
|
|
||||||
|
|
||||||
|
|
||||||
const styles = (theme) => ({
|
const styles = (theme) => ({
|
||||||
link: {
|
link: {
|
||||||
@@ -41,7 +36,6 @@ class ProjectHome extends Component {
|
|||||||
type: "",
|
type: "",
|
||||||
key: "",
|
key: "",
|
||||||
message: "",
|
message: "",
|
||||||
dialog: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -132,43 +126,10 @@ class ProjectHome extends Component {
|
|||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<Link
|
||||||
onClick={async () => {
|
to={`/${
|
||||||
const isCodeDifferent = new Promise((resolve) => {
|
|
||||||
// resolve successfully when there is no existing workspace XML code
|
|
||||||
if(!this.props.workspaceCode.xml) {
|
|
||||||
resolve(false)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// get difference of XML
|
|
||||||
// TODO: check if code of project is different to workspace code
|
|
||||||
diffAsXml(
|
|
||||||
this.props.workspaceCode.xml,
|
|
||||||
initialXml,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
(result) => {
|
|
||||||
resolve(result.length !== 0);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const showDialog = await isCodeDifferent;
|
|
||||||
|
|
||||||
if (showDialog)
|
|
||||||
this.setState({
|
|
||||||
dialog: true,
|
|
||||||
});
|
|
||||||
else {
|
|
||||||
this.props.history.push(
|
|
||||||
`/${
|
|
||||||
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>
|
||||||
@@ -178,7 +139,6 @@ class ProjectHome extends Component {
|
|||||||
<BlocklyWindow
|
<BlocklyWindow
|
||||||
svg
|
svg
|
||||||
blockDisabled
|
blockDisabled
|
||||||
readOnly
|
|
||||||
initialXml={project.xml}
|
initialXml={project.xml}
|
||||||
/>
|
/>
|
||||||
<Typography
|
<Typography
|
||||||
@@ -191,7 +151,7 @@ class ProjectHome extends Component {
|
|||||||
>
|
>
|
||||||
{project.description}
|
{project.description}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</Link>
|
||||||
{this.props.user &&
|
{this.props.user &&
|
||||||
this.props.user.email === project.creator ? (
|
this.props.user.email === project.creator ? (
|
||||||
<div>
|
<div>
|
||||||
@@ -246,27 +206,6 @@ class ProjectHome extends Component {
|
|||||||
type={this.state.type}
|
type={this.state.type}
|
||||||
key={this.state.key}
|
key={this.state.key}
|
||||||
/>
|
/>
|
||||||
<Dialog
|
|
||||||
open={this.state.dialog}
|
|
||||||
title="Achtung"
|
|
||||||
actions={
|
|
||||||
<React.Fragment>
|
|
||||||
<Button
|
|
||||||
onClick={() => {
|
|
||||||
this.setState({ dialog: false });
|
|
||||||
// TODO: navigate to project
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Verwerfen
|
|
||||||
</Button>
|
|
||||||
<Button onClick={() => {}} color="primary">
|
|
||||||
Speichern
|
|
||||||
</Button>
|
|
||||||
</React.Fragment>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Möchtest du deinen bisherigen Code als Projekt speichern?
|
|
||||||
</Dialog>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -287,7 +226,6 @@ const mapStateToProps = (state) => ({
|
|||||||
progress: state.project.progress,
|
progress: state.project.progress,
|
||||||
user: state.auth.user,
|
user: state.auth.user,
|
||||||
message: state.message,
|
message: state.message,
|
||||||
workspaceCode: state.workspace.code,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, {
|
export default connect(mapStateToProps, {
|
||||||
|
|||||||
Reference in New Issue
Block a user