diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:04:13 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:11:58 -0700 |
commit | d8bd57901e33a7057e26e782e295099ffcc0da89 (patch) | |
tree | e12dfc8cad42b1576756d19d7fbfd82646a009bf /webapp/components/create_team | |
parent | 7bc8e9a08dfde56387f946fdf5086252aa4d0491 (diff) | |
download | chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.gz chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.bz2 chat-d8bd57901e33a7057e26e782e295099ffcc0da89.zip |
Removing webapp
Diffstat (limited to 'webapp/components/create_team')
3 files changed, 0 insertions, 477 deletions
diff --git a/webapp/components/create_team/components/display_name.jsx b/webapp/components/create_team/components/display_name.jsx deleted file mode 100644 index 333c262d3..000000000 --- a/webapp/components/create_team/components/display_name.jsx +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import {trackEvent} from 'actions/diagnostics_actions.jsx'; - -import Constants from 'utils/constants.jsx'; -import {cleanUpUrlable} from 'utils/url.jsx'; - -import logoImage from 'images/logo.png'; - -import PropTypes from 'prop-types'; - -import React from 'react'; -import ReactDOM from 'react-dom'; -import {FormattedMessage} from 'react-intl'; - -export default class TeamSignupDisplayNamePage extends React.Component { - constructor(props) { - super(props); - - this.submitNext = this.submitNext.bind(this); - - this.state = {}; - } - - componentDidMount() { - trackEvent('signup', 'signup_team_01_name'); - } - - submitNext(e) { - e.preventDefault(); - - var displayName = ReactDOM.findDOMNode(this.refs.name).value.trim(); - if (!displayName) { - this.setState({nameError: ( - <FormattedMessage - id='create_team.display_name.required' - defaultMessage='This field is required' - />) - }); - return; - } else if (displayName.length < Constants.MIN_TEAMNAME_LENGTH || displayName.length > Constants.MAX_TEAMNAME_LENGTH) { - this.setState({nameError: ( - <FormattedMessage - id='create_team.display_name.charLength' - defaultMessage='Name must be {min} or more characters up to a maximum of {max}. You can add a longer team description later.' - values={{ - min: Constants.MIN_TEAMNAME_LENGTH, - max: Constants.MAX_TEAMNAME_LENGTH - }} - />) - }); - return; - } - - this.props.state.wizard = 'team_url'; - this.props.state.team.display_name = displayName; - this.props.state.team.name = cleanUpUrlable(displayName); - this.props.updateParent(this.props.state); - } - - handleFocus(e) { - e.preventDefault(); - e.currentTarget.select(); - } - - render() { - var nameError = null; - var nameDivClass = 'form-group'; - if (this.state.nameError) { - nameError = <label className='control-label'>{this.state.nameError}</label>; - nameDivClass += ' has-error'; - } - - return ( - <div> - <form> - <img - className='signup-team-logo' - src={logoImage} - /> - <h2> - <FormattedMessage - id='create_team.display_name.teamName' - defaultMessage='Team Name' - /> - </h2> - <div className={nameDivClass}> - <div className='row'> - <div className='col-sm-9'> - <input - type='text' - ref='name' - className='form-control' - placeholder='' - maxLength='128' - defaultValue={this.props.state.team.display_name} - autoFocus={true} - onFocus={this.handleFocus} - spellCheck='false' - /> - </div> - </div> - {nameError} - </div> - <div> - <FormattedMessage - id='create_team.display_name.nameHelp' - defaultMessage='Name your team in any language. Your team name shows in menus and headings.' - /> - </div> - <button - type='submit' - className='btn btn-primary margin--extra' - onClick={this.submitNext} - > - <FormattedMessage - id='create_team.display_name.next' - defaultMessage='Next' - /><i className='fa fa-chevron-right'/> - </button> - </form> - </div> - ); - } -} - -TeamSignupDisplayNamePage.propTypes = { - state: PropTypes.object, - updateParent: PropTypes.func -}; diff --git a/webapp/components/create_team/components/team_url.jsx b/webapp/components/create_team/components/team_url.jsx deleted file mode 100644 index f42dc6e0b..000000000 --- a/webapp/components/create_team/components/team_url.jsx +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import {checkIfTeamExists, createTeam} from 'actions/team_actions.jsx'; -import {trackEvent} from 'actions/diagnostics_actions.jsx'; -import Constants from 'utils/constants.jsx'; -import * as URL from 'utils/url.jsx'; - -import logoImage from 'images/logo.png'; - -import PropTypes from 'prop-types'; - -import React from 'react'; -import ReactDOM from 'react-dom'; -import {Button, Tooltip, OverlayTrigger} from 'react-bootstrap'; -import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; - -export default class TeamUrl extends React.Component { - constructor(props) { - super(props); - - this.submitBack = this.submitBack.bind(this); - this.submitNext = this.submitNext.bind(this); - this.handleFocus = this.handleFocus.bind(this); - - this.state = { - nameError: '', - isLoading: false - }; - } - - componentDidMount() { - trackEvent('signup', 'signup_team_02_url'); - } - - submitBack(e) { - e.preventDefault(); - this.props.state.wizard = 'display_name'; - this.props.updateParent(this.props.state); - } - - submitNext(e) { - e.preventDefault(); - - const name = ReactDOM.findDOMNode(this.refs.name).value.trim(); - const cleanedName = URL.cleanUpUrlable(name); - const urlRegex = /^[a-z]+([a-z\-0-9]+|(__)?)[a-z0-9]+$/g; - - if (!name) { - this.setState({nameError: ( - <FormattedMessage - id='create_team.team_url.required' - defaultMessage='This field is required' - />) - }); - return; - } - - if (cleanedName.length < Constants.MIN_TEAMNAME_LENGTH || cleanedName.length > Constants.MAX_TEAMNAME_LENGTH) { - this.setState({nameError: ( - <FormattedMessage - id='create_team.team_url.charLength' - defaultMessage='Name must be {min} or more characters up to a maximum of {max}' - values={{ - min: Constants.MIN_TEAMNAME_LENGTH, - max: Constants.MAX_TEAMNAME_LENGTH - }} - />) - }); - return; - } - - if (cleanedName !== name || !urlRegex.test(name)) { - this.setState({nameError: ( - <FormattedMessage - id='create_team.team_url.regex' - defaultMessage="Use only lower case letters, numbers and dashes. Must start with a letter and can't end in a dash." - />) - }); - return; - } - - for (let index = 0; index < Constants.RESERVED_TEAM_NAMES.length; index++) { - if (cleanedName.indexOf(Constants.RESERVED_TEAM_NAMES[index]) === 0) { - this.setState({nameError: ( - <FormattedHTMLMessage - id='create_team.team_url.taken' - defaultMessage='This URL <a href="https://docs.mattermost.com/help/getting-started/creating-teams.html#team-url" target="_blank">starts with a reserved word</a> or is unavailable. Please try another.' - />) - }); - return; - } - } - - this.setState({isLoading: true}); - var teamSignup = JSON.parse(JSON.stringify(this.props.state)); - teamSignup.team.type = 'O'; - teamSignup.team.name = name; - - checkIfTeamExists(name, - (foundTeam) => { - if (foundTeam) { - this.setState({nameError: ( - <FormattedMessage - id='create_team.team_url.unavailable' - defaultMessage='This URL is taken or unavailable. Please try another.' - />) - }); - this.setState({isLoading: false}); - return; - } - - createTeam(teamSignup.team, - () => { - trackEvent('signup', 'signup_team_03_complete'); - }, - (err) => { - this.setState({nameError: err.message}); - this.setState({isLoading: false}); - } - ); - }, - (err) => { - this.setState({nameError: err.message}); - } - ); - } - - handleFocus(e) { - e.preventDefault(); - e.currentTarget.select(); - } - - render() { - let nameError = null; - let nameDivClass = 'form-group'; - if (this.state.nameError) { - nameError = <label className='control-label'>{this.state.nameError}</label>; - nameDivClass += ' has-error'; - } - - const title = `${URL.getSiteURL()}/`; - const urlTooltip = ( - <Tooltip id='urlTooltip'>{title}</Tooltip> - ); - - let finishMessage = ( - <FormattedMessage - id='create_team.team_url.finish' - defaultMessage='Finish' - /> - ); - - if (this.state.isLoading) { - finishMessage = ( - <FormattedMessage - id='create_team.team_url.creatingTeam' - defaultMessage='Creating team...' - /> - ); - } - - return ( - <div> - <form> - <img - className='signup-team-logo' - src={logoImage} - /> - <h2> - <FormattedMessage - id='create_team.team_url.teamUrl' - defaultMessage='Team URL' - /> - </h2> - <div className={nameDivClass}> - <div className='row'> - <div className='col-sm-11'> - <div className='input-group input-group--limit'> - <OverlayTrigger - trigger={['hover', 'focus']} - delayShow={Constants.OVERLAY_TIME_DELAY} - placement='top' - overlay={urlTooltip} - > - <span className='input-group-addon'> - {title} - </span> - </OverlayTrigger> - <input - type='text' - ref='name' - className='form-control' - placeholder='' - maxLength='128' - defaultValue={this.props.state.team.name} - autoFocus={true} - onFocus={this.handleFocus} - spellCheck='false' - /> - </div> - </div> - </div> - {nameError} - </div> - <p> - <FormattedMessage - id='create_team.team_url.webAddress' - defaultMessage='Choose the web address of your new team:' - /> - </p> - <ul className='color--light'> - <FormattedHTMLMessage - id='create_team.team_url.hint' - defaultMessage="<li>Short and memorable is best</li> - <li>Use lowercase letters, numbers and dashes</li> - <li>Must start with a letter and can't end in a dash</li>" - /> - </ul> - <div className='margin--extra'> - <Button - type='submit' - bsStyle='primary' - disabled={this.state.isLoading} - onClick={this.submitNext} - > - {finishMessage} - </Button> - </div> - <div className='margin--extra'> - <a - href='#' - onClick={this.submitBack} - > - <FormattedMessage - id='create_team.team_url.back' - defaultMessage='Back to previous step' - /> - </a> - </div> - </form> - </div> - ); - } -} - -TeamUrl.propTypes = { - state: PropTypes.object, - updateParent: PropTypes.func -}; diff --git a/webapp/components/create_team/create_team_controller.jsx b/webapp/components/create_team/create_team_controller.jsx deleted file mode 100644 index 1e2e7dde1..000000000 --- a/webapp/components/create_team/create_team_controller.jsx +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import AnnouncementBar from 'components/announcement_bar'; -import ChannelStore from 'stores/channel_store.jsx'; -import TeamStore from 'stores/team_store.jsx'; - -import {FormattedMessage} from 'react-intl'; -import {browserHistory, Link} from 'react-router/es6'; - -import PropTypes from 'prop-types'; - -import React from 'react'; - -export default class CreateTeamController extends React.Component { - constructor(props) { - super(props); - - this.submit = this.submit.bind(this); - this.updateParent = this.updateParent.bind(this); - - const state = {}; - state.team = {}; - state.wizard = 'display_name'; - this.state = state; - } - - submit() { - // todo fill in - } - - componentDidMount() { - browserHistory.push('/create_team/display_name'); - } - - updateParent(state) { - this.setState(state); - browserHistory.push('/create_team/' + state.wizard); - } - - render() { - let description = null; - if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.CustomBrand === 'true' && global.window.mm_config.EnableCustomBrand === 'true') { - description = global.window.mm_config.CustomDescriptionText; - } else { - description = ( - <FormattedMessage - id='web.root.signup_info' - defaultMessage='All team communication in one place, searchable and accessible anywhere' - /> - ); - } - - let url = '/select_team'; - const team = TeamStore.getCurrent(); - const channel = ChannelStore.getCurrent(); - if (team) { - url = `/${team.name}`; - if (channel) { - url += `/channels/${channel.name}`; - } - } - - return ( - <div> - <AnnouncementBar/> - <div className='signup-header'> - <Link to={url}> - <span className='fa fa-chevron-left'/> - <FormattedMessage - id='web.header.back' - /> - </Link> - </div> - <div className='col-sm-12'> - <div className='signup-team__container'> - <h1>{global.window.mm_config.SiteName}</h1> - <h4 className='color--light'> - {description} - </h4> - <div className='signup__content'> - {React.cloneElement(this.props.children, { - state: this.state, - updateParent: this.updateParent - })} - </div> - </div> - </div> - </div> - ); - } -} - -CreateTeamController.propTypes = { - children: PropTypes.node -}; |