mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
Don’t allow remixing if the project is not loaded
Depends on https://github.com/LLK/scratch-gui/pull/4312 Adds new `isProjectLoaded` state to the project view, and disables the remix button until the project is loaded. Passes new callback to gui to be notified when the project is loaded.
This commit is contained in:
parent
195cdba19a
commit
ccbaa60e59
3 changed files with 21 additions and 3 deletions
|
@ -70,6 +70,7 @@ const PreviewPresentation = ({
|
||||||
isFullScreen,
|
isFullScreen,
|
||||||
isLoggedIn,
|
isLoggedIn,
|
||||||
isNewScratcher,
|
isNewScratcher,
|
||||||
|
isProjectLoaded,
|
||||||
isRemixing,
|
isRemixing,
|
||||||
isScratcher,
|
isScratcher,
|
||||||
isShared,
|
isShared,
|
||||||
|
@ -90,6 +91,7 @@ const PreviewPresentation = ({
|
||||||
onLoadMore,
|
onLoadMore,
|
||||||
onLoveClicked,
|
onLoveClicked,
|
||||||
onOpenAdminPanel,
|
onOpenAdminPanel,
|
||||||
|
onProjectLoaded,
|
||||||
onRemix,
|
onRemix,
|
||||||
onRemixing,
|
onRemixing,
|
||||||
onReportClicked,
|
onReportClicked,
|
||||||
|
@ -250,10 +252,11 @@ const PreviewPresentation = ({
|
||||||
className={classNames([
|
className={classNames([
|
||||||
'remix-button',
|
'remix-button',
|
||||||
{
|
{
|
||||||
remixing: isRemixing,
|
disabled: isRemixing || !isProjectLoaded,
|
||||||
spin: isRemixing
|
remixing: isRemixing
|
||||||
}
|
}
|
||||||
])}
|
])}
|
||||||
|
disabled={isRemixing || !isProjectLoaded}
|
||||||
title={intl.formatMessage({id: 'project.remixButton.altText'})}
|
title={intl.formatMessage({id: 'project.remixButton.altText'})}
|
||||||
onClick={onRemix}
|
onClick={onRemix}
|
||||||
>
|
>
|
||||||
|
@ -301,6 +304,7 @@ const PreviewPresentation = ({
|
||||||
projectHost={projectHost}
|
projectHost={projectHost}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
onGreenFlag={onGreenFlag}
|
onGreenFlag={onGreenFlag}
|
||||||
|
onProjectLoaded={onProjectLoaded}
|
||||||
onRemixing={onRemixing}
|
onRemixing={onRemixing}
|
||||||
onUpdateProjectId={onUpdateProjectId}
|
onUpdateProjectId={onUpdateProjectId}
|
||||||
onUpdateProjectThumbnail={onUpdateProjectThumbnail}
|
onUpdateProjectThumbnail={onUpdateProjectThumbnail}
|
||||||
|
@ -623,6 +627,7 @@ PreviewPresentation.propTypes = {
|
||||||
isFullScreen: PropTypes.bool,
|
isFullScreen: PropTypes.bool,
|
||||||
isLoggedIn: PropTypes.bool,
|
isLoggedIn: PropTypes.bool,
|
||||||
isNewScratcher: PropTypes.bool,
|
isNewScratcher: PropTypes.bool,
|
||||||
|
isProjectLoaded: PropTypes.bool,
|
||||||
isRemixing: PropTypes.bool,
|
isRemixing: PropTypes.bool,
|
||||||
isScratcher: PropTypes.bool,
|
isScratcher: PropTypes.bool,
|
||||||
isShared: PropTypes.bool,
|
isShared: PropTypes.bool,
|
||||||
|
@ -646,6 +651,7 @@ PreviewPresentation.propTypes = {
|
||||||
onLoadMore: PropTypes.func,
|
onLoadMore: PropTypes.func,
|
||||||
onLoveClicked: PropTypes.func,
|
onLoveClicked: PropTypes.func,
|
||||||
onOpenAdminPanel: PropTypes.func,
|
onOpenAdminPanel: PropTypes.func,
|
||||||
|
onProjectLoaded: PropTypes.func,
|
||||||
onRemix: PropTypes.func,
|
onRemix: PropTypes.func,
|
||||||
onRemixing: PropTypes.func,
|
onRemixing: PropTypes.func,
|
||||||
onReportClicked: PropTypes.func.isRequired,
|
onReportClicked: PropTypes.func.isRequired,
|
||||||
|
|
|
@ -283,9 +283,11 @@ $stage-width: 480px;
|
||||||
background-image: url("/svgs/project/remix-white.svg");
|
background-image: url("/svgs/project/remix-white.svg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.remix-button.disabled {
|
||||||
|
opacity: .6;
|
||||||
|
}
|
||||||
|
|
||||||
.remix-button.remixing {
|
.remix-button.remixing {
|
||||||
opacity: .6;
|
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
animation-name: remix-intro, remix-spin;
|
animation-name: remix-intro, remix-spin;
|
||||||
|
|
|
@ -74,6 +74,7 @@ class Preview extends React.Component {
|
||||||
'handleAddToStudioClick',
|
'handleAddToStudioClick',
|
||||||
'handleAddToStudioClose',
|
'handleAddToStudioClose',
|
||||||
'handleGreenFlag',
|
'handleGreenFlag',
|
||||||
|
'handleProjectLoaded',
|
||||||
'handleRemix',
|
'handleRemix',
|
||||||
'handleSeeAllComments',
|
'handleSeeAllComments',
|
||||||
'handleSeeInside',
|
'handleSeeInside',
|
||||||
|
@ -108,6 +109,7 @@ class Preview extends React.Component {
|
||||||
clientLoved: false,
|
clientLoved: false,
|
||||||
extensions: [],
|
extensions: [],
|
||||||
favoriteCount: 0,
|
favoriteCount: 0,
|
||||||
|
isProjectLoaded: false,
|
||||||
isRemixing: false,
|
isRemixing: false,
|
||||||
invalidProject: parts.length === 1,
|
invalidProject: parts.length === 1,
|
||||||
justRemixed: false,
|
justRemixed: false,
|
||||||
|
@ -382,6 +384,11 @@ class Preview extends React.Component {
|
||||||
this.props.setFullScreen(fullScreen);
|
this.props.setFullScreen(fullScreen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
handleProjectLoaded () {
|
||||||
|
// Currently project view only needs to know when the project becomes loaded. It
|
||||||
|
// does not currently handle (or need to handle) the case where a project becomes unloaded.
|
||||||
|
this.setState({isProjectLoaded: true});
|
||||||
|
}
|
||||||
pushHistory (push) {
|
pushHistory (push) {
|
||||||
// update URI to match mode
|
// update URI to match mode
|
||||||
const idPath = this.state.projectId ? `${this.state.projectId}/` : '';
|
const idPath = this.state.projectId ? `${this.state.projectId}/` : '';
|
||||||
|
@ -611,6 +618,7 @@ class Preview extends React.Component {
|
||||||
isFullScreen={this.state.isFullScreen}
|
isFullScreen={this.state.isFullScreen}
|
||||||
isLoggedIn={this.props.isLoggedIn}
|
isLoggedIn={this.props.isLoggedIn}
|
||||||
isNewScratcher={this.props.isNewScratcher}
|
isNewScratcher={this.props.isNewScratcher}
|
||||||
|
isProjectLoaded={this.state.isProjectLoaded}
|
||||||
isRemixing={this.state.isRemixing}
|
isRemixing={this.state.isRemixing}
|
||||||
isScratcher={this.props.isScratcher}
|
isScratcher={this.props.isScratcher}
|
||||||
isShared={this.props.isShared}
|
isShared={this.props.isShared}
|
||||||
|
@ -646,6 +654,7 @@ class Preview extends React.Component {
|
||||||
onLoadMore={this.handleLoadMore}
|
onLoadMore={this.handleLoadMore}
|
||||||
onLoveClicked={this.handleLoveToggle}
|
onLoveClicked={this.handleLoveToggle}
|
||||||
onOpenAdminPanel={this.handleOpenAdminPanel}
|
onOpenAdminPanel={this.handleOpenAdminPanel}
|
||||||
|
onProjectLoaded={this.handleProjectLoaded}
|
||||||
onRemix={this.handleRemix}
|
onRemix={this.handleRemix}
|
||||||
onRemixing={this.handleIsRemixing}
|
onRemixing={this.handleIsRemixing}
|
||||||
onReportClicked={this.handleReportClick}
|
onReportClicked={this.handleReportClick}
|
||||||
|
@ -691,6 +700,7 @@ class Preview extends React.Component {
|
||||||
onGreenFlag={this.handleGreenFlag}
|
onGreenFlag={this.handleGreenFlag}
|
||||||
onLogOut={this.props.handleLogOut}
|
onLogOut={this.props.handleLogOut}
|
||||||
onOpenRegistration={this.props.handleOpenRegistration}
|
onOpenRegistration={this.props.handleOpenRegistration}
|
||||||
|
onProjectLoaded={this.handleProjectLoaded}
|
||||||
onRemixing={this.handleIsRemixing}
|
onRemixing={this.handleIsRemixing}
|
||||||
onSetLanguage={this.handleSetLanguage}
|
onSetLanguage={this.handleSetLanguage}
|
||||||
onShare={this.handleShare}
|
onShare={this.handleShare}
|
||||||
|
|
Loading…
Reference in a new issue