diff --git a/react/components/PublishUrlMiddleDisplay/index.jsx b/react/components/PublishUrlMiddleDisplay/index.jsx index 3aff973b..022071d3 100644 --- a/react/components/PublishUrlMiddleDisplay/index.jsx +++ b/react/components/PublishUrlMiddleDisplay/index.jsx @@ -1,9 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; -function UrlMiddle ({publishInChannel, loggedInChannelName, loggedInChannelShortId}) { +function UrlMiddle ({publishInChannel, selectedChannel, loggedInChannelName, loggedInChannelShortId}) { if (publishInChannel) { - if (loggedInChannelName) { + if (selectedChannel === loggedInChannelName) { return <span id="url-channel" className="url-text--secondary">{loggedInChannelName}:{loggedInChannelShortId} /</span>; } return <span id="url-channel-placeholder" className="url-text--secondary tooltip">@channel<span diff --git a/react/constants/channel_select_states.js b/react/constants/publish_channel_select_states.js similarity index 100% rename from react/constants/channel_select_states.js rename to react/constants/publish_channel_select_states.js diff --git a/react/containers/ChannelSelect/index.js b/react/containers/ChannelSelect/index.js index c36e5e2c..f90d0dc2 100644 --- a/react/containers/ChannelSelect/index.js +++ b/react/containers/ChannelSelect/index.js @@ -1,7 +1,6 @@ import {connect} from 'react-redux'; -import {setPublishInChannel} from 'actions/publish'; +import {setPublishInChannel, updateSelectedChannel} from 'actions/publish'; import View from './view.jsx'; -import {updateSelectedChannel} from '../../actions/publish'; const mapStateToProps = ({ channel, publish }) => { return { diff --git a/react/containers/ChannelSelect/view.jsx b/react/containers/ChannelSelect/view.jsx index a6fa340a..3042895d 100644 --- a/react/containers/ChannelSelect/view.jsx +++ b/react/containers/ChannelSelect/view.jsx @@ -1,7 +1,7 @@ import React from 'react'; import ChannelLoginForm from 'containers/ChannelLoginForm'; import ChannelCreateForm from 'containers/ChannelCreateForm'; -import * as states from 'constants/channel_select_states'; +import * as states from 'constants/publish_channel_select_states'; class ChannelSelect extends React.Component { constructor (props) { diff --git a/react/containers/PublishUrlInput/index.js b/react/containers/PublishUrlInput/index.js index 61fe5850..e1b28ae7 100644 --- a/react/containers/PublishUrlInput/index.js +++ b/react/containers/PublishUrlInput/index.js @@ -8,6 +8,7 @@ const mapStateToProps = ({ channel, publish }) => { loggedInChannelShortId: channel.loggedInChannel.shortId, fileName : publish.file.name, publishInChannel : publish.publishInChannel, + selectedChannel : publish.selectedChannel, claim : publish.claim, urlError : publish.error.url, }; diff --git a/react/containers/PublishUrlInput/view.jsx b/react/containers/PublishUrlInput/view.jsx index 45c3c88a..7d100eaf 100644 --- a/react/containers/PublishUrlInput/view.jsx +++ b/react/containers/PublishUrlInput/view.jsx @@ -5,10 +5,6 @@ import UrlMiddle from 'components/PublishUrlMiddleDisplay'; class PublishUrlInput extends React.Component { constructor (props) { super(props); - this.state = { - host : 'spee.ch', - urlMiddle: null, - }; this.handleInput = this.handleInput.bind(this); this.cleanseInput = this.cleanseInput.bind(this); this.setClaimNameFromFileName = this.setClaimNameFromFileName.bind(this); @@ -65,9 +61,14 @@ class PublishUrlInput extends React.Component { <label className="label">URL:</label> </div><div className="column column--7 column--sml-10 input-text--primary span--relative"> - <span className="url-text--secondary">{this.state.host} / </span> + <span className="url-text--secondary">spee.ch / </span> - <UrlMiddle publishInChannel={this.props.publishInChannel} loggedInChannelName={this.props.loggedInChannelName} loggedInChannelShortId={this.props.loggedInChannelShortId}/> + <UrlMiddle + publishInChannel={this.props.publishInChannel} + selectedChannel={this.props.selectedChannel} + loggedInChannelName={this.props.loggedInChannelName} + loggedInChannelShortId={this.props.loggedInChannelShortId} + /> <input type="text" id="claim-name-input" className="input-text" name='claim' placeholder="your-url-here" onChange={this.handleInput} value={this.props.claim}/> { (this.props.claim && !this.props.urlError) && <span id="input-success-claim-name" className="info-message--success span--absolute">{'\u2713'}</span> } diff --git a/react/reducers/publish.js b/react/reducers/publish.js index 69696751..108d84bf 100644 --- a/react/reducers/publish.js +++ b/react/reducers/publish.js @@ -1,8 +1,9 @@ import * as actions from 'constants/publish_action_types'; +import { LOGIN } from 'constants/publish_channel_select_states'; const initialState = { publishInChannel : false, - selectedChannel : null, + selectedChannel : LOGIN, showMetadataInputs: false, status : { status : null,