diff --git a/packages/embark-ui/src/components/Communication.js b/packages/embark-ui/src/components/Communication.js index a5cd99b13..5819b5c07 100644 --- a/packages/embark-ui/src/components/Communication.js +++ b/packages/embark-ui/src/components/Communication.js @@ -22,6 +22,7 @@ class Communication extends Component { listenTo: '', channel: '', channelIsValid: false, + listenToChannelIsValid: false, message: '', messageList: [] }; @@ -32,8 +33,10 @@ class Communication extends Component { [name]: e.target.value }); - if(name === "channel") { - this.setState({channelIsValid: e.target.value.length >= 4}); + if (name === "channel") { + this.setState({channelIsValid: this.isChannelValid(e.target.value)}); + } else if (name === "listenTo") { + this.setState({listenToChannelIsValid: this.isChannelValid(e.target.value)}); } } @@ -71,7 +74,7 @@ class Communication extends Component { onChange={e => this.handleChange(e, 'listenTo')} onKeyPress={e => this.handleEnter(e, this.listenToChannel.bind(this))} /> - + {this.props.subscriptions && this.props.subscriptions.length > 0 && @@ -134,6 +137,10 @@ class Communication extends Component { ); } + + isChannelValid(channelName) { + return channelName.length >= 4; + } } Communication.propTypes = {