diff --git a/client/build/components/DropzoneDropItDisplay/index.js b/client/build/components/DropzoneDropItDisplay/index.js new file mode 100644 index 00000000..35c9dc5f --- /dev/null +++ b/client/build/components/DropzoneDropItDisplay/index.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var DropzoneDropItDisplay = function DropzoneDropItDisplay() { + return _react.default.createElement("div", { + className: "dropzone-dropit-display" + }, _react.default.createElement("p", { + className: "blue" + }, "Drop it.")); +}; + +var _default = DropzoneDropItDisplay; +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/DropzoneInstructionsDisplay/index.js b/client/build/components/DropzoneInstructionsDisplay/index.js new file mode 100644 index 00000000..dddd9bee --- /dev/null +++ b/client/build/components/DropzoneInstructionsDisplay/index.js @@ -0,0 +1,27 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var DropzoneInstructionsDisplay = function DropzoneInstructionsDisplay(_ref) { + var fileError = _ref.fileError; + return _react.default.createElement("div", { + className: "dropzone-instructions-display" + }, _react.default.createElement("p", { + className: "info-message-placeholder info-message--failure", + id: "input-error-file-selection" + }, fileError), _react.default.createElement("p", null, "Drag & drop image or video here to publish"), _react.default.createElement("p", { + className: "fine-print" + }, "OR"), _react.default.createElement("p", { + className: "blue--underlined" + }, "CHOOSE FILE")); +}; + +var _default = DropzoneInstructionsDisplay; +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/DropzonePreview/index.js b/client/build/components/DropzonePreview/index.js new file mode 100644 index 00000000..e1c2bba1 --- /dev/null +++ b/client/build/components/DropzonePreview/index.js @@ -0,0 +1,123 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); } + +var PublishPreview = +/*#__PURE__*/ +function (_React$Component) { + function PublishPreview(props) { + var _this; + + _classCallCheck(this, PublishPreview); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(PublishPreview).call(this, props)); + _this.state = { + imgSource: '', + defaultThumbnail: '/assets/img/video_thumb_default.png' + }; + return _this; + } + + _createClass(PublishPreview, [{ + key: "componentDidMount", + value: function componentDidMount() { + this.setPreviewImageSource(this.props.file); + } + }, { + key: "componentWillReceiveProps", + value: function componentWillReceiveProps(newProps) { + if (newProps.file !== this.props.file) { + this.setPreviewImageSource(newProps.file); + } + + if (newProps.thumbnail !== this.props.thumbnail) { + if (newProps.thumbnail) { + this.setPreviewImageSourceFromFile(newProps.thumbnail); + } else { + this.setState({ + imgSource: this.state.defaultThumbnail + }); + } + } + } + }, { + key: "setPreviewImageSourceFromFile", + value: function setPreviewImageSourceFromFile(file) { + var _this2 = this; + + var previewReader = new FileReader(); + previewReader.readAsDataURL(file); + + previewReader.onloadend = function () { + _this2.setState({ + imgSource: previewReader.result + }); + }; + } + }, { + key: "setPreviewImageSource", + value: function setPreviewImageSource(file) { + if (file.type !== 'video/mp4') { + this.setPreviewImageSourceFromFile(file); + } else { + if (this.props.thumbnail) { + this.setPreviewImageSourceFromFile(this.props.thumbnail); + } + + this.setState({ + imgSource: this.state.defaultThumbnail + }); + } + } + }, { + key: "render", + value: function render() { + return _react.default.createElement("img", { + id: "dropzone-preview", + src: this.state.imgSource, + className: this.props.dimPreview ? 'publish-preview-dim' : '', + alt: "publish preview" + }); + } + }]); + + _inherits(PublishPreview, _React$Component); + + return PublishPreview; +}(_react.default.Component); + +; +PublishPreview.propTypes = { + dimPreview: _propTypes.default.bool.isRequired, + file: _propTypes.default.object.isRequired, + thumbnail: _propTypes.default.object +}; +var _default = PublishPreview; +exports.default = _default; \ No newline at end of file diff --git a/client/build/components/HorizontalSplit/index.js b/client/build/components/HorizontalSplit/index.js index e39304d1..8e6a8b9f 100644 --- a/client/build/components/HorizontalSplit/index.js +++ b/client/build/components/HorizontalSplit/index.js @@ -7,8 +7,6 @@ exports.default = void 0; var _react = _interopRequireDefault(require("react")); -var _styleCss = _interopRequireDefault(require("./style.css.js")); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -47,11 +45,11 @@ function (_React$Component) { key: "render", value: function render() { return _react.default.createElement("div", { - style: _styleCss.default.wrapper + className: 'horizontal-split' }, _react.default.createElement("div", { - style: _styleCss.default.column + className: 'column' }, this.props.leftSide), _react.default.createElement("div", { - style: _styleCss.default.column + className: 'column' }, this.props.rightSide)); } }]); diff --git a/client/build/components/HorizontalSplit/style.css.js b/client/build/components/HorizontalSplit/style.css.js deleted file mode 100644 index 1192b895..00000000 --- a/client/build/components/HorizontalSplit/style.css.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var wrapper = { - display: 'flex', - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'flex-start' -}; -var column = { - width: '45%' -}; -var _default = { - wrapper: wrapper, - column: column -}; -exports.default = _default; \ No newline at end of file diff --git a/client/build/components/PageContent/index.js b/client/build/components/PageContent/index.js index 45c61980..08dc5387 100644 --- a/client/build/components/PageContent/index.js +++ b/client/build/components/PageContent/index.js @@ -7,8 +7,6 @@ exports.default = void 0; var _react = _interopRequireDefault(require("react")); -var _styleCss = _interopRequireDefault(require("./style.css.js")); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -47,8 +45,7 @@ function (_React$Component) { key: "render", value: function render() { return _react.default.createElement("div", { - style: _styleCss.default, - className: 'row--tall flex-container--column' + className: 'page-content' }, this.props.children); } }]); diff --git a/client/build/components/PageContent/style.css.js b/client/build/components/PageContent/style.css.js index 3a4cac57..3009ebc8 100644 --- a/client/build/components/PageContent/style.css.js +++ b/client/build/components/PageContent/style.css.js @@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; var style = { - margin: '2em', - backgroundColor: 'red' + margin: '2em' // backgroundColor: 'red', + }; var _default = style; exports.default = _default; \ No newline at end of file diff --git a/client/build/components/PublishPreview/index.js b/client/build/components/PublishPreview/index.js index e1c2bba1..ddabae91 100644 --- a/client/build/components/PublishPreview/index.js +++ b/client/build/components/PublishPreview/index.js @@ -7,7 +7,13 @@ exports.default = void 0; var _react = _interopRequireDefault(require("react")); -var _propTypes = _interopRequireDefault(require("prop-types")); +var _HorizontalSplit = _interopRequireDefault(require("@components/HorizontalSplit")); + +var _Dropzone = _interopRequireDefault(require("@containers/Dropzone")); + +var _PublishDetails = _interopRequireDefault(require("@containers/PublishDetails")); + +var _PublishTitleInput = _interopRequireDefault(require("@containers/PublishTitleInput")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -32,79 +38,19 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || functio var PublishPreview = /*#__PURE__*/ function (_React$Component) { - function PublishPreview(props) { - var _this; - + function PublishPreview() { _classCallCheck(this, PublishPreview); - _this = _possibleConstructorReturn(this, _getPrototypeOf(PublishPreview).call(this, props)); - _this.state = { - imgSource: '', - defaultThumbnail: '/assets/img/video_thumb_default.png' - }; - return _this; + return _possibleConstructorReturn(this, _getPrototypeOf(PublishPreview).apply(this, arguments)); } _createClass(PublishPreview, [{ - key: "componentDidMount", - value: function componentDidMount() { - this.setPreviewImageSource(this.props.file); - } - }, { - key: "componentWillReceiveProps", - value: function componentWillReceiveProps(newProps) { - if (newProps.file !== this.props.file) { - this.setPreviewImageSource(newProps.file); - } - - if (newProps.thumbnail !== this.props.thumbnail) { - if (newProps.thumbnail) { - this.setPreviewImageSourceFromFile(newProps.thumbnail); - } else { - this.setState({ - imgSource: this.state.defaultThumbnail - }); - } - } - } - }, { - key: "setPreviewImageSourceFromFile", - value: function setPreviewImageSourceFromFile(file) { - var _this2 = this; - - var previewReader = new FileReader(); - previewReader.readAsDataURL(file); - - previewReader.onloadend = function () { - _this2.setState({ - imgSource: previewReader.result - }); - }; - } - }, { - key: "setPreviewImageSource", - value: function setPreviewImageSource(file) { - if (file.type !== 'video/mp4') { - this.setPreviewImageSourceFromFile(file); - } else { - if (this.props.thumbnail) { - this.setPreviewImageSourceFromFile(this.props.thumbnail); - } - - this.setState({ - imgSource: this.state.defaultThumbnail - }); - } - } - }, { key: "render", value: function render() { - return _react.default.createElement("img", { - id: "dropzone-preview", - src: this.state.imgSource, - className: this.props.dimPreview ? 'publish-preview-dim' : '', - alt: "publish preview" - }); + return _react.default.createElement("div", null, _react.default.createElement(_PublishTitleInput.default, null), _react.default.createElement(_HorizontalSplit.default, { + leftSide: _react.default.createElement(_Dropzone.default, null), + rightSide: _react.default.createElement(_PublishDetails.default, null) + })); } }]); @@ -114,10 +60,5 @@ function (_React$Component) { }(_react.default.Component); ; -PublishPreview.propTypes = { - dimPreview: _propTypes.default.bool.isRequired, - file: _propTypes.default.object.isRequired, - thumbnail: _propTypes.default.object -}; var _default = PublishPreview; exports.default = _default; \ No newline at end of file diff --git a/client/build/containers/Dropzone/view.js b/client/build/containers/Dropzone/view.js index 6135b2f4..5ba76d3c 100644 --- a/client/build/containers/Dropzone/view.js +++ b/client/build/containers/Dropzone/view.js @@ -9,7 +9,11 @@ var _react = _interopRequireDefault(require("react")); var _file = require("../../utils/file"); -var _PublishPreview = _interopRequireDefault(require("@components/PublishPreview")); +var _DropzonePreview = _interopRequireDefault(require("@components/DropzonePreview")); + +var _DropzoneDropItDisplay = _interopRequireDefault(require("@components/DropzoneDropItDisplay")); + +var _DropzoneInstructionsDisplay = _interopRequireDefault(require("@components/DropzoneInstructionsDisplay")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -156,7 +160,7 @@ function (_React$Component) { key: "render", value: function render() { return _react.default.createElement("div", { - className: "row row--tall flex-container--column" + className: "dropzone-wrapper" }, _react.default.createElement("form", null, _react.default.createElement("input", { className: "input-file", type: "file", @@ -166,8 +170,7 @@ function (_React$Component) { onChange: this.handleFileInput, encType: "multipart/form-data" })), _react.default.createElement("div", { - id: "preview-dropzone", - className: 'row row--padded row--tall dropzone' + (this.state.dragOver ? ' dropzone--drag-over' : ''), + className: 'dropzone' + (this.state.dragOver ? ' dropzone--drag-over' : ''), onDrop: this.handleDrop, onDragOver: this.handleDragOver, onDragEnd: this.handleDragEnd, @@ -176,43 +179,15 @@ function (_React$Component) { onMouseEnter: this.handleMouseEnter, onMouseLeave: this.handleMouseLeave, onClick: this.handleClick - }, this.props.file ? _react.default.createElement("div", null, _react.default.createElement(_PublishPreview.default, { + }, this.props.file ? _react.default.createElement("div", null, _react.default.createElement(_DropzonePreview.default, { dimPreview: this.state.dimPreview, file: this.props.file, thumbnail: this.props.thumbnail - }), _react.default.createElement("div", { - id: "dropzone-text-holder", - className: 'flex-container--column flex-container--center-center' - }, this.state.dragOver ? _react.default.createElement("div", { - id: "dropzone-dragover" - }, _react.default.createElement("p", { - className: "blue" - }, "Drop it.")) : null, this.state.mouseOver ? _react.default.createElement("div", { - id: "dropzone-instructions" - }, _react.default.createElement("p", { - className: "info-message-placeholder info-message--failure", - id: "input-error-file-selection" - }, this.props.fileError), _react.default.createElement("p", null, "Drag & drop image or video here to publish"), _react.default.createElement("p", { - className: "fine-print" - }, "OR"), _react.default.createElement("p", { - className: "blue--underlined" - }, "CHOOSE FILE")) : null)) : _react.default.createElement("div", { - id: "dropzone-text-holder", - className: 'flex-container--column flex-container--center-center' - }, this.state.dragOver ? _react.default.createElement("div", { - id: "dropzone-dragover" - }, _react.default.createElement("p", { - className: "blue" - }, "Drop it.")) : _react.default.createElement("div", { - id: "dropzone-instructions" - }, _react.default.createElement("p", { - className: "info-message-placeholder info-message--failure", - id: "input-error-file-selection" - }, this.props.fileError), _react.default.createElement("p", null, "Drag & drop image or video here to publish"), _react.default.createElement("p", { - className: "fine-print" - }, "OR"), _react.default.createElement("p", { - className: "blue--underlined" - }, "CHOOSE FILE"))))); + }), this.state.dragOver ? _react.default.createElement(_DropzoneDropItDisplay.default, null) : null, this.state.mouseOver ? _react.default.createElement(_DropzoneInstructionsDisplay.default, { + fileError: this.props.fileError + }) : null) : this.state.dragOver ? _react.default.createElement(_DropzoneDropItDisplay.default, null) : _react.default.createElement(_DropzoneInstructionsDisplay.default, { + fileError: this.props.fileError + }))); } }]); diff --git a/client/build/containers/PublishDetails/view.js b/client/build/containers/PublishDetails/view.js index dfbcaf1e..c0c6fd50 100644 --- a/client/build/containers/PublishDetails/view.js +++ b/client/build/containers/PublishDetails/view.js @@ -9,8 +9,6 @@ var _react = _interopRequireDefault(require("react")); var _reactRouterDom = require("react-router-dom"); -var _Dropzone = _interopRequireDefault(require("@containers/Dropzone")); - var _PublishTitleInput = _interopRequireDefault(require("@containers/PublishTitleInput")); var _PublishUrlInput = _interopRequireDefault(require("@containers/PublishUrlInput")); @@ -63,16 +61,6 @@ function (_React$Component) { key: "render", value: function render() { return _react.default.createElement("div", { - className: "row row--no-bottom" - }, _react.default.createElement("div", { - className: "column column--10" - }, _react.default.createElement(_PublishTitleInput.default, null)), _react.default.createElement("div", { - className: "column column--5 column--sml-10" - }, _react.default.createElement("div", { - className: "row row--padded" - }, _react.default.createElement(_Dropzone.default, null))), _react.default.createElement("div", { - className: "column column--5 column--sml-10 align-content-top" - }, _react.default.createElement("div", { id: "publish-active-area", className: "row row--padded" }, _react.default.createElement("div", { @@ -102,7 +90,7 @@ function (_React$Component) { className: "link--primary", target: "_blank", href: "https://lbry.io/learn" - }, "Read more.")))))); + }, "Read more.")))); } }]); diff --git a/client/build/containers/PublishTool/view.js b/client/build/containers/PublishTool/view.js index 0f678730..56990247 100644 --- a/client/build/containers/PublishTool/view.js +++ b/client/build/containers/PublishTool/view.js @@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react")); var _Dropzone = _interopRequireDefault(require("@containers/Dropzone")); -var _PublishDetails = _interopRequireDefault(require("@containers/PublishDetails")); +var _PublishPreview = _interopRequireDefault(require("@components/PublishPreview")); var _PublishStatus = _interopRequireDefault(require("@containers/PublishStatus")); @@ -54,7 +54,7 @@ function (_React$Component) { if (this.props.status) { return _react.default.createElement(_PublishStatus.default, null); } else { - return _react.default.createElement(_PublishDetails.default, null); + return _react.default.createElement(_PublishPreview.default, null); } } diff --git a/client/scss/_dropzone.scss b/client/scss/_dropzone.scss deleted file mode 100644 index 9d083d26..00000000 --- a/client/scss/_dropzone.scss +++ /dev/null @@ -1,28 +0,0 @@ -.dropzone, .dropzone--disabled { - border: 2px dashed #9b9b9b; - text-align: center; - position: relative; -} - -.dropzone:hover, .dropzone--drag-over { - border: 2px dashed #4156C5; - cursor: pointer; -} - -#dropzone-text-holder { - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 100%; -} - -#dropzone-dragover, #dropzone-instructions { - padding: 1em; -} - -#dropzone-preview { - display: block; - width: 100%; -} - diff --git a/client/scss/all.scss b/client/scss/all.scss index 3338e27a..303f7dbd 100644 --- a/client/scss/all.scss +++ b/client/scss/all.scss @@ -7,18 +7,20 @@ @import '_tooltip'; @import '_link'; @import '_row'; -@import '_column'; +//@import '_column'; @import '_info-message'; @import '_input'; @import '_button'; @import '_span'; @import '_video'; -@import 'asset'; -@import 'asset-preview'; -@import 'dropzone'; -@import 'nav-bar'; -@import 'progress-bar'; -@import 'publish-preview'; -@import 'media-queries'; +@import '_asset'; +@import '_asset-preview'; +@import 'containers/_dropzone'; +@import '_nav-bar'; +@import '_progress-bar'; +@import '_publish-preview'; +@import 'components/_horizontal-split'; +@import 'components/_page-content'; +@import '_media-queries'; diff --git a/client/scss/components/_horizontal-split.scss b/client/scss/components/_horizontal-split.scss new file mode 100644 index 00000000..8df3339d --- /dev/null +++ b/client/scss/components/_horizontal-split.scss @@ -0,0 +1,9 @@ +.horizontal-split { + display : flex; + flex-direction : row; + justify-content: space-between; + align-items : flex-start; + .column { + width: calc(50% - 1em); + } +}; diff --git a/client/scss/components/_page-content.scss b/client/scss/components/_page-content.scss new file mode 100644 index 00000000..4483d481 --- /dev/null +++ b/client/scss/components/_page-content.scss @@ -0,0 +1,10 @@ +.page-content { + margin: 2em; + background-color: blue; + // fill the parent flex container + flex: 1 0 auto; + // be a flex container for children + display: flex; + -webkit-flex-direction: column; + flex-direction: column; +}; diff --git a/client/scss/containers/_dropzone.scss b/client/scss/containers/_dropzone.scss new file mode 100644 index 00000000..2e365f3f --- /dev/null +++ b/client/scss/containers/_dropzone.scss @@ -0,0 +1,38 @@ +.dropzone-wrapper { + background-color: yellow; + // fill the parent flex container + flex: 1 0 auto; + // be a flex container for children + display: flex; + flex-direction: column; +} + +.dropzone { + border: 2px dashed #9b9b9b; + background-color: red; + // fill the parent flex container + flex: 1 0 auto; + // be a flex container for children + display: flex; + -webkit-flex-direction: column; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.dropzone:hover, .dropzone--active { + border: 2px dashed #4156C5; + cursor: pointer; +} + +.dropzone-dropit-display, .dropzone-instructions-display { + padding: 1em; + text-align: center; +} + +#dropzone-preview { + display: block; + padding: 1em; + width: calc(100% - 2em); +} + diff --git a/client/src/components/DropzoneDropItDisplay/index.jsx b/client/src/components/DropzoneDropItDisplay/index.jsx new file mode 100644 index 00000000..a699039b --- /dev/null +++ b/client/src/components/DropzoneDropItDisplay/index.jsx @@ -0,0 +1,11 @@ +import React from 'react'; + +const DropzoneDropItDisplay = () => { + return ( +
+

Drop it.

+
+ ); +} + +export default DropzoneDropItDisplay; diff --git a/client/src/components/DropzoneInstructionsDisplay/index.jsx b/client/src/components/DropzoneInstructionsDisplay/index.jsx new file mode 100644 index 00000000..26c45d3d --- /dev/null +++ b/client/src/components/DropzoneInstructionsDisplay/index.jsx @@ -0,0 +1,14 @@ +import React from 'react'; + +const DropzoneInstructionsDisplay = ({fileError}) => { + return ( +
+

{fileError}

+

Drag & drop image or video here to publish

+

OR

+

CHOOSE FILE

+
+ ); +}; + +export default DropzoneInstructionsDisplay; diff --git a/client/src/components/DropzonePreview/index.jsx b/client/src/components/DropzonePreview/index.jsx new file mode 100644 index 00000000..b6f475ab --- /dev/null +++ b/client/src/components/DropzonePreview/index.jsx @@ -0,0 +1,62 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +class PublishPreview extends React.Component { + constructor (props) { + super(props); + this.state = { + imgSource : '', + defaultThumbnail: '/assets/img/video_thumb_default.png', + }; + } + componentDidMount () { + this.setPreviewImageSource(this.props.file); + } + componentWillReceiveProps (newProps) { + if (newProps.file !== this.props.file) { + this.setPreviewImageSource(newProps.file); + } + if (newProps.thumbnail !== this.props.thumbnail) { + if (newProps.thumbnail) { + this.setPreviewImageSourceFromFile(newProps.thumbnail); + } else { + this.setState({imgSource: this.state.defaultThumbnail}); + } + } + } + setPreviewImageSourceFromFile (file) { + const previewReader = new FileReader(); + previewReader.readAsDataURL(file); + previewReader.onloadend = () => { + this.setState({imgSource: previewReader.result}); + }; + } + setPreviewImageSource (file) { + if (file.type !== 'video/mp4') { + this.setPreviewImageSourceFromFile(file); + } else { + if (this.props.thumbnail) { + this.setPreviewImageSourceFromFile(this.props.thumbnail); + } + this.setState({imgSource: this.state.defaultThumbnail}); + } + } + render () { + return ( + publish preview + ); + } +}; + +PublishPreview.propTypes = { + dimPreview: PropTypes.bool.isRequired, + file : PropTypes.object.isRequired, + thumbnail : PropTypes.object, +}; + +export default PublishPreview; diff --git a/client/src/components/HorizontalSplit/index.jsx b/client/src/components/HorizontalSplit/index.jsx index 6e0666a4..cac2afae 100644 --- a/client/src/components/HorizontalSplit/index.jsx +++ b/client/src/components/HorizontalSplit/index.jsx @@ -1,18 +1,16 @@ import React from 'react'; -import style from './style.css.js'; - class HorizontalSplit extends React.Component { shouldComponentUpdate () { return false; } render () { return ( -
-
+
+
{this.props.leftSide}
-
+
{this.props.rightSide}
diff --git a/client/src/components/HorizontalSplit/style.css.js b/client/src/components/HorizontalSplit/style.css.js deleted file mode 100644 index 5f52aef3..00000000 --- a/client/src/components/HorizontalSplit/style.css.js +++ /dev/null @@ -1,15 +0,0 @@ -const wrapper = { - display : 'flex', - flexDirection : 'row', - justifyContent: 'space-between', - alignItems : 'flex-start', -}; - -const column = { - width: '45%', -}; - -export default { - wrapper, - column, -}; diff --git a/client/src/components/PageContent/index.jsx b/client/src/components/PageContent/index.jsx index 3af1e543..2aa48acd 100644 --- a/client/src/components/PageContent/index.jsx +++ b/client/src/components/PageContent/index.jsx @@ -1,14 +1,12 @@ import React from 'react'; -import style from './style.css.js'; - class PageContent extends React.Component { shouldComponentUpdate () { return false; } render () { return ( -
+
{this.props.children}
); diff --git a/client/src/components/PageContent/style.css.js b/client/src/components/PageContent/style.css.js deleted file mode 100644 index 0fe250ea..00000000 --- a/client/src/components/PageContent/style.css.js +++ /dev/null @@ -1,6 +0,0 @@ -const style = { - margin : '2em', - backgroundColor: 'red', -}; - -export default style; diff --git a/client/src/components/PublishPreview/index.jsx b/client/src/components/PublishPreview/index.jsx index b6f475ab..c11ee0ff 100644 --- a/client/src/components/PublishPreview/index.jsx +++ b/client/src/components/PublishPreview/index.jsx @@ -1,62 +1,21 @@ import React from 'react'; -import PropTypes from 'prop-types'; +import HorizontalSplit from '@components/HorizontalSplit'; +import Dropzone from '@containers/Dropzone'; +import PublishDetails from '@containers/PublishDetails'; +import PublishTitleInput from '@containers/PublishTitleInput'; class PublishPreview extends React.Component { - constructor (props) { - super(props); - this.state = { - imgSource : '', - defaultThumbnail: '/assets/img/video_thumb_default.png', - }; - } - componentDidMount () { - this.setPreviewImageSource(this.props.file); - } - componentWillReceiveProps (newProps) { - if (newProps.file !== this.props.file) { - this.setPreviewImageSource(newProps.file); - } - if (newProps.thumbnail !== this.props.thumbnail) { - if (newProps.thumbnail) { - this.setPreviewImageSourceFromFile(newProps.thumbnail); - } else { - this.setState({imgSource: this.state.defaultThumbnail}); - } - } - } - setPreviewImageSourceFromFile (file) { - const previewReader = new FileReader(); - previewReader.readAsDataURL(file); - previewReader.onloadend = () => { - this.setState({imgSource: previewReader.result}); - }; - } - setPreviewImageSource (file) { - if (file.type !== 'video/mp4') { - this.setPreviewImageSourceFromFile(file); - } else { - if (this.props.thumbnail) { - this.setPreviewImageSourceFromFile(this.props.thumbnail); - } - this.setState({imgSource: this.state.defaultThumbnail}); - } - } render () { return ( - publish preview +
+ + } + rightSide={} + /> +
); } }; -PublishPreview.propTypes = { - dimPreview: PropTypes.bool.isRequired, - file : PropTypes.object.isRequired, - thumbnail : PropTypes.object, -}; - export default PublishPreview; diff --git a/client/src/containers/Dropzone/view.jsx b/client/src/containers/Dropzone/view.jsx index 81ea9c83..a6ff9f04 100644 --- a/client/src/containers/Dropzone/view.jsx +++ b/client/src/containers/Dropzone/view.jsx @@ -1,6 +1,8 @@ import React from 'react'; import { validateFile } from '../../utils/file'; -import PublishPreview from '@components/PublishPreview'; +import DropzonePreview from '@components/DropzonePreview'; +import DropzoneDropItDisplay from '@components/DropzoneDropItDisplay'; +import DropzoneInstructionsDisplay from '@components/DropzoneInstructionsDisplay'; class Dropzone extends React.Component { constructor (props) { @@ -80,53 +82,48 @@ class Dropzone extends React.Component { } render () { return ( -
+
- +
-
+
{this.props.file ? (
- -
- { this.state.dragOver ? ( -
-

Drop it.

-
- ) : ( - null - )} - { this.state.mouseOver ? ( -
-

{this.props.fileError}

-

Drag & drop image or video here to publish

-

OR

-

CHOOSE FILE

-
- ) : ( - null - )} -
+ { this.state.dragOver ? : null } + { this.state.mouseOver ? ( + + ) : null }
) : ( -
- { this.state.dragOver ? ( -
-

Drop it.

-
- ) : ( -
-

{this.props.fileError}

-

Drag & drop image or video here to publish

-

OR

-

CHOOSE FILE

-
- )} -
+ this.state.dragOver ? : ( + + ) )}
diff --git a/client/src/containers/PublishDetails/view.jsx b/client/src/containers/PublishDetails/view.jsx index ec2e3ad5..bdcae41d 100644 --- a/client/src/containers/PublishDetails/view.jsx +++ b/client/src/containers/PublishDetails/view.jsx @@ -1,6 +1,5 @@ import React from 'react'; import { withRouter } from 'react-router-dom'; -import Dropzone from '@containers/Dropzone'; import PublishTitleInput from '@containers/PublishTitleInput'; import PublishUrlInput from '@containers/PublishUrlInput'; import PublishThumbnailInput from '@containers/PublishThumbnailInput'; @@ -17,43 +16,29 @@ class PublishDetails extends React.Component { } render () { return ( -
-
- +
+
+
- {/* left column */} -
-
- -
+
+
- {/* right column */} -
-
-
- -
-
- -
- { (this.props.file.type === 'video/mp4') && ( -
- -
- )} -
- -
-
- -
-
- -
-
-

By clicking 'Publish', you affirm that you have the rights to publish this content to the LBRY network, and that you understand the properties of publishing it to a decentralized, user-controlled network. Read more.

-
+ { (this.props.file.type === 'video/mp4') && ( +
+
+ )} +
+ +
+
+ +
+
+ +
+
+

By clicking 'Publish', you affirm that you have the rights to publish this content to the LBRY network, and that you understand the properties of publishing it to a decentralized, user-controlled network. Read more.

); diff --git a/client/src/containers/PublishTool/view.jsx b/client/src/containers/PublishTool/view.jsx index e109ae82..b628911a 100644 --- a/client/src/containers/PublishTool/view.jsx +++ b/client/src/containers/PublishTool/view.jsx @@ -1,6 +1,6 @@ import React from 'react'; import Dropzone from '@containers/Dropzone'; -import PublishDetails from '@containers/PublishDetails'; +import PublishPreview from '@components/PublishPreview'; import PublishStatus from '@containers/PublishStatus'; import PublishDisabledMessage from '@containers/PublishDisabledMessage'; @@ -17,7 +17,7 @@ class PublishTool extends React.Component { ); } else { - return ; + return ; } } return ;