Merge branch 'master' into feat/blockly-gallery
This commit is contained in:
@@ -42,7 +42,13 @@ class BlocklySvg extends Component {
|
||||
// https://github.com/google/blockly/pull/3431/files#diff-00254795773903d3c0430915a68c9521R328
|
||||
cssContent += `.blocklyPath {
|
||||
fill-opacity: 1;
|
||||
} `;
|
||||
}
|
||||
.blocklyPathDark {
|
||||
display: flex;
|
||||
}
|
||||
.blocklyPathLight {
|
||||
display: flex;
|
||||
} `;
|
||||
|
||||
var css = '<defs><style type="text/css" xmlns="http://www.w3.org/1999/xhtml"><![CDATA[' + cssContent + ']]></style></defs>';
|
||||
var bbox = document.getElementsByClassName("blocklyBlockCanvas")[0].getBBox();
|
||||
|
||||
@@ -19,7 +19,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
|
||||
]
|
||||
}
|
||||
],
|
||||
"output": "Boolean",
|
||||
"output": Types.BOOLEAN.typeName,
|
||||
"style": "logic_blocks",
|
||||
"tooltip": "%{BKY_LOGIC_BOOLEAN_TOOLTIP}",
|
||||
"helpUrl": "%{BKY_LOGIC_BOOLEAN_HELPURL}"
|
||||
@@ -32,7 +32,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "IF0",
|
||||
"check": "Boolean"
|
||||
"check": Types.getCompatibleTypes('boolean')
|
||||
}
|
||||
],
|
||||
"message1": "%{BKY_CONTROLS_IF_MSG_THEN} %1",
|
||||
@@ -57,7 +57,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "IF0",
|
||||
"check": "Boolean"
|
||||
"check": Types.getCompatibleTypes('boolean')
|
||||
}
|
||||
],
|
||||
"message1": "%{BKY_CONTROLS_IF_MSG_THEN} %1",
|
||||
@@ -108,7 +108,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
|
||||
}
|
||||
],
|
||||
"inputsInline": true,
|
||||
"output": "Boolean",
|
||||
"output": Types.BOOLEAN.typeName,
|
||||
"style": "logic_blocks",
|
||||
"helpUrl": "%{BKY_LOGIC_COMPARE_HELPURL}",
|
||||
"extensions": ["logic_compare", "logic_op_tooltip"]
|
||||
@@ -121,7 +121,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "A",
|
||||
"check": "Boolean"
|
||||
"check": Types.getCompatibleTypes('boolean')
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
@@ -134,11 +134,11 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "B",
|
||||
"check": "Boolean"
|
||||
"check": Types.getCompatibleTypes('boolean')
|
||||
}
|
||||
],
|
||||
"inputsInline": true,
|
||||
"output": "Boolean",
|
||||
"output": Types.BOOLEAN.typeName,
|
||||
"style": "logic_blocks",
|
||||
"helpUrl": "%{BKY_LOGIC_OPERATION_HELPURL}",
|
||||
"extensions": ["logic_op_tooltip"]
|
||||
@@ -151,10 +151,10 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "BOOL",
|
||||
"check": "Boolean"
|
||||
"check": Types.getCompatibleTypes('boolean'),
|
||||
}
|
||||
],
|
||||
"output": "Boolean",
|
||||
"output": Types.BOOLEAN.typeName,
|
||||
"style": "logic_blocks",
|
||||
"tooltip": "%{BKY_LOGIC_NEGATE_TOOLTIP}",
|
||||
"helpUrl": "%{BKY_LOGIC_NEGATE_HELPURL}"
|
||||
@@ -176,7 +176,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "IF",
|
||||
"check": "Boolean"
|
||||
"check": Types.getCompatibleTypes('boolean'),
|
||||
}
|
||||
],
|
||||
"message1": "%{BKY_LOGIC_TERNARY_IF_TRUE} %1",
|
||||
|
||||
@@ -18,7 +18,7 @@ export const CHARACTER = {
|
||||
|
||||
export const BOOLEAN = {
|
||||
typeId: 'Boolean',
|
||||
typeName: 'Boolean',
|
||||
typeName: 'boolean',
|
||||
typeMsgName: 'ARD_TYPE_BOOL',
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import BlocklyWindow from './Blockly/BlocklyWindow';
|
||||
import CodeViewer from './CodeViewer';
|
||||
import TrashcanButtons from './TrashcanButtons';
|
||||
import { createNameId } from 'mnemonic-id';
|
||||
import HintTutorialExists from './Tutorial/HintTutorialExists';
|
||||
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import IconButton from '@material-ui/core/IconButton';
|
||||
@@ -121,6 +122,7 @@ class Home extends Component {
|
||||
</Grid>
|
||||
: null}
|
||||
</Grid>
|
||||
<HintTutorialExists />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { visitPage } from '../actions/generalActions';
|
||||
|
||||
import { Route, Switch } from 'react-router-dom';
|
||||
import { Route, Switch, withRouter } from 'react-router-dom';
|
||||
|
||||
import Home from './Home';
|
||||
import Tutorial from './Tutorial/Tutorial';
|
||||
@@ -12,6 +15,10 @@ import GalleryHome from './Gallery/GalleryHome';
|
||||
|
||||
class Routes extends Component {
|
||||
|
||||
componentDidUpdate(){
|
||||
this.props.visitPage();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div style={{ margin: '0 22px' }}>
|
||||
@@ -30,4 +37,8 @@ class Routes extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default Routes;
|
||||
Home.propTypes = {
|
||||
visitPage: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(null, { visitPage })(withRouter(Routes));
|
||||
|
||||
@@ -15,7 +15,7 @@ import FormLabel from '@material-ui/core/FormLabel';
|
||||
|
||||
const styles = theme => ({
|
||||
multiGridListTile: {
|
||||
background: "#4EAF47",
|
||||
background: theme.palette.primary.main,
|
||||
opacity: 0.9,
|
||||
height: '30px'
|
||||
},
|
||||
|
||||
@@ -27,7 +27,7 @@ const styles = theme => ({
|
||||
color: theme.palette.text.primary
|
||||
},
|
||||
multiGridListTile: {
|
||||
background: "#4EAF47",
|
||||
background: theme.palette.primary.main,
|
||||
opacity: 0.9,
|
||||
height: '30px'
|
||||
},
|
||||
@@ -95,7 +95,7 @@ class Hardware extends Component {
|
||||
>
|
||||
<div>
|
||||
<img src={`/media/hardware/${this.state.hardwareInfo.src}`} width="100%" alt={this.state.hardwareInfo.name} />
|
||||
Weitere Informationen zur Hardware-Komponente findest du <Link href={this.state.hardwareInfo.url} color="primary">hier</Link>.
|
||||
Weitere Informationen zur Hardware-Komponente findest du <Link rel="noreferrer" target="_blank" href={this.state.hardwareInfo.url} color="primary">hier</Link>.
|
||||
</div>
|
||||
</Dialog>
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import Dialog from '../Dialog';
|
||||
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import Checkbox from '@material-ui/core/Checkbox';
|
||||
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
||||
|
||||
const styles = (theme) => ({
|
||||
link: {
|
||||
color: theme.palette.primary.main,
|
||||
textDecoration: 'none',
|
||||
'&:hover': {
|
||||
color: theme.palette.primary.main,
|
||||
textDecoration: `underline`
|
||||
}
|
||||
},
|
||||
label: {
|
||||
fontSize: '0.9rem',
|
||||
color: 'grey'
|
||||
}
|
||||
});
|
||||
|
||||
class HintTutorialExists extends Component {
|
||||
|
||||
constructor(props){
|
||||
var previousPageWasAnotherDomain = props.pageVisits === 0;
|
||||
var userDoNotWantToSeeNews = window.localStorage.getItem('news') ? true : false;
|
||||
console.log(userDoNotWantToSeeNews);
|
||||
super(props);
|
||||
this.state = {
|
||||
open: userDoNotWantToSeeNews ? !userDoNotWantToSeeNews : previousPageWasAnotherDomain
|
||||
};
|
||||
}
|
||||
|
||||
toggleDialog = () => {
|
||||
this.setState({ open: !this.state });
|
||||
}
|
||||
|
||||
onChange = (e) => {
|
||||
if(e.target.checked){
|
||||
window.localStorage.setItem('news', e.target.checked);
|
||||
}
|
||||
else {
|
||||
window.localStorage.deleteItem('news');
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Dialog
|
||||
style={{ zIndex: 9999999 }}
|
||||
fullWidth
|
||||
maxWidth={'sm'}
|
||||
open={this.state.open}
|
||||
title={'Neuigkeiten'}
|
||||
content={''}
|
||||
onClose={this.toggleDialog}
|
||||
onClick={this.toggleDialog}
|
||||
button={'Schließen'}
|
||||
>
|
||||
<div>
|
||||
Es gibt ab jetzt Tutorials zu verschiedenen Themen. Schau mal <Link to="/tutorial" className={this.props.classes.link}>hier</Link> vorbei.
|
||||
<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={'Dialog nicht mehr anzeigen'}
|
||||
/>
|
||||
</div>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
HintTutorialExists.propTypes = {
|
||||
pageVisits: PropTypes.number.isRequired
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
pageVisits: state.general.pageVisits
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, null)(withStyles(styles, { withTheme: true })(HintTutorialExists));
|
||||
@@ -51,6 +51,7 @@ class StepperHorizontal extends Component {
|
||||
|
||||
render() {
|
||||
var tutorialId = this.props.currentTutorialId;
|
||||
var tutorialIndex = this.props.currentTutorialIndex;
|
||||
var status = this.props.status.filter(status => status.id === tutorialId)[0];
|
||||
var tasks = status.tasks;
|
||||
var error = tasks.filter(task => task.type === 'error').length > 0;
|
||||
@@ -69,8 +70,8 @@ class StepperHorizontal extends Component {
|
||||
: null}
|
||||
<div className={this.props.classes.stepper}>
|
||||
<Button
|
||||
disabled={tutorialId === 1}
|
||||
onClick={() => { this.props.history.push(`/tutorial/${tutorialId - 1}`) }}
|
||||
disabled={tutorialIndex === 0}
|
||||
onClick={() => { this.props.history.push(`/tutorial/${tutorials[tutorialIndex - 1].id}`) }}
|
||||
>
|
||||
{'<'}
|
||||
</Button>
|
||||
@@ -81,8 +82,8 @@ class StepperHorizontal extends Component {
|
||||
</div>
|
||||
</Tooltip>
|
||||
<Button
|
||||
disabled={tutorialId + 1 > tutorials.length}
|
||||
onClick={() => { this.props.history.push(`/tutorial/${tutorialId + 1}`) }}
|
||||
disabled={tutorialIndex + 1 === tutorials.length}
|
||||
onClick={() => { this.props.history.push(`/tutorial/${tutorials[tutorialIndex + 1].id}`) }}
|
||||
>
|
||||
{'>'}
|
||||
</Button>
|
||||
@@ -95,13 +96,15 @@ class StepperHorizontal extends Component {
|
||||
StepperHorizontal.propTypes = {
|
||||
status: PropTypes.array.isRequired,
|
||||
change: PropTypes.number.isRequired,
|
||||
currentTutorialId: PropTypes.number.isRequired
|
||||
currentTutorialId: PropTypes.number.isRequired,
|
||||
currentTutorialIndex: PropTypes.number.isRequired
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
change: state.tutorial.change,
|
||||
status: state.tutorial.status,
|
||||
currentTutorialId: state.tutorial.currentId
|
||||
currentTutorialId: state.tutorial.currentId,
|
||||
currentTutorialIndex: state.tutorial.currentIndex
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, null)(withRouter(withStyles(styles, { withTheme: true })(StepperHorizontal)));
|
||||
|
||||
@@ -156,7 +156,13 @@ class WorkspaceFunc extends Component {
|
||||
// https://github.com/google/blockly/pull/3431/files#diff-00254795773903d3c0430915a68c9521R328
|
||||
cssContent += `.blocklyPath {
|
||||
fill-opacity: 1;
|
||||
} `;
|
||||
}
|
||||
.blocklyPathDark {
|
||||
display: flex;
|
||||
}
|
||||
.blocklyPathLight {
|
||||
display: flex;
|
||||
} `;
|
||||
|
||||
var css = '<defs><style type="text/css" xmlns="http://www.w3.org/1999/xhtml"><![CDATA[' + cssContent + ']]></style></defs>';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user