Skip to content
Snippets Groups Projects
Unverified Commit 9a03c330 authored by Connor Hudson's avatar Connor Hudson Committed by GitHub
Browse files

Add hideIntro prop to GUI component (#2831)

* Don't show intro modal if hideIntro passed to PreviewModal

* Add hideIntro prop to GUI

* Move intro modal hiding logic into its own function
parent 93d1fc86
No related branches found
No related tags found
No related merge requests found
...@@ -62,6 +62,7 @@ const GUIComponent = props => { ...@@ -62,6 +62,7 @@ const GUIComponent = props => {
costumeLibraryVisible, costumeLibraryVisible,
costumesTabVisible, costumesTabVisible,
enableCommunity, enableCommunity,
hideIntro,
importInfoVisible, importInfoVisible,
intl, intl,
isPlayerOnly, isPlayerOnly,
...@@ -115,7 +116,7 @@ const GUIComponent = props => { ...@@ -115,7 +116,7 @@ const GUIComponent = props => {
{...componentProps} {...componentProps}
> >
{previewInfoVisible ? ( {previewInfoVisible ? (
<PreviewModal /> <PreviewModal hideIntro={hideIntro} />
) : null} ) : null}
{loading ? ( {loading ? (
<Loader /> <Loader />
...@@ -281,6 +282,7 @@ GUIComponent.propTypes = { ...@@ -281,6 +282,7 @@ GUIComponent.propTypes = {
costumeLibraryVisible: PropTypes.bool, costumeLibraryVisible: PropTypes.bool,
costumesTabVisible: PropTypes.bool, costumesTabVisible: PropTypes.bool,
enableCommunity: PropTypes.bool, enableCommunity: PropTypes.bool,
hideIntro: PropTypes.bool,
importInfoVisible: PropTypes.bool, importInfoVisible: PropTypes.bool,
intl: intlShape.isRequired, intl: intlShape.isRequired,
isPlayerOnly: PropTypes.bool, isPlayerOnly: PropTypes.bool,
......
...@@ -27,6 +27,25 @@ class PreviewModal extends React.Component { ...@@ -27,6 +27,25 @@ class PreviewModal extends React.Component {
previewing: false 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 () { handleTryIt () {
this.setState({previewing: true}); this.setState({previewing: true});
// try to run in fullscreen mode on tablets. // try to run in fullscreen mode on tablets.
...@@ -41,12 +60,7 @@ class PreviewModal extends React.Component { ...@@ -41,12 +60,7 @@ class PreviewModal extends React.Component {
} }
render () { render () {
return (supportedBrowser() ? return (supportedBrowser() ?
<PreviewModalComponent this.introIfShown() :
previewing={this.state.previewing}
onCancel={this.handleCancel}
onTryIt={this.handleTryIt}
onViewProject={this.handleViewProject}
/> :
<BrowserModalComponent <BrowserModalComponent
onBack={this.handleCancel} onBack={this.handleCancel}
/> />
...@@ -55,6 +69,7 @@ class PreviewModal extends React.Component { ...@@ -55,6 +69,7 @@ class PreviewModal extends React.Component {
} }
PreviewModal.propTypes = { PreviewModal.propTypes = {
hideIntro: PropTypes.bool,
onTryIt: PropTypes.func, onTryIt: PropTypes.func,
onViewProject: PropTypes.func onViewProject: PropTypes.func
}; };
......
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