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/tutorial | |
parent | 7bc8e9a08dfde56387f946fdf5086252aa4d0491 (diff) | |
download | chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.gz chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.bz2 chat-d8bd57901e33a7057e26e782e295099ffcc0da89.zip |
Removing webapp
Diffstat (limited to 'webapp/components/tutorial')
-rw-r--r-- | webapp/components/tutorial/tutorial_intro_screens.jsx | 331 | ||||
-rw-r--r-- | webapp/components/tutorial/tutorial_tip.jsx | 247 | ||||
-rw-r--r-- | webapp/components/tutorial/tutorial_view.jsx | 49 |
3 files changed, 0 insertions, 627 deletions
diff --git a/webapp/components/tutorial/tutorial_intro_screens.jsx b/webapp/components/tutorial/tutorial_intro_screens.jsx deleted file mode 100644 index 7600d15dd..000000000 --- a/webapp/components/tutorial/tutorial_intro_screens.jsx +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import UserStore from 'stores/user_store.jsx'; -import TeamStore from 'stores/team_store.jsx'; -import PreferenceStore from 'stores/preference_store.jsx'; -import {savePreference} from 'actions/user_actions.jsx'; -import * as GlobalActions from 'actions/global_actions.jsx'; -import {trackEvent} from 'actions/diagnostics_actions.jsx'; - -import {Constants, Preferences} from 'utils/constants.jsx'; - -import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; -import {browserHistory} from 'react-router/es6'; - -import AppIcons from 'images/appIcons.png'; - -const NUM_SCREENS = 3; - -import PropTypes from 'prop-types'; - -import React from 'react'; - -export default class TutorialIntroScreens extends React.Component { - static get propTypes() { - return { - townSquare: PropTypes.object, - offTopic: PropTypes.object - }; - } - constructor(props) { - super(props); - - this.handleNext = this.handleNext.bind(this); - this.createScreen = this.createScreen.bind(this); - this.createCircles = this.createCircles.bind(this); - this.skipTutorial = this.skipTutorial.bind(this); - - this.state = {currentScreen: 0}; - } - handleNext() { - switch (this.state.currentScreen) { - case 0: - trackEvent('tutorial', 'tutorial_screen_1_welcome_to_mattermost_next'); - break; - case 1: - trackEvent('tutorial', 'tutorial_screen_2_how_mattermost_works_next'); - break; - case 2: - trackEvent('tutorial', 'tutorial_screen_3_youre_all_set_next'); - break; - } - - if (this.state.currentScreen < 2) { - this.setState({currentScreen: this.state.currentScreen + 1}); - return; - } - - browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/town-square'); - - const step = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 0); - - savePreference( - Preferences.TUTORIAL_STEP, - UserStore.getCurrentId(), - (step + 1).toString() - ); - } - skipTutorial(e) { - e.preventDefault(); - - switch (this.state.currentScreen) { - case 0: - trackEvent('tutorial', 'tutorial_screen_1_welcome_to_mattermost_skip'); - break; - case 1: - trackEvent('tutorial', 'tutorial_screen_2_how_mattermost_works_skip'); - break; - case 2: - trackEvent('tutorial', 'tutorial_screen_3_youre_all_set_skip'); - break; - } - - savePreference( - Preferences.TUTORIAL_STEP, - UserStore.getCurrentId(), - '999' - ); - - browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/town-square'); - } - createScreen() { - switch (this.state.currentScreen) { - case 0: - return this.createScreenOne(); - case 1: - return this.createScreenTwo(); - case 2: - return this.createScreenThree(); - } - return null; - } - createScreenOne() { - const circles = this.createCircles(); - - return ( - <div> - <FormattedHTMLMessage - id='tutorial_intro.screenOne' - defaultMessage='<h3>Welcome to:</h3> - <h1>Mattermost</h1> - <p>Your team communication all in one place, instantly searchable and available anywhere.</p> - <p>Keep your team connected to help them achieve what matters most.</p>' - /> - {circles} - </div> - ); - } - createScreenTwo() { - const circles = this.createCircles(); - - let appDownloadLink = null; - let appDownloadImage = null; - if (global.window.mm_config.AppDownloadLink) { - // not using a FormattedHTMLMessage here since mm_config.AppDownloadLink is configurable and could be used - // to inject HTML if we're not careful - appDownloadLink = ( - <FormattedMessage - id='tutorial_intro.mobileApps' - defaultMessage='Install the apps for {link} for easy access and notifications on the go.' - values={{ - link: ( - <a - href={global.window.mm_config.AppDownloadLink} - target='_blank' - rel='noopener noreferrer' - > - <FormattedMessage - id='tutorial_intro.mobileAppsLinkText' - defaultMessage='PC, Mac, iOS and Android' - /> - </a> - ) - }} - /> - ); - - appDownloadImage = ( - <a - href={global.window.mm_config.AppDownloadLink} - target='_blank' - rel='noopener noreferrer' - > - <img - className='tutorial__app-icons' - src={AppIcons} - /> - </a> - ); - } - - return ( - <div> - <FormattedHTMLMessage - id='tutorial_intro.screenTwo' - defaultMessage='<h3>How Mattermost works:</h3> - <p>Communication happens in public discussion channels, private channels and direct messages.</p> - <p>Everything is archived and searchable from any web-enabled desktop, laptop or phone.</p>' - /> - {appDownloadLink} - {appDownloadImage} - {circles} - </div> - ); - } - createScreenThree() { - const team = TeamStore.getCurrent(); - let inviteModalLink; - let inviteText; - - if (global.window.mm_license.IsLicensed !== 'true' || global.window.mm_config.RestrictTeamInvite === Constants.PERMISSIONS_ALL) { - if (team.type === Constants.INVITE_TEAM) { - inviteModalLink = ( - <a - className='intro-links' - href='#' - onClick={GlobalActions.showInviteMemberModal} - > - <FormattedMessage - id='tutorial_intro.invite' - defaultMessage='Invite teammates' - /> - </a> - ); - } else { - inviteModalLink = ( - <a - className='intro-links' - href='#' - onClick={GlobalActions.showGetTeamInviteLinkModal} - > - <FormattedMessage - id='tutorial_intro.teamInvite' - defaultMessage='Invite teammates' - /> - </a> - ); - } - - inviteText = ( - <p> - {inviteModalLink} - <FormattedMessage - id='tutorial_intro.whenReady' - defaultMessage=' when you’re ready.' - /> - </p> - ); - } - - const circles = this.createCircles(); - - let supportInfo = null; - if (global.window.mm_config.SupportEmail) { - supportInfo = ( - <p> - <FormattedMessage - id='tutorial_intro.support' - defaultMessage='Need anything, just email us at ' - /> - <a - href={'mailto:' + global.window.mm_config.SupportEmail} - target='_blank' - rel='noopener noreferrer' - > - {global.window.mm_config.SupportEmail} - </a> - {'.'} - </p> - ); - } - - let townSquareDisplayName = Constants.DEFAULT_CHANNEL_UI_NAME; - if (this.props.townSquare) { - townSquareDisplayName = this.props.townSquare.display_name; - } - - return ( - <div> - <h3> - <FormattedMessage - id='tutorial_intro.allSet' - defaultMessage='You’re all set' - /> - </h3> - {inviteText} - {supportInfo} - <FormattedMessage - id='tutorial_intro.end' - defaultMessage='Click "Next" to enter {channel}. This is the first channel teammates see when they sign up. Use it for posting updates everyone needs to know.' - values={{ - channel: townSquareDisplayName - }} - /> - {circles} - </div> - ); - } - createCircles() { - const circles = []; - for (let i = 0; i < NUM_SCREENS; i++) { - let className = 'circle'; - if (i === this.state.currentScreen) { - className += ' active'; - } - - circles.push( - <a - href='#' - key={'circle' + i} - className={className} - onClick={(e) => { //eslint-disable-line no-loop-func - e.preventDefault(); - this.setState({currentScreen: i}); - }} - /> - ); - } - - return ( - <div className='tutorial__circles'> - {circles} - </div> - ); - } - render() { - const screen = this.createScreen(); - - return ( - <div className='tutorial-steps__container'> - <div className='tutorial__content'> - <div className='tutorial__steps'> - {screen} - <div className='tutorial__footer'> - <button - className='btn btn-primary' - tabIndex='1' - onClick={this.handleNext} - > - <FormattedMessage - id='tutorial_intro.next' - defaultMessage='Next' - /> - </button> - <a - className='tutorial-skip' - href='#' - onClick={this.skipTutorial} - > - <FormattedMessage - id='tutorial_intro.skip' - defaultMessage='Skip tutorial' - /> - </a> - </div> - </div> - </div> - </div> - ); - } -} diff --git a/webapp/components/tutorial/tutorial_tip.jsx b/webapp/components/tutorial/tutorial_tip.jsx deleted file mode 100644 index 2db8c6cea..000000000 --- a/webapp/components/tutorial/tutorial_tip.jsx +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import UserStore from 'stores/user_store.jsx'; -import PreferenceStore from 'stores/preference_store.jsx'; -import {savePreference} from 'actions/user_actions.jsx'; -import {trackEvent} from 'actions/diagnostics_actions.jsx'; - -import Constants from 'utils/constants.jsx'; - -import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; - -const Preferences = Constants.Preferences; -import * as Utils from 'utils/utils.jsx'; - -import {Overlay} from 'react-bootstrap'; - -import PropTypes from 'prop-types'; - -import React from 'react'; - -import tutorialGif from 'images/tutorialTip.gif'; -import tutorialGifWhite from 'images/tutorialTipWhite.gif'; - -export default class TutorialTip extends React.Component { - constructor(props) { - super(props); - - this.handleNext = this.handleNext.bind(this); - this.toggle = this.toggle.bind(this); - this.skipTutorial = this.skipTutorial.bind(this); - - this.state = {currentScreen: 0, show: false}; - } - toggle() { - const show = !this.state.show; - this.setState({show}); - - if (!show && this.state.currentScreen >= this.props.screens.length - 1) { - const step = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 0); - - savePreference( - Preferences.TUTORIAL_STEP, - UserStore.getCurrentId(), - (step + 1).toString() - ); - } - } - handleNext() { - if (this.state.currentScreen < this.props.screens.length - 1) { - this.setState({currentScreen: this.state.currentScreen + 1}); - return; - } - - if (this.props.diagnosticsTag) { - let tag = this.props.diagnosticsTag; - - if (this.props.screens.length > 1) { - tag += '_' + (this.state.currentScreen + 1).toString(); - } - - if (this.state.currentScreen === this.props.screens.length - 1) { - tag += '_okay'; - } else { - tag += '_next'; - } - - trackEvent('tutorial', tag); - } - - this.closeRightSidebar(); - this.toggle(); - } - closeRightSidebar() { - if (Utils.isMobile()) { - setTimeout(() => { - document.querySelector('.app__body .inner-wrap').classList.remove('move--left-small'); - document.querySelector('.app__body .sidebar--menu').classList.remove('move--left'); - }); - } - } - skipTutorial(e) { - e.preventDefault(); - - if (this.props.diagnosticsTag) { - let tag = this.props.diagnosticsTag; - if (this.props.screens.length > 1) { - tag += '_' + this.state.currentScreen; - } - tag += '_skip'; - trackEvent('tutorial', tag); - } - - savePreference( - Preferences.TUTORIAL_STEP, - UserStore.getCurrentId(), - '999' - ); - } - render() { - const buttonText = this.state.currentScreen === this.props.screens.length - 1 ? ( - <FormattedMessage - id='tutorial_tip.ok' - defaultMessage='Okay' - /> - ) : ( - <FormattedMessage - id='tutorial_tip.next' - defaultMessage='Next' - /> - ); - - const dots = []; - if (this.props.screens.length > 1) { - for (let i = 0; i < this.props.screens.length; i++) { - let className = 'circle'; - if (i === this.state.currentScreen) { - className += ' active'; - } - - dots.push( - <a - href='#' - key={'dotactive' + i} - className={className} - onClick={(e) => { //eslint-disable-line no-loop-func - e.preventDefault(); - this.setState({currentScreen: i}); - }} - /> - ); - } - } - - var tutorialGifImage = tutorialGif; - if (this.props.overlayClass === 'tip-overlay--header' || this.props.overlayClass === 'tip-overlay--sidebar' || this.props.overlayClass === 'tip-overlay--header--up') { - tutorialGifImage = tutorialGifWhite; - } - - return ( - <div - className={'tip-div ' + this.props.overlayClass} - onClick={this.toggle} - > - <img - className='tip-button' - src={tutorialGifImage} - width='35' - onClick={this.toggle} - ref='target' - /> - - <Overlay - show={this.state.show} - > - <div className='tip-backdrop'/> - </Overlay> - - <Overlay - placement={this.props.placement} - show={this.state.show} - rootClose={true} - onHide={this.toggle} - target={() => this.refs.target} - > - <div className={'tip-overlay ' + this.props.overlayClass}> - <div className='arrow'/> - {this.props.screens[this.state.currentScreen]} - <div className='tutorial__footer'> - <div className='tutorial__circles'>{dots}</div> - <div className='text-right'> - <button - className='btn btn-primary' - onClick={this.handleNext} - > - {buttonText} - </button> - <div className='tip-opt'> - <FormattedMessage - id='tutorial_tip.seen' - defaultMessage='Seen this before? ' - /> - <a - href='#' - onClick={this.skipTutorial} - > - <FormattedMessage - id='tutorial_tip.out' - defaultMessage='Opt out of these tips.' - /> - </a> - </div> - </div> - </div> - </div> - </Overlay> - </div> - ); - } -} - -TutorialTip.defaultProps = { - overlayClass: '' -}; - -TutorialTip.propTypes = { - screens: PropTypes.array.isRequired, - placement: PropTypes.string.isRequired, - overlayClass: PropTypes.string, - diagnosticsTag: PropTypes.string -}; - -export function createMenuTip(toggleFunc, onBottom) { - const screens = []; - - screens.push( - <div> - <FormattedHTMLMessage - id='sidebar_header.tutorial' - defaultMessage='<h4>Main Menu</h4> - <p>The <strong>Main Menu</strong> is where you can <strong>Invite New Members</strong>, access your <strong>Account Settings</strong> and set your <strong>Theme Color</strong>.</p> - <p>Team administrators can also access their <strong>Team Settings</strong> from this menu.</p><p>System administrators will find a <strong>System Console</strong> option to administrate the entire system.</p>' - /> - </div> - ); - - let placement = 'right'; - let arrow = 'left'; - if (onBottom) { - placement = 'bottom'; - arrow = 'up'; - } - - return ( - <div - onClick={toggleFunc} - > - <TutorialTip - ref='tip' - placement={placement} - screens={screens} - overlayClass={'tip-overlay--header--' + arrow} - diagnosticsTag='tutorial_tip_3_main_menu' - /> - </div> - ); -} diff --git a/webapp/components/tutorial/tutorial_view.jsx b/webapp/components/tutorial/tutorial_view.jsx deleted file mode 100644 index 491e3146e..000000000 --- a/webapp/components/tutorial/tutorial_view.jsx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import TutorialIntroScreens from './tutorial_intro_screens.jsx'; - -import ChannelStore from 'stores/channel_store.jsx'; -import Constants from 'utils/constants.jsx'; - -import $ from 'jquery'; -import React from 'react'; - -export default class TutorialView extends React.Component { - constructor(props) { - super(props); - - this.handleChannelChange = this.handleChannelChange.bind(this); - - this.state = { - townSquare: ChannelStore.getByName(Constants.DEFAULT_CHANNEL) - }; - } - componentDidMount() { - ChannelStore.addChangeListener(this.handleChannelChange); - - $('body').addClass('app__body'); - } - componentWillUnmount() { - ChannelStore.removeChangeListener(this.handleChannelChange); - - $('body').removeClass('app__body'); - } - handleChannelChange() { - this.setState({ - townSquare: ChannelStore.getByName(Constants.DEFAULT_CHANNEL) - }); - } - render() { - return ( - <div - id='app-content' - className='app__content' - > - <TutorialIntroScreens - townSquare={this.state.townSquare} - /> - </div> - ); - } -} |