React/Redux - publish component #323
3 changed files with 11 additions and 11 deletions
|
@ -1,17 +1,17 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
import ChannelLoginForm from '../containers/ChannelLoginForm.jsx';
|
import ChannelLoginForm from '../containers/ChannelLoginForm.jsx';
|
||||||
import ChannelCreateForm from '../containers/ChannelCreateForm.jsx';
|
import ChannelCreateForm from '../containers/ChannelCreateForm.jsx';
|
||||||
import { connect } from 'react-redux';
|
|
||||||
|
|
||||||
const LOGIN = 'login';
|
const LOGIN = 'Existing';
|
||||||
const CREATE = 'create';
|
const CREATE = 'New';
|
||||||
|
|
||||||
class ChannelSelector extends React.Component {
|
class ChannelSelector extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
optionState: LOGIN,
|
selectedOption: LOGIN,
|
||||||
};
|
};
|
||||||
this.handleSelection = this.handleSelection.bind(this);
|
this.handleSelection = this.handleSelection.bind(this);
|
||||||
this.selectOption = this.selectOption.bind(this);
|
this.selectOption = this.selectOption.bind(this);
|
||||||
|
@ -32,7 +32,7 @@ class ChannelSelector extends React.Component {
|
||||||
this.selectOption(selectedOption);
|
this.selectOption(selectedOption);
|
||||||
}
|
}
|
||||||
selectOption (option) {
|
selectOption (option) {
|
||||||
this.setState({optionState: option});
|
this.setState({selectedOption: option});
|
||||||
}
|
}
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
|
@ -43,16 +43,16 @@ class ChannelSelector extends React.Component {
|
||||||
<div className="column column--3">
|
<div className="column column--3">
|
||||||
<label className="label" htmlFor="channel-name-select">Channel:</label>
|
<label className="label" htmlFor="channel-name-select">Channel:</label>
|
||||||
</div><div className="column column--7">
|
</div><div className="column column--7">
|
||||||
<select type="text" id="channel-name-select" className="select select--arrow" value={this.state.optionState} onChange={this.handleSelection}>
|
<select type="text" id="channel-name-select" className="select select--arrow" value={this.state.selectedOption} onChange={this.handleSelection}>
|
||||||
{ this.props.loggedInChannelName && <option value={this.props.loggedInChannelName} id="publish-channel-select-channel-option">{this.props.loggedInChannelName}</option> }
|
{ this.props.loggedInChannelName && <option value={this.props.loggedInChannelName} id="publish-channel-select-channel-option">{this.props.loggedInChannelName}</option> }
|
||||||
<option value="login">Existing</option>
|
<option value={LOGIN}>Existing</option>
|
||||||
<option value="create">New</option>
|
<option value={CREATE}>New</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{ (this.state.optionState === LOGIN) && <ChannelLoginForm /> }
|
{ (this.state.selectedOption === LOGIN) && <ChannelLoginForm /> }
|
||||||
|
|
||||||
{ (this.state.optionState === CREATE) && <ChannelCreateForm /> }
|
{ (this.state.selectedOption === CREATE) && <ChannelCreateForm /> }
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import ChannelSelector from '../components/ChannelSelector.jsx';
|
||||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
|||||||
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 './ChannelSelect.jsx';
|
||||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { getCookie } from '../utils/cookies.js';
|
import { getCookie } from '../utils/cookies.js';
|
||||||
import {selectFile, clearFile, updateLoggedInChannel, updatePublishStatus, updateError} from '../actions';
|
import {selectFile, clearFile, updateLoggedInChannel, updatePublishStatus, updateError} from '../actions';
|
||||||
|
|
||||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
Loading…
Reference in a new issue
These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux