diff --git a/src/components/gui/gui.jsx b/src/components/gui/gui.jsx index c3b7cff716b6b07fd874c64abfa68035a593fca5..c7859c5aa54aec12c417b36cc28cd1aaf668e78e 100644 --- a/src/components/gui/gui.jsx +++ b/src/components/gui/gui.jsx @@ -62,6 +62,7 @@ const GUIComponent = props => { costumeLibraryVisible, costumesTabVisible, enableCommunity, + hideIntro, importInfoVisible, intl, isPlayerOnly, @@ -115,7 +116,7 @@ const GUIComponent = props => { {...componentProps} > {previewInfoVisible ? ( - <PreviewModal /> + <PreviewModal hideIntro={hideIntro} /> ) : null} {loading ? ( <Loader /> @@ -281,6 +282,7 @@ GUIComponent.propTypes = { costumeLibraryVisible: PropTypes.bool, costumesTabVisible: PropTypes.bool, enableCommunity: PropTypes.bool, + hideIntro: PropTypes.bool, importInfoVisible: PropTypes.bool, intl: intlShape.isRequired, isPlayerOnly: PropTypes.bool, diff --git a/src/containers/preview-modal.jsx b/src/containers/preview-modal.jsx index dd1ca6701000eef9a38828a763d09e55ee1be60f..a53f398ee70d19b33504e7267fff104fa291986f 100644 --- a/src/containers/preview-modal.jsx +++ b/src/containers/preview-modal.jsx @@ -27,6 +27,25 @@ class PreviewModal extends React.Component { previewing: false }; } + + /** + * Conditionally returns an intro modal depending on the hideIntro prop + * @returns { React.Component | null } null if hideIntro is true, the intro modal component otherwise + */ + introIfShown () { + if (this.props.hideIntro) { + return null; // If hideIntro is true, the intro modal should not appear + } + + // otherwise, show the intro modal + return (<PreviewModalComponent + previewing={this.state.previewing} + onCancel={this.handleCancel} + onTryIt={this.handleTryIt} + onViewProject={this.handleViewProject} + />); + + } handleTryIt () { this.setState({previewing: true}); // try to run in fullscreen mode on tablets. @@ -41,12 +60,7 @@ class PreviewModal extends React.Component { } render () { return (supportedBrowser() ? - <PreviewModalComponent - previewing={this.state.previewing} - onCancel={this.handleCancel} - onTryIt={this.handleTryIt} - onViewProject={this.handleViewProject} - /> : + this.introIfShown() : <BrowserModalComponent onBack={this.handleCancel} /> @@ -55,6 +69,7 @@ class PreviewModal extends React.Component { } PreviewModal.propTypes = { + hideIntro: PropTypes.bool, onTryIt: PropTypes.func, onViewProject: PropTypes.func };