changed containers into folders
This commit is contained in:
parent
44557befbb
commit
2393fcc702
21 changed files with 252 additions and 222 deletions
13
react/containers/ChannelCreateForm/index.js
Normal file
13
react/containers/ChannelCreateForm/index.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { updateLoggedInChannel } from '../../actions';
|
||||
import View from './view.jsx';
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onChannelLogin: (name, shortId, longId) => {
|
||||
dispatch(updateLoggedInChannel(name, shortId, longId));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(null, mapDispatchToProps)(View);
|
|
@ -1,9 +1,7 @@
|
|||
import React from 'react';
|
||||
import {connect} from 'react-redux';
|
||||
import {updateLoggedInChannel} from '../actions/index';
|
||||
import { makeGetRequest, makePostRequest } from '../utils/xhr.js';
|
||||
import { setUserCookies } from '../utils/cookies.js';
|
||||
import { replaceChannelSelectionInNavBar } from '../utils/page.js';
|
||||
import { makeGetRequest, makePostRequest } from '../../utils/xhr.js';
|
||||
import { setUserCookies } from '../../utils/cookies.js';
|
||||
import { replaceChannelSelectionInNavBar } from '../../utils/page.js';
|
||||
|
||||
class ChannelCreateForm extends React.Component {
|
||||
constructor (props) {
|
||||
|
@ -162,12 +160,4 @@ class ChannelCreateForm extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onChannelLogin: (name, shortId, longId) => {
|
||||
dispatch(updateLoggedInChannel(name, shortId, longId));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(null, mapDispatchToProps)(ChannelCreateForm);
|
||||
export default ChannelCreateForm;
|
13
react/containers/ChannelLoginForm/index.js
Normal file
13
react/containers/ChannelLoginForm/index.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { updateLoggedInChannel } from '../../actions';
|
||||
import View from './view.jsx';
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onChannelLogin: (name, shortId, longId) => {
|
||||
dispatch(updateLoggedInChannel(name, shortId, longId));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(null, mapDispatchToProps)(View);
|
|
@ -1,9 +1,7 @@
|
|||
import React from 'react';
|
||||
import { makePostRequest } from '../utils/xhr.js';
|
||||
import { connect } from 'react-redux';
|
||||
import { updateLoggedInChannel } from '../actions/index';
|
||||
import { setUserCookies } from '../utils/cookies.js';
|
||||
import { replaceChannelSelectionInNavBar } from '../utils/page.js';
|
||||
import { makePostRequest } from '../../utils/xhr.js';
|
||||
import { setUserCookies } from '../../utils/cookies.js';
|
||||
import { replaceChannelSelectionInNavBar } from '../../utils/page.js';
|
||||
|
||||
class ChannelLoginForm extends React.Component {
|
||||
constructor (props) {
|
||||
|
@ -74,12 +72,4 @@ class ChannelLoginForm extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onChannelLogin: (name, shortId, longId) => {
|
||||
dispatch(updateLoggedInChannel(name, shortId, longId));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(null, mapDispatchToProps)(ChannelLoginForm);
|
||||
export default ChannelLoginForm;
|
20
react/containers/ChannelSelect/index.js
Normal file
20
react/containers/ChannelSelect/index.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
import {connect} from 'react-redux';
|
||||
import {setPublishInChannel} from '../../actions';
|
||||
import View from './view.jsx';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
loggedInChannelName: state.loggedInChannel.name,
|
||||
publishInChannel : state.publishInChannel,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onPublishInChannelChange: (value) => {
|
||||
dispatch(setPublishInChannel(value));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(View);
|
|
@ -1,12 +1,10 @@
|
|||
import React from 'react';
|
||||
import {setPublishInChannel} from '../actions';
|
||||
import {connect} from 'react-redux';
|
||||
import ChannelLoginForm from '../containers/ChannelLoginForm.jsx';
|
||||
import ChannelCreateForm from '../containers/ChannelCreateForm.jsx';
|
||||
import ChannelLoginForm from '../ChannelLoginForm';
|
||||
import ChannelCreateForm from '../ChannelCreateForm';
|
||||
const LOGIN = 'Existing';
|
||||
const CREATE = 'New';
|
||||
|
||||
class channelSelect extends React.Component {
|
||||
class ChannelSelect extends React.Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
|
@ -76,19 +74,4 @@ class channelSelect extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
loggedInChannelName: state.loggedInChannel.name,
|
||||
publishInChannel : state.publishInChannel,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onPublishInChannelChange: (value) => {
|
||||
dispatch(setPublishInChannel(value));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(channelSelect);
|
||||
export default ChannelSelect;
|
25
react/containers/Dropzone/index.js
Normal file
25
react/containers/Dropzone/index.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { selectFile, updateError } from '../../actions';
|
||||
import View from './view.jsx';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
file : state.file,
|
||||
thumbnail: state.metadata.thumbnail,
|
||||
fileError: state.error.file,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onFileSelect: (file) => {
|
||||
dispatch(selectFile(file));
|
||||
dispatch(updateError('publishSubmit', null));
|
||||
},
|
||||
onFileError: (value) => {
|
||||
dispatch(updateError('file', value));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(View);
|
|
@ -1,8 +1,6 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { selectFile, updateError } from '../actions';
|
||||
import { validateFile } from '../utils/file.js';
|
||||
import Preview from '../components/Preview.jsx';
|
||||
import { validateFile } from '../../utils/file.js';
|
||||
import Preview from '../../components/Preview.jsx';
|
||||
|
||||
class Dropzone extends React.Component {
|
||||
constructor (props) {
|
||||
|
@ -139,24 +137,4 @@ class Dropzone extends React.Component {
|
|||
}
|
||||
};
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
file : state.file,
|
||||
thumbnail: state.metadata.thumbnail,
|
||||
fileError: state.error.file,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onFileSelect: (file) => {
|
||||
dispatch(selectFile(file));
|
||||
dispatch(updateError('publishSubmit', null));
|
||||
},
|
||||
onFileError: (value) => {
|
||||
dispatch(updateError('file', value));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Dropzone);
|
||||
export default Dropzone;
|
42
react/containers/PublishForm/index.js
Normal file
42
react/containers/PublishForm/index.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
import {clearFile, selectFile, updateError, updateLoggedInChannel, updatePublishStatus} from '../../actions';
|
||||
import {connect} from 'react-redux';
|
||||
import View from './view.jsx';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
file : state.file,
|
||||
claim : state.claim,
|
||||
title : state.metadata.title,
|
||||
thumbnail : state.metadata.thumbnail,
|
||||
description : state.metadata.description,
|
||||
license : state.metadata.license,
|
||||
nsfw : state.metadata.nsfw,
|
||||
loggedInChannel : state.loggedInChannel,
|
||||
publishInChannel : state.publishInChannel,
|
||||
fileError : state.error.file,
|
||||
urlError : state.error.url,
|
||||
publishSubmitError: state.error.publishSubmit,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onFileSelect: (file) => {
|
||||
dispatch(selectFile(file));
|
||||
},
|
||||
onFileClear: () => {
|
||||
dispatch(clearFile());
|
||||
},
|
||||
onChannelLogin: (name, shortId, longId) => {
|
||||
dispatch(updateLoggedInChannel(name, shortId, longId));
|
||||
},
|
||||
onPublishStatusChange: (status, message) => {
|
||||
dispatch(updatePublishStatus(status, message));
|
||||
},
|
||||
onPublishSubmitError: (value) => {
|
||||
dispatch(updateError('publishSubmit', value));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(View);
|
|
@ -1,14 +1,12 @@
|
|||
import React from 'react';
|
||||
import {connect} from 'react-redux';
|
||||
import {selectFile, clearFile, updateLoggedInChannel, updatePublishStatus, updateError} from '../actions';
|
||||
import {getCookie} from '../utils/cookies.js';
|
||||
import Dropzone from './Dropzone.jsx';
|
||||
import PublishTitleInput from './PublishTitleInput.jsx';
|
||||
import PublishUrlInput from './PublishUrlInput.jsx';
|
||||
import PublishThumbnailInput from './PublishThumbnailInput.jsx';
|
||||
import PublishMetadataInputs from './PublishMetadataInputs.jsx';
|
||||
import ChannelSelect from './ChannelSelect.jsx';
|
||||
import * as publishStates from '../constants/publishing_states';
|
||||
import {getCookie} from '../../utils/cookies.js';
|
||||
import Dropzone from '../Dropzone';
|
||||
import PublishTitleInput from '../PublishTitleInput';
|
||||
import PublishUrlInput from '../PublishUrlInput';
|
||||
import PublishThumbnailInput from '../PublishThumbnailInput';
|
||||
import PublishMetadataInputs from '../PublishMetadataInputs';
|
||||
import ChannelSelect from '../ChannelSelect';
|
||||
import * as publishStates from '../../constants/publishing_states';
|
||||
|
||||
class PublishForm extends React.Component {
|
||||
constructor (props) {
|
||||
|
@ -175,41 +173,4 @@ class PublishForm extends React.Component {
|
|||
}
|
||||
};
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
file : state.file,
|
||||
claim : state.claim,
|
||||
title : state.metadata.title,
|
||||
thumbnail : state.metadata.thumbnail,
|
||||
description : state.metadata.description,
|
||||
license : state.metadata.license,
|
||||
nsfw : state.metadata.nsfw,
|
||||
loggedInChannel : state.loggedInChannel,
|
||||
publishInChannel : state.publishInChannel,
|
||||
fileError : state.error.file,
|
||||
urlError : state.error.url,
|
||||
publishSubmitError: state.error.publishSubmit,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onFileSelect: (file) => {
|
||||
dispatch(selectFile(file));
|
||||
},
|
||||
onFileClear: () => {
|
||||
dispatch(clearFile());
|
||||
},
|
||||
onChannelLogin: (name, shortId, longId) => {
|
||||
dispatch(updateLoggedInChannel(name, shortId, longId));
|
||||
},
|
||||
onPublishStatusChange: (status, message) => {
|
||||
dispatch(updatePublishStatus(status, message));
|
||||
},
|
||||
onPublishSubmitError: (value) => {
|
||||
dispatch(updateError('publishSubmit', value));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(PublishForm);
|
||||
export default PublishForm;
|
21
react/containers/PublishMetadataInputs/index.js
Normal file
21
react/containers/PublishMetadataInputs/index.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
import {connect} from 'react-redux';
|
||||
import {updateMetadata} from '../../actions';
|
||||
import View from './view.jsx';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
description: state.metadata.description,
|
||||
license : state.metadata.license,
|
||||
nsfw : state.metadata.nsfw,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onMetadataChange: (name, value) => {
|
||||
dispatch(updateMetadata(name, value));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(View);
|
|
@ -1,6 +1,4 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { updateMetadata } from '../actions/index';
|
||||
|
||||
/*
|
||||
const textarea = document.getElementById('publish-description');
|
||||
|
@ -11,7 +9,7 @@ import { updateMetadata } from '../actions/index';
|
|||
}
|
||||
*/
|
||||
|
||||
class MetadataInputs extends React.Component {
|
||||
class PublishMetadataInputs extends React.Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
|
@ -101,20 +99,4 @@ class MetadataInputs extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
description: state.metadata.description,
|
||||
license : state.metadata.license,
|
||||
nsfw : state.metadata.nsfw,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onMetadataChange: (name, value) => {
|
||||
dispatch(updateMetadata(name, value));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(MetadataInputs);
|
||||
export default PublishMetadataInputs;
|
19
react/containers/PublishThumbnailInput/index.js
Normal file
19
react/containers/PublishThumbnailInput/index.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
import {connect} from 'react-redux';
|
||||
import {updateMetadata} from '../../actions';
|
||||
import View from './view.jsx';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
thumbnail: state.metadata.thumbnail,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onThumbnailChange: (name, value) => {
|
||||
dispatch(updateMetadata(name, value));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(View);
|
|
@ -1,8 +1,6 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { updateMetadata } from '../actions/index';
|
||||
|
||||
class ThumbnailInput extends React.Component {
|
||||
class PublishThumbnailInput extends React.Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
|
@ -69,18 +67,4 @@ class ThumbnailInput extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
thumbnail: state.metadata.thumbnail,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onThumbnailChange: (name, value) => {
|
||||
dispatch(updateMetadata(name, value));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ThumbnailInput);
|
||||
export default PublishThumbnailInput;
|
19
react/containers/PublishTitleInput/index.js
Normal file
19
react/containers/PublishTitleInput/index.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
import {connect} from 'react-redux';
|
||||
import {updateMetadata} from '../../actions';
|
||||
import View from './view.jsx';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
title: state.metadata.title,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onMetadataChange: (name, value) => {
|
||||
dispatch(updateMetadata(name, value));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(View);
|
|
@ -1,8 +1,6 @@
|
|||
import React from 'react';
|
||||
import {updateMetadata} from '../actions/index';
|
||||
import {connect} from 'react-redux';
|
||||
|
||||
class TitleInput extends React.Component {
|
||||
class PublishTitleInput extends React.Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
this.handleInput = this.handleInput.bind(this);
|
||||
|
@ -20,18 +18,4 @@ class TitleInput extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
title: state.metadata.title,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onMetadataChange: (name, value) => {
|
||||
dispatch(updateMetadata(name, value));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(TitleInput);
|
||||
export default PublishTitleInput;
|
12
react/containers/PublishTool/index.js
Normal file
12
react/containers/PublishTool/index.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import {connect} from 'react-redux';
|
||||
import View from './view.jsx';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
file : state.file,
|
||||
status : state.status.status,
|
||||
message: state.status.message,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, null)(View);
|
|
@ -1,8 +1,7 @@
|
|||
import React from 'react';
|
||||
import Dropzone from './Dropzone.jsx';
|
||||
import PublishForm from './PublishForm.jsx';
|
||||
import PublishStatus from '../components/PublishStatus.jsx';
|
||||
import {connect} from 'react-redux';
|
||||
import Dropzone from '../Dropzone';
|
||||
import PublishForm from '../PublishForm';
|
||||
import PublishStatus from '../../components/PublishStatus.jsx';
|
||||
|
||||
class PublishTool extends React.Component {
|
||||
render () {
|
||||
|
@ -23,12 +22,4 @@ class PublishTool extends React.Component {
|
|||
}
|
||||
};
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
file : state.file,
|
||||
status : state.status.status,
|
||||
message: state.status.message,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, null)(PublishTool);
|
||||
export default PublishTool;
|
28
react/containers/PublishUrlInput/index.js
Normal file
28
react/containers/PublishUrlInput/index.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
import {updateClaim, updateError} from '../../actions';
|
||||
import {connect} from 'react-redux';
|
||||
import View from './view.jsx';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
fileName : state.file.name,
|
||||
loggedInChannelName : state.loggedInChannel.name,
|
||||
loggedInChannelShortId: state.loggedInChannel.shortId,
|
||||
publishInChannel : state.publishInChannel,
|
||||
claim : state.claim,
|
||||
urlError : state.error.url,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onClaimChange: (value) => {
|
||||
dispatch(updateClaim(value));
|
||||
dispatch(updateError('publishSubmit', null));
|
||||
},
|
||||
onUrlError: (value) => {
|
||||
dispatch(updateError('url', value));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(View);
|
|
@ -1,10 +1,8 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { makeGetRequest } from '../utils/xhr.js';
|
||||
import UrlMiddle from '../components/PublishUrlMiddle.jsx';
|
||||
import {updateError, updateClaim} from '../actions';
|
||||
import { makeGetRequest } from '../../utils/xhr.js';
|
||||
import UrlMiddle from '../../components/PublishUrlMiddle.jsx';
|
||||
|
||||
class UrlChooser extends React.Component {
|
||||
class PublishUrlInput extends React.Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
|
@ -80,27 +78,4 @@ class UrlChooser extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
fileName : state.file.name,
|
||||
loggedInChannelName : state.loggedInChannel.name,
|
||||
loggedInChannelShortId: state.loggedInChannel.shortId,
|
||||
publishInChannel : state.publishInChannel,
|
||||
claim : state.claim,
|
||||
urlError : state.error.url,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
onClaimChange: (value) => {
|
||||
dispatch(updateClaim(value));
|
||||
dispatch(updateError('publishSubmit', null));
|
||||
},
|
||||
onUrlError: (value) => {
|
||||
dispatch(updateError('url', value));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(UrlChooser);
|
||||
export default PublishUrlInput;
|
|
@ -2,8 +2,8 @@ import React from 'react';
|
|||
import ReactDOM from 'react-dom';
|
||||
import { Provider } from 'react-redux';
|
||||
import { createStore } from 'redux';
|
||||
import Reducers from './reducers/index.js';
|
||||
import PublishTool from './containers/PublishTool.jsx';
|
||||
import Reducers from './reducers';
|
||||
import PublishTool from './containers/PublishTool';
|
||||
|
||||
let store = createStore(
|
||||
Reducers,
|
||||
|
|
Loading…
Add table
Reference in a new issue