Skip to content

Commit

Permalink
fix: validate whisper channel name in communication tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Medeiros authored and iurimatias committed Mar 11, 2019
1 parent 4340a9b commit 616af6d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/embark-ui/src/components/Communication.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Communication extends Component {
this.state = {
listenTo: '',
channel: '',
channelIsValid: false,
message: '',
messageList: []
};
Expand All @@ -30,6 +31,10 @@ class Communication extends Component {
this.setState({
[name]: e.target.value
});

if(name === "channel") {
this.setState({channelIsValid: e.target.value.length >= 4});
}
}

sendMessage(e) {
Expand Down Expand Up @@ -109,7 +114,7 @@ class Communication extends Component {
id="message"
onChange={e => this.handleChange(e, 'message')}/>
</FormGroup>
<Button color="primary" onClick={(e) => this.sendMessage(e)}>Send Message</Button>
<Button color="primary" disabled={!this.state.channelIsValid} onClick={(e) => this.sendMessage(e)}>Send Message</Button>

</CardBody>
</Card>
Expand Down

0 comments on commit 616af6d

Please sign in to comment.