can't upload media if not logged in
This commit is contained in:
parent
4abc85e2f3
commit
a5db4ae9f6
3 changed files with 21 additions and 11 deletions
|
@ -15,7 +15,7 @@ import FileUploader from './FileUploader';
|
||||||
function NewFileModal(props) {
|
function NewFileModal(props) {
|
||||||
const modalClass = classNames({
|
const modalClass = classNames({
|
||||||
modal: true,
|
modal: true,
|
||||||
'modal--hidden': !props.isVisible
|
'modal--reduced': !props.canUploadMedia
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -28,16 +28,25 @@ function NewFileModal(props) {
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<NewFileForm {...props} />
|
<NewFileForm {...props} />
|
||||||
|
{(() => {
|
||||||
|
if (props.canUploadMedia) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
<p className="modal__divider">OR</p>
|
<p className="modal__divider">OR</p>
|
||||||
<FileUploader />
|
<FileUploader />
|
||||||
</div>
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
})()}
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
NewFileModal.propTypes = {
|
NewFileModal.propTypes = {
|
||||||
isVisible: PropTypes.bool.isRequired,
|
closeModal: PropTypes.func.isRequired,
|
||||||
closeModal: PropTypes.func.isRequired
|
canUploadMedia: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
||||||
|
|
|
@ -90,7 +90,7 @@ class IDEView extends React.Component {
|
||||||
if (this.props.ide.modalIsVisible) {
|
if (this.props.ide.modalIsVisible) {
|
||||||
return (
|
return (
|
||||||
<NewFileModal
|
<NewFileModal
|
||||||
isVisible={this.props.ide.modalIsVisible}
|
canUploadMedia={this.props.user.authenticated}
|
||||||
closeModal={this.props.closeNewFileModal}
|
closeModal={this.props.closeNewFileModal}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -107,7 +107,9 @@ IDEView.propTypes = {
|
||||||
project_id: PropTypes.string
|
project_id: PropTypes.string
|
||||||
}),
|
}),
|
||||||
getProject: PropTypes.func.isRequired,
|
getProject: PropTypes.func.isRequired,
|
||||||
user: PropTypes.object.isRequired,
|
user: PropTypes.shape({
|
||||||
|
authenticated: PropTypes.bool.isRequired
|
||||||
|
}).isRequired,
|
||||||
createProject: PropTypes.func.isRequired,
|
createProject: PropTypes.func.isRequired,
|
||||||
saveProject: PropTypes.func.isRequired,
|
saveProject: PropTypes.func.isRequired,
|
||||||
ide: PropTypes.shape({
|
ide: PropTypes.shape({
|
||||||
|
|
|
@ -5,16 +5,15 @@
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal--hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
border: 1px solid $light-modal-border-color;
|
border: 1px solid $light-modal-border-color;
|
||||||
background-color: $light-button-background-color;
|
background-color: $light-button-background-color;
|
||||||
height: #{400 / $base-font-size}rem;
|
height: #{400 / $base-font-size}rem;
|
||||||
width: #{400 / $base-font-size}rem;
|
width: #{400 / $base-font-size}rem;
|
||||||
padding: #{20 / $base-font-size}rem;
|
padding: #{20 / $base-font-size}rem;
|
||||||
|
.modal--reduced & {
|
||||||
|
height: #{150 / $base-font-size}rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal__exit-button {
|
.modal__exit-button {
|
||||||
|
|
Loading…
Reference in a new issue