Merge pull request #2419 from rschamp/admin-panel-only-admins

Fix admin panel visibility and style
This commit is contained in:
Ray Schamp 2018-12-06 22:50:22 -05:00 committed by GitHub
commit c65ad06e91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 16 deletions

View file

@ -110,6 +110,7 @@ const PreviewPresentation = ({
remixes, remixes,
replies, replies,
reportOpen, reportOpen,
showAdminPanel,
showModInfo, showModInfo,
singleCommentId, singleCommentId,
userOwnsProject, userOwnsProject,
@ -180,22 +181,24 @@ const PreviewPresentation = ({
return ( return (
<div className="preview"> <div className="preview">
<AdminPanel {showAdminPanel && (
className={classNames('project-admin-panel', { <AdminPanel
'admin-panel-open': adminPanelOpen, className={classNames('project-admin-panel', {
'modal-open': adminModalOpen 'admin-panel-open': adminPanelOpen,
})}
isOpen={adminPanelOpen}
onClose={onCloseAdminPanel}
onOpen={onOpenAdminPanel}
>
<iframe
className={classNames('admin-iframe', {
'modal-open': adminModalOpen 'modal-open': adminModalOpen
})} })}
src={`/scratch2/${projectId}/adminpanel/`} isOpen={adminPanelOpen}
/> onClose={onCloseAdminPanel}
</AdminPanel> onOpen={onOpenAdminPanel}
>
<iframe
className={classNames('admin-iframe', {
'modal-open': adminModalOpen
})}
src={`/scratch2/${projectId}/adminpanel/`}
/>
</AdminPanel>
)}
{ projectInfo && projectInfo.author && projectInfo.author.id && ( { projectInfo && projectInfo.author && projectInfo.author.id && (
<React.Fragment> <React.Fragment>
{banner} {banner}
@ -646,6 +649,7 @@ PreviewPresentation.propTypes = {
remixes: PropTypes.arrayOf(PropTypes.object), remixes: PropTypes.arrayOf(PropTypes.object),
replies: PropTypes.objectOf(PropTypes.array), replies: PropTypes.objectOf(PropTypes.array),
reportOpen: PropTypes.bool, reportOpen: PropTypes.bool,
showAdminPanel: PropTypes.bool,
showModInfo: PropTypes.bool, showModInfo: PropTypes.bool,
singleCommentId: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]), singleCommentId: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
userOwnsProject: PropTypes.bool, userOwnsProject: PropTypes.bool,

View file

@ -43,7 +43,7 @@ $stage-width: 480px;
.project-admin-panel.admin-panel-open { .project-admin-panel.admin-panel-open {
padding: 0; padding: 0;
width: 237px; width: 250px;
} }
.admin-iframe { .admin-iframe {
@ -53,7 +53,7 @@ $stage-width: 480px;
z-index: 100; z-index: 100;
margin: 0; margin: 0;
border: 0; border: 0;
width: 237px; width: 250px;
height: 100%; height: 100%;
} }

View file

@ -576,6 +576,7 @@ class Preview extends React.Component {
replies={this.props.replies} replies={this.props.replies}
reportOpen={this.state.reportOpen} reportOpen={this.state.reportOpen}
showModInfo={this.props.isAdmin} showModInfo={this.props.isAdmin}
showAdminPanel={this.props.isAdmin}
singleCommentId={this.state.singleCommentId} singleCommentId={this.state.singleCommentId}
userOwnsProject={this.props.userOwnsProject} userOwnsProject={this.props.userOwnsProject}
visibilityInfo={this.props.visibilityInfo} visibilityInfo={this.props.visibilityInfo}