moved some components to container folder
This commit is contained in:
parent
4e02f34f95
commit
70a65a243a
15 changed files with 35 additions and 41 deletions
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ChannelLoginForm from './ChannelLoginForm.jsx';
|
import ChannelLoginForm from '../containers/ChannelLoginForm.jsx';
|
||||||
import ChannelCreateForm from './ChannelCreateForm.jsx';
|
import ChannelCreateForm from '../containers/ChannelCreateForm.jsx';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
const LOGIN = 'login';
|
const LOGIN = 'login';
|
||||||
|
@ -16,7 +16,7 @@ class ChannelSelector extends React.Component {
|
||||||
this.selectOption = this.selectOption.bind(this);
|
this.selectOption = this.selectOption.bind(this);
|
||||||
}
|
}
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
console.log('ChannelSelector will mount.');
|
console.log('ChannelSelector will mount');
|
||||||
if (this.props.loggedInChannelName) {
|
if (this.props.loggedInChannelName) {
|
||||||
this.selectOption(this.props.loggedInChannelName);
|
this.selectOption(this.props.loggedInChannelName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,7 @@ class Preview extends React.Component {
|
||||||
}
|
}
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
console.log('Preview will mount');
|
console.log('Preview will mount');
|
||||||
if (this.props.file) {
|
this.previewFile(this.props.file);
|
||||||
this.previewFile(this.props.file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
componentWillReceiveProps (newProps) {
|
componentWillReceiveProps (newProps) {
|
||||||
console.log('Preview will receive props', newProps);
|
console.log('Preview will receive props', newProps);
|
||||||
|
@ -44,11 +42,4 @@ class Preview extends React.Component {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
export default Preview;
|
||||||
return {
|
|
||||||
file : state.file,
|
|
||||||
thumbnail: state.metadata.thumbnail,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, null)(Preview);
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { setPublishInChannel } from '../actions';
|
import { setPublishInChannel } from '../actions/index';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
class AnonymousOrChannelSelect extends React.Component {
|
class AnonymousOrChannelSelect extends React.Component {
|
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import {updateLoggedInChannel} from '../actions';
|
import {updateLoggedInChannel} from '../actions/index';
|
||||||
import { makeGetRequest, makePostRequest } from '../utils/xhr.js';
|
import { makeGetRequest, makePostRequest } from '../utils/xhr.js';
|
||||||
import { setUserCookies } from '../utils/cookies.js';
|
import { setUserCookies } from '../utils/cookies.js';
|
||||||
import { replaceChannelSelectionInNavBar } from '../utils/pageUpdate.js';
|
import { replaceChannelSelectionInNavBar } from '../utils/pageUpdate.js';
|
||||||
|
@ -10,8 +10,8 @@ class ChannelCreateForm extends React.Component {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
error : null,
|
error : null,
|
||||||
channel : null,
|
channel : '',
|
||||||
password: null,
|
password: '',
|
||||||
status : null,
|
status : null,
|
||||||
};
|
};
|
||||||
this.cleanseChannelInput = this.cleanseChannelInput.bind(this);
|
this.cleanseChannelInput = this.cleanseChannelInput.bind(this);
|
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { makePostRequest } from '../utils/xhr.js';
|
import { makePostRequest } from '../utils/xhr.js';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { updateLoggedInChannel } from '../actions';
|
import { updateLoggedInChannel } from '../actions/index';
|
||||||
import { setUserCookies } from '../utils/cookies.js';
|
import { setUserCookies } from '../utils/cookies.js';
|
||||||
import { replaceChannelSelectionInNavBar } from '../utils/pageUpdate.js';
|
import { replaceChannelSelectionInNavBar } from '../utils/pageUpdate.js';
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ class ChannelLoginForm extends React.Component {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
error : null,
|
error : null,
|
||||||
name : null,
|
name : '',
|
||||||
password: null,
|
password: '',
|
||||||
};
|
};
|
||||||
this.handleInput = this.handleInput.bind(this);
|
this.handleInput = this.handleInput.bind(this);
|
||||||
this.loginToChannel = this.loginToChannel.bind(this);
|
this.loginToChannel = this.loginToChannel.bind(this);
|
|
@ -1,12 +1,12 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
// import PropTypes from 'prop-types';
|
// import PropTypes from 'prop-types';
|
||||||
import { selectFile } from '../actions';
|
import { selectFile } from '../actions/index';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import Preview from './Preview.jsx';
|
import Preview from '../components/Preview.jsx';
|
||||||
|
|
||||||
import { validateFile } from '../utils/file.js';
|
import { validateFile } from '../utils/file.js';
|
||||||
|
|
||||||
class PreviewDropzone extends React.Component {
|
class Dropzone extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -95,7 +95,11 @@ class PreviewDropzone extends React.Component {
|
||||||
<div id="preview-dropzone" className={'row row--padded row--tall dropzone' + (this.state.dragOver ? ' dropzone--drag-over' : '')} onDrop={this.handleDrop} onDragOver={this.handleDragOver} onDragEnd={this.handleDragEnd} onDragEnter={this.handleDragEnter} onDragLeave={this.handleDragLeave} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} onClick={this.handleClick}>
|
<div id="preview-dropzone" className={'row row--padded row--tall dropzone' + (this.state.dragOver ? ' dropzone--drag-over' : '')} onDrop={this.handleDrop} onDragOver={this.handleDragOver} onDragEnd={this.handleDragEnd} onDragEnter={this.handleDragEnter} onDragLeave={this.handleDragLeave} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} onClick={this.handleClick}>
|
||||||
{this.props.file ? (
|
{this.props.file ? (
|
||||||
<div>
|
<div>
|
||||||
<Preview dimPreview={this.state.dimPreview}/>
|
<Preview
|
||||||
|
dimPreview={this.state.dimPreview}
|
||||||
|
file={this.props.file}
|
||||||
|
thumbnail={this.props.thumbnail}
|
||||||
|
/>
|
||||||
<div id="dropzone-text-holder" className={'flex-container--column flex-container--center-center'}>
|
<div id="dropzone-text-holder" className={'flex-container--column flex-container--center-center'}>
|
||||||
{ this.state.dragOver ? (
|
{ this.state.dragOver ? (
|
||||||
<div id="dropzone-dragover">
|
<div id="dropzone-dragover">
|
||||||
|
@ -140,7 +144,8 @@ class PreviewDropzone extends React.Component {
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
return {
|
return {
|
||||||
file: state.file,
|
file : state.file,
|
||||||
|
thumbnail: state.metadata.thumbnail,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -152,4 +157,4 @@ const mapDispatchToProps = dispatch => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(PreviewDropzone);
|
export default connect(mapStateToProps, mapDispatchToProps)(Dropzone);
|
|
@ -1,13 +1,13 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PreviewDropzone from './PreviewDropzone.jsx';
|
import PreviewDropzone from './Dropzone.jsx';
|
||||||
import PublishTitleInput from './PublishTitleInput.jsx';
|
import PublishTitleInput from './PublishTitleInput.jsx';
|
||||||
import ChannelSelector from './ChannelSelector.jsx';
|
import ChannelSelector from '../components/ChannelSelector.jsx';
|
||||||
import PublishUrlInput from './PublishUrlInput.jsx';
|
import PublishUrlInput from './PublishUrlInput.jsx';
|
||||||
import PublishThumbnailInput from './PublishThumbnailInput.jsx';
|
import PublishThumbnailInput from './PublishThumbnailInput.jsx';
|
||||||
import PublishMetadataInputs from './PublishMetadataInputs.jsx';
|
import PublishMetadataInputs from './PublishMetadataInputs.jsx';
|
||||||
import AnonymousOrChannelSelect from './AnonymousOrChannelSelect.jsx';
|
import AnonymousOrChannelSelect from './AnonymousOrChannelSelect.jsx';
|
||||||
|
|
||||||
import { selectFile, clearFile, updateLoggedInChannel } from '../actions';
|
import { selectFile, clearFile, updateLoggedInChannel } from '../actions/index';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { getCookie } from '../utils/cookies.js';
|
import { getCookie } from '../utils/cookies.js';
|
||||||
|
|
||||||
|
@ -16,8 +16,7 @@ class PublishForm extends React.Component {
|
||||||
super(props);
|
super(props);
|
||||||
// set defaults
|
// set defaults
|
||||||
this.state = {
|
this.state = {
|
||||||
error : null,
|
error: null,
|
||||||
showMetadataInputs: false,
|
|
||||||
};
|
};
|
||||||
this.publish = this.publish.bind(this);
|
this.publish = this.publish.bind(this);
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { updateMetadata } from '../actions';
|
import { updateMetadata } from '../actions/index';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const textarea = document.getElementById('publish-description');
|
const textarea = document.getElementById('publish-description');
|
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { updateMetadata } from '../actions';
|
import { updateMetadata } from '../actions/index';
|
||||||
|
|
||||||
class ThumbnailInput extends React.Component {
|
class ThumbnailInput extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {updateMetadata} from '../actions';
|
import {updateMetadata} from '../actions/index';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
|
|
||||||
class TitleInput extends React.Component {
|
class TitleInput extends React.Component {
|
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PreviewDropzone from './PreviewDropzone.jsx';
|
import PreviewDropzone from './Dropzone.jsx';
|
||||||
import PublishForm from './PublishForm.jsx';
|
import PublishForm from './PublishForm.jsx';
|
||||||
import PublishStatus from './PublishStatus.jsx';
|
import PublishStatus from '../components/PublishStatus.jsx';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
|
|
||||||
class PublishTool extends React.Component {
|
class PublishTool extends React.Component {
|
|
@ -1,8 +1,8 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { updateClaim } from '../actions';
|
import { updateClaim } from '../actions/index';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { makeGetRequest } from '../utils/xhr.js';
|
import { makeGetRequest } from '../utils/xhr.js';
|
||||||
import UrlMiddle from './UrlMiddle.jsx';
|
import UrlMiddle from '../components/PublishUrlMiddle.jsx';
|
||||||
|
|
||||||
class UrlChooser extends React.Component {
|
class UrlChooser extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
|
@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import { createStore } from 'redux';
|
import { createStore } from 'redux';
|
||||||
import Reducers from './reducers/index.js';
|
import Reducers from './reducers/index.js';
|
||||||
import PublishTool from './components/PublishTool.jsx';
|
import PublishTool from './containers/PublishTool.jsx';
|
||||||
|
|
||||||
let store = createStore(
|
let store = createStore(
|
||||||
Reducers,
|
Reducers,
|
||||||
|
|
|
@ -36,7 +36,6 @@ export default function (state = initialState, action) {
|
||||||
case FILE_CLEAR:
|
case FILE_CLEAR:
|
||||||
return initialState;
|
return initialState;
|
||||||
case METADATA_UPDATE:
|
case METADATA_UPDATE:
|
||||||
console.log(`reducer for ${action.name} ${action.value}`);
|
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
metadata: Object.assign({}, state.metadata, {
|
metadata: Object.assign({}, state.metadata, {
|
||||||
[action.name]: action.value,
|
[action.name]: action.value,
|
||||||
|
|
Loading…
Reference in a new issue