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 => {
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,
......
......@@ -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
};
......
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