Skip to content
Snippets Groups Projects
Unverified Commit 0d1e6871 authored by Paul Kaplan's avatar Paul Kaplan Committed by GitHub
Browse files

Merge pull request #2662 from paulkaplan/add-ev3-connection-message

Add ev3 connection message and help links
parents 57e508ee 61c2358b
No related branches found
No related tags found
No related merge requests found
Showing
with 151 additions and 33 deletions
...@@ -28,11 +28,7 @@ const ConnectingStep = props => ( ...@@ -28,11 +28,7 @@ const ConnectingStep = props => (
</Box> </Box>
<Box className={styles.bottomArea}> <Box className={styles.bottomArea}>
<Box className={styles.instructions}> <Box className={styles.instructions}>
<FormattedMessage {props.connectingMessage}
defaultMessage="Connecting"
description=""
id="gui.connection.connecting"
/>
</Box> </Box>
<Dots <Dots
counter={1} counter={1}
...@@ -64,6 +60,7 @@ const ConnectingStep = props => ( ...@@ -64,6 +60,7 @@ const ConnectingStep = props => (
); );
ConnectingStep.propTypes = { ConnectingStep.propTypes = {
connectingMessage: PropTypes.node.isRequired,
deviceImage: PropTypes.string.isRequired, deviceImage: PropTypes.string.isRequired,
onDisconnect: PropTypes.func onDisconnect: PropTypes.func
}; };
......
...@@ -183,8 +183,41 @@ ...@@ -183,8 +183,41 @@
align-items: center; align-items: center;
} }
.scratch-link-help {
display: flex;
flex-direction: column;
justify-content: space-around;
height: 100%;
padding: 1rem 0;
}
.scratch-link-help-step {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
margin-left: 3rem;
}
.scratch-link-icon { .scratch-link-icon {
max-width: 150px; max-width: 50px;
}
.help-step-image {
margin-right: 0.5rem;
}
.help-step-number {
background: $pen-primary;
border-radius: 100%;
display: flex;
justify-content: center;
align-items: center;
color: $ui-white;
font-weight: bold;
margin-right: 0.5rem;
min-width: 2rem;
height: 2rem;
} }
.button-row { .button-row {
...@@ -262,7 +295,7 @@ ...@@ -262,7 +295,7 @@
.instructions { .instructions {
text-align: center; text-align: center;
padding: 1rem; margin-top: 1rem;
} }
.dots-row { .dots-row {
...@@ -270,7 +303,7 @@ ...@@ -270,7 +303,7 @@
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding-bottom: 1rem; margin: 1rem;
} }
.dots-holder { .dots-holder {
......
...@@ -27,6 +27,7 @@ const ConnectionModalComponent = props => ( ...@@ -27,6 +27,7 @@ const ConnectionModalComponent = props => (
contentLabel={props.name} contentLabel={props.name}
headerClassName={styles.header} headerClassName={styles.header}
headerImage={props.smallDeviceImage} headerImage={props.smallDeviceImage}
onHelp={props.onHelp}
onRequestClose={props.onCancel} onRequestClose={props.onCancel}
> >
<Box className={styles.body}> <Box className={styles.body}>
...@@ -40,8 +41,10 @@ const ConnectionModalComponent = props => ( ...@@ -40,8 +41,10 @@ const ConnectionModalComponent = props => (
); );
ConnectionModalComponent.propTypes = { ConnectionModalComponent.propTypes = {
connectingMessage: PropTypes.node,
name: PropTypes.node, name: PropTypes.node,
onCancel: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired,
onHelp: PropTypes.func.isRequired,
phase: PropTypes.oneOf(Object.keys(PHASES)).isRequired, phase: PropTypes.oneOf(Object.keys(PHASES)).isRequired,
smallDeviceImage: PropTypes.string, smallDeviceImage: PropTypes.string,
title: PropTypes.string.isRequired title: PropTypes.string.isRequired
......
...@@ -26,7 +26,7 @@ const ErrorStep = props => ( ...@@ -26,7 +26,7 @@ const ErrorStep = props => (
<FormattedMessage <FormattedMessage
defaultMessage="Oops, looks like something went wrong." defaultMessage="Oops, looks like something went wrong."
description="The device connection process has encountered an error." description="The device connection process has encountered an error."
id="gui.connection.errorMessage" id="gui.connection.error.errorMessage"
/> />
</div> </div>
<Dots <Dots
...@@ -43,7 +43,9 @@ const ErrorStep = props => ( ...@@ -43,7 +43,9 @@ const ErrorStep = props => (
src={backIcon} src={backIcon}
/> />
<FormattedMessage <FormattedMessage
id="gui.connection.tryagainbutton" defaultMessage="Try again"
description="Button to initiate trying the device connection again after an error"
id="gui.connection.error.tryagainbutton"
/> />
</button> </button>
<button <button
...@@ -55,7 +57,9 @@ const ErrorStep = props => ( ...@@ -55,7 +57,9 @@ const ErrorStep = props => (
src={helpIcon} src={helpIcon}
/> />
<FormattedMessage <FormattedMessage
id="gui.connection.helpbutton" defaultMessage="Help"
description="Button to view help content"
id="gui.connection.error.helpbutton"
/> />
</button> </button>
</Box> </Box>
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
src/components/connection-modal/icons/scratch-link.png

71.5 KiB

File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -6,30 +6,54 @@ import Box from '../box/box.jsx'; ...@@ -6,30 +6,54 @@ import Box from '../box/box.jsx';
import Dots from './dots.jsx'; import Dots from './dots.jsx';
import helpIcon from './icons/help.svg'; import helpIcon from './icons/help.svg';
import backIcon from './icons/back.svg'; import backIcon from './icons/back.svg';
import scratchLinkIcon from './icons/scratch-link.png'; import bluetoothIcon from './icons/bluetooth.svg';
import scratchLinkIcon from './icons/scratchlink.svg';
import styles from './connection-modal.css'; import styles from './connection-modal.css';
const UnavailableStep = props => ( const UnavailableStep = props => (
<Box className={styles.body}> <Box className={styles.body}>
<Box className={styles.activityArea}> <Box className={styles.activityArea}>
<Box className={styles.centeredRow}> <div className={styles.scratchLinkHelp}>
<div className={styles.deviceActivity}> <div className={styles.scratchLinkHelpStep}>
<img <div className={styles.helpStepNumber}>
className={styles.scratchLinkIcon} {'1'}
src={scratchLinkIcon} </div>
/> <div className={styles.helpStepImage}>
<img
className={styles.scratchLinkIcon}
src={scratchLinkIcon}
/>
</div>
<div className={styles.helpStepText}>
<FormattedMessage
defaultMessage="Make sure you have Scratch Link installed and running"
description="Message for getting Scratch Link installed"
id="gui.connection.unavailable.installscratchlink"
/>
</div>
</div> </div>
</Box> <div className={styles.scratchLinkHelpStep}>
<div className={styles.helpStepNumber}>
{'2'}
</div>
<div className={styles.helpStepImage}>
<img
className={styles.scratchLinkIcon}
src={bluetoothIcon}
/>
</div>
<div className={styles.helpStepText}>
<FormattedMessage
defaultMessage="Check that Bluetooth is enabled"
description="Message for making sure Bluetooth is enabled"
id="gui.connection.unavailable.enablebluetooth"
/>
</div>
</div>
</div>
</Box> </Box>
<Box className={styles.bottomArea}> <Box className={styles.bottomArea}>
<div className={styles.instructions}>
<FormattedMessage
defaultMessage="Please start Scratch Link and turn on Bluetooth."
description="Scratch link is not installed message"
id="gui.connection.unavailableMessage"
/>
</div>
<Dots <Dots
error error
total={3} total={3}
...@@ -46,7 +70,7 @@ const UnavailableStep = props => ( ...@@ -46,7 +70,7 @@ const UnavailableStep = props => (
<FormattedMessage <FormattedMessage
defaultMessage="Try again" defaultMessage="Try again"
description="Button to initiate trying the device connection again after an error" description="Button to initiate trying the device connection again after an error"
id="gui.connection.tryagainbutton" id="gui.connection.unavailable.tryagainbutton"
/> />
</button> </button>
<button <button
...@@ -60,7 +84,7 @@ const UnavailableStep = props => ( ...@@ -60,7 +84,7 @@ const UnavailableStep = props => (
<FormattedMessage <FormattedMessage
defaultMessage="Help" defaultMessage="Help"
description="Button to view help content" description="Button to view help content"
id="gui.connection.helpbutton" id="gui.connection.unavailable.helpbutton"
/> />
</button> </button>
</Box> </Box>
......
...@@ -122,3 +122,14 @@ $sides: 20rem; ...@@ -122,3 +122,14 @@ $sides: 20rem;
font-weight: normal; font-weight: normal;
padding-left: 0; padding-left: 0;
} }
.header-item-help {
padding: 0;
margin-right: -4.75rem;
}
.help-button {
font-weight: normal;
padding-right: 0;
font-size: 0.75rem;
}
...@@ -9,6 +9,7 @@ import Button from '../button/button.jsx'; ...@@ -9,6 +9,7 @@ import Button from '../button/button.jsx';
import CloseButton from '../close-button/close-button.jsx'; import CloseButton from '../close-button/close-button.jsx';
import backIcon from '../../lib/assets/icon--back.svg'; import backIcon from '../../lib/assets/icon--back.svg';
import helpIcon from '../../lib/assets/icon--help.svg';
import styles from './modal.css'; import styles from './modal.css';
...@@ -27,6 +28,26 @@ const ModalComponent = props => ( ...@@ -27,6 +28,26 @@ const ModalComponent = props => (
grow={1} grow={1}
> >
<div className={classNames(styles.header, props.headerClassName)}> <div className={classNames(styles.header, props.headerClassName)}>
{props.onHelp ? (
<div
className={classNames(
styles.headerItem,
styles.headerItemHelp
)}
>
<Button
className={styles.helpButton}
iconSrc={helpIcon}
onClick={props.onHelp}
>
<FormattedMessage
defaultMessage="Help"
description="Help button in modal"
id="gui.modal.help"
/>
</Button>
</div>
) : null}
<div <div
className={classNames( className={classNames(
styles.headerItem, styles.headerItem,
...@@ -82,6 +103,7 @@ ModalComponent.propTypes = { ...@@ -82,6 +103,7 @@ ModalComponent.propTypes = {
fullScreen: PropTypes.bool, fullScreen: PropTypes.bool,
headerClassName: PropTypes.string, headerClassName: PropTypes.string,
headerImage: PropTypes.string, headerImage: PropTypes.string,
onHelp: PropTypes.func,
onRequestClose: PropTypes.func onRequestClose: PropTypes.func
}; };
......
...@@ -355,7 +355,9 @@ class Blocks extends React.Component { ...@@ -355,7 +355,9 @@ class Blocks extends React.Component {
extensionId: extensionId, extensionId: extensionId,
deviceImage: extension.deviceImage, deviceImage: extension.deviceImage,
smallDeviceImage: extension.smallDeviceImage, smallDeviceImage: extension.smallDeviceImage,
name: extension.name name: extension.name,
connectingMessage: extension.connectingMessage,
helpLink: extension.helpLink
}}); }});
} }
} }
...@@ -419,8 +421,10 @@ class Blocks extends React.Component { ...@@ -419,8 +421,10 @@ class Blocks extends React.Component {
) : null} ) : null}
{this.state.connectionModal ? ( {this.state.connectionModal ? (
<ConnectionModal <ConnectionModal
connectingMessage={this.state.connectionModal.connectingMessage}
deviceImage={this.state.connectionModal.deviceImage} deviceImage={this.state.connectionModal.deviceImage}
extensionId={this.state.connectionModal.extensionId} extensionId={this.state.connectionModal.extensionId}
helpLink={this.state.connectionModal.helpLink}
name={this.state.connectionModal.name} name={this.state.connectionModal.name}
smallDeviceImage={this.state.connectionModal.smallDeviceImage} smallDeviceImage={this.state.connectionModal.smallDeviceImage}
vm={vm} vm={vm}
......
...@@ -12,7 +12,8 @@ class ConnectionModal extends React.Component { ...@@ -12,7 +12,8 @@ class ConnectionModal extends React.Component {
'handleConnected', 'handleConnected',
'handleConnecting', 'handleConnecting',
'handleDisconnect', 'handleDisconnect',
'handleError' 'handleError',
'handleHelp'
]); ]);
this.state = { this.state = {
phase: PHASES.scanning phase: PHASES.scanning
...@@ -76,11 +77,12 @@ class ConnectionModal extends React.Component { ...@@ -76,11 +77,12 @@ class ConnectionModal extends React.Component {
}); });
} }
handleHelp () { handleHelp () {
// @todo: implement the help button window.open(this.props.helpLink, '_blank');
} }
render () { render () {
return ( return (
<ConnectionModalComponent <ConnectionModalComponent
connectingMessage={this.props.connectingMessage}
deviceImage={this.props.deviceImage} deviceImage={this.props.deviceImage}
extensionId={this.props.extensionId} extensionId={this.props.extensionId}
name={this.props.name} name={this.props.name}
...@@ -100,8 +102,10 @@ class ConnectionModal extends React.Component { ...@@ -100,8 +102,10 @@ class ConnectionModal extends React.Component {
} }
ConnectionModal.propTypes = { ConnectionModal.propTypes = {
connectingMessage: PropTypes.node.isRequired,
deviceImage: PropTypes.string.isRequired, deviceImage: PropTypes.string.isRequired,
extensionId: PropTypes.string.isRequired, extensionId: PropTypes.string.isRequired,
helpLink: PropTypes.string.isRequired,
name: PropTypes.node.isRequired, name: PropTypes.node.isRequired,
onCancel: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired,
onStatusButtonUpdate: PropTypes.func.isRequired, onStatusButtonUpdate: PropTypes.func.isRequired,
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -106,7 +106,15 @@ export default [ ...@@ -106,7 +106,15 @@ export default [
disabled: true, disabled: true,
launchDeviceConnectionFlow: true, launchDeviceConnectionFlow: true,
deviceImage: microbitDeviceImage, deviceImage: microbitDeviceImage,
smallDeviceImage: microbitMenuImage smallDeviceImage: microbitMenuImage,
connectingMessage: (
<FormattedMessage
defaultMessage="Connecting"
description="Message to help people connect to their micro:bit."
id="gui.extension.microbit.connectingMessage"
/>
),
helpLink: 'https://scratch.mit.edu/microbit'
}, },
{ {
name: 'LEGO MINDSTORMS EV3', name: 'LEGO MINDSTORMS EV3',
...@@ -123,7 +131,15 @@ export default [ ...@@ -123,7 +131,15 @@ export default [
disabled: true, disabled: true,
launchDeviceConnectionFlow: true, launchDeviceConnectionFlow: true,
deviceImage: ev3DeviceImage, deviceImage: ev3DeviceImage,
smallDeviceImage: ev3MenuImage smallDeviceImage: ev3MenuImage,
connectingMessage: (
<FormattedMessage
defaultMessage="Connecting. Make sure the pin on your EV3 is set to 1234."
description="Message to help people connect to their EV3. Must note the PIN should be 1234."
id="gui.extension.ev3.connectingMessage"
/>
),
helpLink: 'https://scratch.mit.edu/ev3'
}, },
{ {
name: 'LEGO WeDo 2.0', name: 'LEGO WeDo 2.0',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment