Merge pull request #2324 from benjiwheeler/remix-button

enable remix button; format remix, see inside button css
This commit is contained in:
Benjamin Wheeler 2018-11-19 13:58:23 -05:00 committed by GitHub
commit 4f4a59875a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 35 deletions

View file

@ -43,10 +43,12 @@ const onKeyPress = e => {
}; };
const PreviewPresentation = ({ const PreviewPresentation = ({
addToStudioOpen,
assetHost, assetHost,
backpackHost, backpackHost,
canAddToStudio, canAddToStudio,
canDeleteComments, canDeleteComments,
canRemix,
canReport, canReport,
canRestoreComments, canRestoreComments,
canShare, canShare,
@ -61,39 +63,40 @@ const PreviewPresentation = ({
isFullScreen, isFullScreen,
isLoggedIn, isLoggedIn,
isShared, isShared,
loved,
loveCount, loveCount,
loved,
moreCommentsToLoad, moreCommentsToLoad,
onAddComment,
onAddToStudioClicked,
onAddToStudioClosed,
onDeleteComment,
onFavoriteClicked,
onLoadMore,
onLoveClicked,
onRemix,
onReportClicked,
onReportClose,
onReportComment,
onReportSubmit,
onRestoreComment,
onSeeInside,
onShare,
onToggleComments,
onToggleStudio,
onUpdate,
onUpdateProjectId,
originalInfo, originalInfo,
parentInfo, parentInfo,
projectHost, projectHost,
projectId, projectId,
projectInfo, projectInfo,
projectNotAvailable, projectNotAvailable,
remixes,
reportOpen,
replies,
addToStudioOpen,
projectStudios, projectStudios,
remixes,
replies,
reportOpen,
singleCommentId, singleCommentId,
userOwnsProject, userOwnsProject
onAddComment,
onDeleteComment,
onFavoriteClicked,
onLoadMore,
onLoveClicked,
onReportClicked,
onReportClose,
onReportComment,
onReportSubmit,
onRestoreComment,
onAddToStudioClicked,
onAddToStudioClosed,
onToggleStudio,
onToggleComments,
onSeeInside,
onShare,
onUpdate
}) => { }) => {
const shareDate = ((projectInfo.history && projectInfo.history.shared)) ? projectInfo.history.shared : ''; const shareDate = ((projectInfo.history && projectInfo.history.shared)) ? projectInfo.history.shared : '';
@ -154,9 +157,11 @@ const PreviewPresentation = ({
</FlexRow> </FlexRow>
<MediaQuery minWidth={frameless.mobile}> <MediaQuery minWidth={frameless.mobile}>
<div className="project-buttons"> <div className="project-buttons">
{/* TODO: Hide Remix button for now until implemented */} {canRemix &&
{(!userOwnsProject && false) && <Button
<Button className="button remix-button"> className="button remix-button"
onClick={onRemix}
>
<FormattedMessage id="project.remixButton" /> <FormattedMessage id="project.remixButton" />
</Button> </Button>
} }
@ -177,12 +182,14 @@ const PreviewPresentation = ({
backpackHost={backpackHost} backpackHost={backpackHost}
backpackVisible={canUseBackpack} backpackVisible={canUseBackpack}
basePath="/" basePath="/"
canRemix={canRemix}
className="guiPlayer" className="guiPlayer"
cloudHost={cloudHost} cloudHost={cloudHost}
isFullScreen={isFullScreen} isFullScreen={isFullScreen}
previewInfoVisible="false" previewInfoVisible="false"
projectHost={projectHost} projectHost={projectHost}
projectId={projectId} projectId={projectId}
onUpdateProjectId={onUpdateProjectId}
/> />
</div> </div>
<MediaQuery maxWidth={frameless.tablet - 1}> <MediaQuery maxWidth={frameless.tablet - 1}>
@ -449,6 +456,7 @@ PreviewPresentation.propTypes = {
backpackHost: PropTypes.string, backpackHost: PropTypes.string,
canAddToStudio: PropTypes.bool, canAddToStudio: PropTypes.bool,
canDeleteComments: PropTypes.bool, canDeleteComments: PropTypes.bool,
canRemix: PropTypes.bool,
canReport: PropTypes.bool, canReport: PropTypes.bool,
canRestoreComments: PropTypes.bool, canRestoreComments: PropTypes.bool,
canShare: PropTypes.bool, canShare: PropTypes.bool,
@ -473,6 +481,7 @@ PreviewPresentation.propTypes = {
onFavoriteClicked: PropTypes.func, onFavoriteClicked: PropTypes.func,
onLoadMore: PropTypes.func, onLoadMore: PropTypes.func,
onLoveClicked: PropTypes.func, onLoveClicked: PropTypes.func,
onRemix: PropTypes.func,
onReportClicked: PropTypes.func.isRequired, onReportClicked: PropTypes.func.isRequired,
onReportClose: PropTypes.func.isRequired, onReportClose: PropTypes.func.isRequired,
onReportComment: PropTypes.func.isRequired, onReportComment: PropTypes.func.isRequired,
@ -483,6 +492,7 @@ PreviewPresentation.propTypes = {
onToggleComments: PropTypes.func, onToggleComments: PropTypes.func,
onToggleStudio: PropTypes.func, onToggleStudio: PropTypes.func,
onUpdate: PropTypes.func, onUpdate: PropTypes.func,
onUpdateProjectId: PropTypes.func,
originalInfo: projectShape, originalInfo: projectShape,
parentInfo: projectShape, parentInfo: projectShape,
projectHost: PropTypes.string, projectHost: PropTypes.string,

View file

@ -50,6 +50,7 @@ class Preview extends React.Component {
'handleRestoreComment', 'handleRestoreComment',
'handleAddToStudioClick', 'handleAddToStudioClick',
'handleAddToStudioClose', 'handleAddToStudioClose',
'handleRemix',
'handleSeeInside', 'handleSeeInside',
'handleShare', 'handleShare',
'handleUpdateProjectId', 'handleUpdateProjectId',
@ -73,13 +74,13 @@ class Preview extends React.Component {
parseInt(window.location.hash.replace(commentHashPrefix, ''), 10); parseInt(window.location.hash.replace(commentHashPrefix, ''), 10);
this.state = { this.state = {
addToStudioOpen: false,
extensions: [], extensions: [],
favoriteCount: 0, favoriteCount: 0,
loveCount: 0, loveCount: 0,
projectId: parts[1] === 'editor' ? '0' : parts[1], projectId: parts[1] === 'editor' ? '0' : parts[1],
singleCommentId: singleCommentId, reportOpen: false,
addToStudioOpen: false, singleCommentId: singleCommentId
reportOpen: false
}; };
this.addEventListeners(); this.addEventListeners();
/* In the beginning, if user is on mobile and landscape, go to fullscreen */ /* In the beginning, if user is on mobile and landscape, go to fullscreen */
@ -328,6 +329,9 @@ class Preview extends React.Component {
})); }));
} }
} }
handleRemix () {
this.props.remixProject();
}
handleSeeInside () { handleSeeInside () {
this.props.setPlayer(false); this.props.setPlayer(false);
} }
@ -405,6 +409,7 @@ class Preview extends React.Component {
backpackHost={this.props.backpackHost} backpackHost={this.props.backpackHost}
canAddToStudio={this.props.canAddToStudio} canAddToStudio={this.props.canAddToStudio}
canDeleteComments={this.props.isAdmin || this.props.userOwnsProject} canDeleteComments={this.props.isAdmin || this.props.userOwnsProject}
canRemix={this.props.canRemix}
canReport={this.props.canReport} canReport={this.props.canReport}
canRestoreComments={this.props.isAdmin} canRestoreComments={this.props.isAdmin}
canShare={this.props.canShare} canShare={this.props.canShare}
@ -440,6 +445,7 @@ class Preview extends React.Component {
onFavoriteClicked={this.handleFavoriteToggle} onFavoriteClicked={this.handleFavoriteToggle}
onLoadMore={this.handleLoadMore} onLoadMore={this.handleLoadMore}
onLoveClicked={this.handleLoveToggle} onLoveClicked={this.handleLoveToggle}
onRemix={this.handleRemix}
onReportClicked={this.handleReportClick} onReportClicked={this.handleReportClick}
onReportClose={this.handleReportClose} onReportClose={this.handleReportClose}
onReportComment={this.handleReportComment} onReportComment={this.handleReportComment}
@ -450,11 +456,11 @@ class Preview extends React.Component {
onToggleComments={this.handleToggleComments} onToggleComments={this.handleToggleComments}
onToggleStudio={this.handleToggleStudio} onToggleStudio={this.handleToggleStudio}
onUpdate={this.handleUpdate} onUpdate={this.handleUpdate}
onUpdateProjectId={this.handleUpdateProjectId}
/> />
</Page> : </Page> :
<React.Fragment> <React.Fragment>
<IntlGUI <IntlGUI
hideIntro
assetHost={this.props.assetHost} assetHost={this.props.assetHost}
authorId={this.props.authorId} authorId={this.props.authorId}
authorThumbnailUrl={this.props.authorThumbnailUrl} authorThumbnailUrl={this.props.authorThumbnailUrl}
@ -544,6 +550,7 @@ Preview.propTypes = {
projectInfo: projectShape, projectInfo: projectShape,
projectNotAvailable: PropTypes.bool, projectNotAvailable: PropTypes.bool,
projectStudios: PropTypes.arrayOf(PropTypes.object), projectStudios: PropTypes.arrayOf(PropTypes.object),
remixProject: PropTypes.func,
remixes: PropTypes.arrayOf(PropTypes.object), remixes: PropTypes.arrayOf(PropTypes.object),
replies: PropTypes.objectOf(PropTypes.array), replies: PropTypes.objectOf(PropTypes.array),
reportProject: PropTypes.func, reportProject: PropTypes.func,
@ -728,6 +735,9 @@ const mapDispatchToProps = dispatch => ({
updateProject: (id, formData, username, token) => { updateProject: (id, formData, username, token) => {
dispatch(previewActions.updateProject(id, formData, username, token)); dispatch(previewActions.updateProject(id, formData, username, token));
}, },
remixProject: () => {
dispatch(GUI.remixProject());
},
setPlayer: player => { setPlayer: player => {
dispatch(GUI.setPlayer(player)); dispatch(GUI.setPlayer(player));
}, },

View file

@ -163,6 +163,7 @@ $stage-width: 480px;
} }
.project-buttons { .project-buttons {
font-weight: bold;
flex-shrink: 0; flex-shrink: 0;
} }
@ -206,17 +207,23 @@ $stage-width: 480px;
.remix-button, .remix-button,
.see-inside-button { .see-inside-button {
margin-top: 0; margin-top: 0;
border-radius: .25rem;
padding-top: .6875rem;
padding-right: .9375rem;
padding-bottom: .6875rem;
padding-left: .875rem;
height: 2.5rem;
font-size: .875rem; font-size: .875rem;
font-weight: normal;
&:before { &:before {
display: inline-block; display: inline-block;
margin-right: .5rem; margin-top: -2px;
margin-right: .4375rem;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
background-size: contain; background-size: contain;
width: 1.25rem; width: 1.125rem;
height: 1.25rem; height: 1.125rem;
vertical-align: middle; vertical-align: middle;
content: ""; content: "";
} }

View file

@ -54,7 +54,7 @@
text-decoration: none; text-decoration: none;
line-height: .875rem; line-height: .875rem;
font-size: .75rem; font-size: .75rem;
font-weight: normal; font-weight: bold;
&.studio-button, &.studio-button,
&.copy-link-button, &.copy-link-button,