const React = require('react'); const {Modal, Button, FormGroup, FormControl, ControlLabel, HelpBlock} = require('react-bootstrap'); const validUrl = require('valid-url'); class NewTeamModal extends React.Component { constructor() { super(); this.state = { teamName: '', teamUrl: '' }; } shouldComponentUpdate() { return true; } getTeamNameValidationState() { return this.state.teamName.length > 0 ? '' : 'error'; } handleTeamNameChange(e) { this.setState({ teamName: e.target.value }); } getTeamUrlValidationState() { if (this.state.teamUrl.length === 0) { return 'error'; } if (!validUrl.isUri(this.state.teamUrl)) { return 'error'; } return ''; } handleTeamUrlChange(e) { this.setState({ teamUrl: e.target.value }); } validateForm() { return this.getTeamNameValidationState() === '' && this.getTeamUrlValidationState() === ''; } render() { return ( {'Add Server'}
{'Server Display Name'} {'The name of the server displayed on your desktop app tab bar.'} {'Team URL'} {'The URL of your Mattermost server. Must start with http:// or https://.'}
); } } NewTeamModal.propTypes = { onClose: React.PropTypes.func, onSave: React.PropTypes.func }; module.exports = NewTeamModal;