From a5db4ae9f6eb78be5882f0bac1e54025536ae026 Mon Sep 17 00:00:00 2001 From: catarak Date: Wed, 20 Jul 2016 22:18:20 -0400 Subject: [PATCH] can't upload media if not logged in --- client/modules/IDE/components/NewFileModal.js | 19 ++++++++++++++----- client/modules/IDE/pages/IDEView.js | 6 ++++-- client/styles/components/_modal.scss | 7 +++---- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/client/modules/IDE/components/NewFileModal.js b/client/modules/IDE/components/NewFileModal.js index 0c299203..91a37740 100644 --- a/client/modules/IDE/components/NewFileModal.js +++ b/client/modules/IDE/components/NewFileModal.js @@ -15,7 +15,7 @@ import FileUploader from './FileUploader'; function NewFileModal(props) { const modalClass = classNames({ modal: true, - 'modal--hidden': !props.isVisible + 'modal--reduced': !props.canUploadMedia }); return ( @@ -28,16 +28,25 @@ function NewFileModal(props) { -

OR

- + {(() => { + if (props.canUploadMedia) { + return ( +
+

OR

+ +
+ ); + } + return ''; + })()} ); } NewFileModal.propTypes = { - isVisible: PropTypes.bool.isRequired, - closeModal: PropTypes.func.isRequired + closeModal: PropTypes.func.isRequired, + canUploadMedia: PropTypes.bool.isRequired }; function mapStateToProps(state) { diff --git a/client/modules/IDE/pages/IDEView.js b/client/modules/IDE/pages/IDEView.js index b5a40357..b29bd5ea 100644 --- a/client/modules/IDE/pages/IDEView.js +++ b/client/modules/IDE/pages/IDEView.js @@ -90,7 +90,7 @@ class IDEView extends React.Component { if (this.props.ide.modalIsVisible) { return ( ); @@ -107,7 +107,9 @@ IDEView.propTypes = { project_id: PropTypes.string }), getProject: PropTypes.func.isRequired, - user: PropTypes.object.isRequired, + user: PropTypes.shape({ + authenticated: PropTypes.bool.isRequired + }).isRequired, createProject: PropTypes.func.isRequired, saveProject: PropTypes.func.isRequired, ide: PropTypes.shape({ diff --git a/client/styles/components/_modal.scss b/client/styles/components/_modal.scss index 297b4e3f..5a45b183 100644 --- a/client/styles/components/_modal.scss +++ b/client/styles/components/_modal.scss @@ -5,16 +5,15 @@ z-index: 100; } -.modal--hidden { - display: none; -} - .modal-content { border: 1px solid $light-modal-border-color; background-color: $light-button-background-color; height: #{400 / $base-font-size}rem; width: #{400 / $base-font-size}rem; padding: #{20 / $base-font-size}rem; + .modal--reduced & { + height: #{150 / $base-font-size}rem; + } } .modal__exit-button {