diff --git a/client/modules/IDE/actions/ide.js b/client/modules/IDE/actions/ide.js index 8b453436..239dc6c7 100644 --- a/client/modules/IDE/actions/ide.js +++ b/client/modules/IDE/actions/ide.js @@ -75,9 +75,10 @@ export function closeNewFileModal() { }; } -export function openUploadFileModal() { +export function openUploadFileModal(parentId) { return { - type: ActionTypes.OPEN_UPLOAD_FILE_MODAL + type: ActionTypes.OPEN_UPLOAD_FILE_MODAL, + parentId }; } diff --git a/client/modules/IDE/components/AssetList.jsx b/client/modules/IDE/components/AssetList.jsx index 58d3909c..da834dc2 100644 --- a/client/modules/IDE/components/AssetList.jsx +++ b/client/modules/IDE/components/AssetList.jsx @@ -127,7 +127,8 @@ AssetListRowBase.propTypes = { url: PropTypes.string.isRequired, sketchId: PropTypes.string, sketchName: PropTypes.string, - name: PropTypes.string.isRequired + name: PropTypes.string.isRequired, + size: PropTypes.number.isRequired }).isRequired, deleteAssetRequest: PropTypes.func.isRequired, username: PropTypes.string.isRequired @@ -172,13 +173,9 @@ class AssetList extends React.Component { } render() { - const { assetList, totalSize } = this.props; + const { assetList } = this.props; return (
- {/* Eventually, this copy should be Total / 250 MB Used */} - {this.hasAssets() && totalSize && -

{`${prettyBytes(totalSize)} Total`}

- } {this.getAssetsTitle()} @@ -188,7 +185,7 @@ class AssetList extends React.Component { - + @@ -214,20 +211,14 @@ AssetList.propTypes = { sketchName: PropTypes.string, sketchId: PropTypes.string })).isRequired, - totalSize: PropTypes.number, getAssets: PropTypes.func.isRequired, loading: PropTypes.bool.isRequired }; -AssetList.defaultProps = { - totalSize: undefined -}; - function mapStateToProps(state) { return { user: state.user, assetList: state.assets.list, - totalSize: state.user.totalSize, loading: state.loading }; } diff --git a/client/modules/IDE/components/AssetSize.jsx b/client/modules/IDE/components/AssetSize.jsx index db083708..2e4c1282 100644 --- a/client/modules/IDE/components/AssetSize.jsx +++ b/client/modules/IDE/components/AssetSize.jsx @@ -3,8 +3,9 @@ import React from 'react'; import { connect } from 'react-redux'; import prettyBytes from 'pretty-bytes'; -const MB_TO_B = 1000 * 1000; -const MAX_SIZE_B = 250 * MB_TO_B; +const __process = (typeof global !== 'undefined' ? global : window).process; +const limit = __process.env.UPLOAD_LIMIT || 250000000; +const MAX_SIZE_B = limit; const formatPercent = (percent) => { const percentUsed = percent * 100; @@ -17,7 +18,7 @@ const formatPercent = (percent) => { /* Eventually, this copy should be Total / 250 MB Used */ const AssetSize = ({ totalSize }) => { - if (!totalSize) { + if (totalSize === undefined) { return null; } @@ -25,9 +26,10 @@ const AssetSize = ({ totalSize }) => { const sizeLimit = prettyBytes(MAX_SIZE_B); const percentValue = totalSize / MAX_SIZE_B; const percent = formatPercent(percentValue); + const percentSize = percentValue < 1 ? percentValue : 1; return ( -
+

{currentSize} ({percent})

Max: {sizeLimit}

@@ -42,7 +44,7 @@ AssetSize.propTypes = { function mapStateToProps(state) { return { user: state.user, - totalSize: state.assets.totalSize, + totalSize: state.user.totalSize || state.assets.totalSize, }; } diff --git a/client/modules/IDE/components/FileUploader.jsx b/client/modules/IDE/components/FileUploader.jsx index 50fe6062..c9515f5c 100644 --- a/client/modules/IDE/components/FileUploader.jsx +++ b/client/modules/IDE/components/FileUploader.jsx @@ -30,7 +30,7 @@ class FileUploader extends React.Component { thumbnailWidth: 200, thumbnailHeight: 200, acceptedFiles: fileExtensionsAndMimeTypes, - dictDefaultMessage: 'Drop files here to upload or click to use the file browser', + dictDefaultMessage: 'Drop files here or click to use the file browser', accept: this.props.dropzoneAcceptCallback.bind(this, userId), sending: this.props.dropzoneSendingCallback, complete: this.props.dropzoneCompleteCallback diff --git a/client/modules/IDE/components/Sidebar.jsx b/client/modules/IDE/components/Sidebar.jsx index 61c61515..9a57ff4a 100644 --- a/client/modules/IDE/components/Sidebar.jsx +++ b/client/modules/IDE/components/Sidebar.jsx @@ -117,7 +117,7 @@ class Sidebar extends React.Component {
NameName Size Sketch