2015-10-28 15:04:17 -04:00
|
|
|
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
|
|
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
|
|
|
|
|
|
const UserStore = require('../../stores/user_store.jsx');
|
|
|
|
|
|
const ChannelStore = require('../../stores/channel_store.jsx');
|
|
|
|
|
|
const TeamStore = require('../../stores/team_store.jsx');
|
|
|
|
|
|
const PreferenceStore = require('../../stores/preference_store.jsx');
|
|
|
|
|
|
const Utils = require('../../utils/utils.jsx');
|
|
|
|
|
|
const AsyncClient = require('../../utils/async_client.jsx');
|
|
|
|
|
|
|
|
|
|
|
|
const Constants = require('../../utils/constants.jsx');
|
|
|
|
|
|
const Preferences = Constants.Preferences;
|
|
|
|
|
|
|
2015-11-05 12:20:55 -05:00
|
|
|
|
const NUM_SCREENS = 3;
|
|
|
|
|
|
|
2015-10-28 15:04:17 -04:00
|
|
|
|
export default class TutorialIntroScreens extends React.Component {
|
|
|
|
|
|
constructor(props) {
|
|
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
|
|
this.handleNext = this.handleNext.bind(this);
|
|
|
|
|
|
this.createScreen = this.createScreen.bind(this);
|
2015-11-05 12:20:55 -05:00
|
|
|
|
this.createCircles = this.createCircles.bind(this);
|
2015-10-28 15:04:17 -04:00
|
|
|
|
|
2015-10-30 11:35:16 -04:00
|
|
|
|
this.state = {currentScreen: 0};
|
2015-10-28 15:04:17 -04:00
|
|
|
|
}
|
|
|
|
|
|
handleNext() {
|
2015-10-30 11:35:16 -04:00
|
|
|
|
if (this.state.currentScreen < 2) {
|
|
|
|
|
|
this.setState({currentScreen: this.state.currentScreen + 1});
|
2015-10-28 15:04:17 -04:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Utils.switchChannel(ChannelStore.getByName(Constants.DEFAULT_CHANNEL));
|
|
|
|
|
|
|
2015-10-30 11:35:16 -04:00
|
|
|
|
let preference = PreferenceStore.getPreference(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), {value: '0'});
|
|
|
|
|
|
|
|
|
|
|
|
const newValue = (parseInt(preference.value, 10) + 1).toString();
|
|
|
|
|
|
|
|
|
|
|
|
preference = PreferenceStore.setPreference(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), newValue);
|
2015-10-28 15:04:17 -04:00
|
|
|
|
AsyncClient.savePreferences([preference]);
|
|
|
|
|
|
}
|
2015-11-03 19:56:46 +05:00
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
$('.tutorials__scroll').perfectScrollbar();
|
|
|
|
|
|
}
|
2015-11-09 15:24:16 -05:00
|
|
|
|
skipTutorial(e) {
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
const preference = PreferenceStore.setPreference(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), '999');
|
|
|
|
|
|
AsyncClient.savePreferences([preference]);
|
|
|
|
|
|
}
|
2015-10-28 15:04:17 -04:00
|
|
|
|
createScreen() {
|
2015-10-30 11:35:16 -04:00
|
|
|
|
switch (this.state.currentScreen) {
|
2015-10-28 15:04:17 -04:00
|
|
|
|
case 0:
|
|
|
|
|
|
return this.createScreenOne();
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
return this.createScreenTwo();
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
return this.createScreenThree();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
createScreenOne() {
|
2015-11-05 12:22:40 -05:00
|
|
|
|
const circles = this.createCircles();
|
2015-11-05 12:20:55 -05:00
|
|
|
|
|
2015-10-28 15:04:17 -04:00
|
|
|
|
return (
|
|
|
|
|
|
<div>
|
2015-11-02 11:40:53 +05:00
|
|
|
|
<h3>{'Welcome to:'}</h3>
|
|
|
|
|
|
<h1>{'Mattermost'}</h1>
|
2015-11-03 18:03:11 -08:00
|
|
|
|
<p>{'Your team communication all in one place, instantly searchable and available anywhere.'}</p>
|
2015-11-02 11:40:53 +05:00
|
|
|
|
<p>{'Keep your team connected to help them achieve what matters most.'}</p>
|
2015-11-05 12:20:55 -05:00
|
|
|
|
{circles}
|
2015-10-28 15:04:17 -04:00
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
createScreenTwo() {
|
2015-11-05 12:22:40 -05:00
|
|
|
|
const circles = this.createCircles();
|
2015-11-05 12:20:55 -05:00
|
|
|
|
|
2015-10-28 15:04:17 -04:00
|
|
|
|
return (
|
|
|
|
|
|
<div>
|
2015-11-02 11:40:53 +05:00
|
|
|
|
<h3>{'How Mattermost works:'}</h3>
|
|
|
|
|
|
<p>{'Communication happens in public discussion channels, private groups and direct messages.'}</p>
|
2015-11-03 08:42:04 -08:00
|
|
|
|
<p>{'Everything is archived and searchable from any web-enabled desktop, laptop or phone.'}</p>
|
2015-11-05 12:20:55 -05:00
|
|
|
|
{circles}
|
2015-10-28 15:04:17 -04:00
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
createScreenThree() {
|
|
|
|
|
|
const team = TeamStore.getCurrent();
|
|
|
|
|
|
let inviteModalLink;
|
|
|
|
|
|
if (team.type === Constants.INVITE_TEAM) {
|
|
|
|
|
|
inviteModalLink = (
|
|
|
|
|
|
<a
|
|
|
|
|
|
className='intro-links'
|
|
|
|
|
|
href='#'
|
|
|
|
|
|
data-toggle='modal'
|
|
|
|
|
|
data-target='#invite_member'
|
|
|
|
|
|
>
|
|
|
|
|
|
{'Invite teammates'}
|
|
|
|
|
|
</a>
|
|
|
|
|
|
);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
inviteModalLink = (
|
|
|
|
|
|
<a
|
|
|
|
|
|
className='intro-links'
|
|
|
|
|
|
href='#'
|
|
|
|
|
|
data-toggle='modal'
|
|
|
|
|
|
data-target='#get_link'
|
|
|
|
|
|
data-title='Team Invite'
|
|
|
|
|
|
data-value={Utils.getWindowLocationOrigin() + '/signup_user_complete/?id=' + team.id}
|
|
|
|
|
|
>
|
|
|
|
|
|
{'Invite teammates'}
|
|
|
|
|
|
</a>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-11-05 12:22:40 -05:00
|
|
|
|
const circles = this.createCircles();
|
2015-11-05 12:20:55 -05:00
|
|
|
|
|
2015-10-28 15:04:17 -04:00
|
|
|
|
return (
|
|
|
|
|
|
<div>
|
2015-11-02 11:40:53 +05:00
|
|
|
|
<h3>{'You’re all set'}</h3>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
{inviteModalLink}
|
|
|
|
|
|
{' when you’re ready.'}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
{'Need anything, just email us at '}
|
|
|
|
|
|
<a
|
|
|
|
|
|
href='mailto:feedback@mattermost.com'
|
|
|
|
|
|
target='_blank'
|
|
|
|
|
|
>
|
2015-11-02 11:13:21 -05:00
|
|
|
|
{'feedback@mattermost.com'}
|
2015-11-02 11:40:53 +05:00
|
|
|
|
</a>
|
2015-11-02 11:13:21 -05:00
|
|
|
|
{'.'}
|
2015-11-02 11:40:53 +05:00
|
|
|
|
</p>
|
2015-11-03 08:42:04 -08:00
|
|
|
|
{'Click “Next” to enter Town Square. This is the first channel teammates see when they sign up. Use it for posting updates everyone needs to know.'}
|
2015-11-05 12:20:55 -05:00
|
|
|
|
{circles}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2015-11-05 12:22:40 -05:00
|
|
|
|
createCircles() {
|
2015-11-05 12:20:55 -05:00
|
|
|
|
const circles = [];
|
|
|
|
|
|
for (let i = 0; i < NUM_SCREENS; i++) {
|
|
|
|
|
|
let className = 'circle';
|
2015-11-05 12:22:40 -05:00
|
|
|
|
if (i === this.state.currentScreen) {
|
2015-11-05 12:20:55 -05:00
|
|
|
|
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}
|
2015-10-28 15:04:17 -04:00
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
render() {
|
2015-11-03 20:27:38 +05:00
|
|
|
|
const height = Utils.windowHeight() - 100;
|
2015-10-28 15:04:17 -04:00
|
|
|
|
const screen = this.createScreen();
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
2015-11-03 20:27:38 +05:00
|
|
|
|
<div
|
|
|
|
|
|
className='tutorials__scroll'
|
|
|
|
|
|
style={{height}}
|
|
|
|
|
|
>
|
2015-11-03 19:56:46 +05:00
|
|
|
|
<div className='tutorial-steps__container'>
|
|
|
|
|
|
<div className='tutorial__content'>
|
|
|
|
|
|
<div className='tutorial__steps'>
|
|
|
|
|
|
{screen}
|
|
|
|
|
|
<button
|
|
|
|
|
|
className='btn btn-primary'
|
|
|
|
|
|
tabIndex='1'
|
|
|
|
|
|
onClick={this.handleNext}
|
|
|
|
|
|
>
|
|
|
|
|
|
{'Next'}
|
|
|
|
|
|
</button>
|
2015-11-09 15:24:16 -05:00
|
|
|
|
<a
|
|
|
|
|
|
className='tutorial-skip'
|
|
|
|
|
|
href='#'
|
|
|
|
|
|
onClick={this.skipTutorial}
|
|
|
|
|
|
>
|
|
|
|
|
|
{'Skip tutorial'}
|
|
|
|
|
|
</a>
|
2015-11-03 19:56:46 +05:00
|
|
|
|
</div>
|
2015-11-02 11:40:53 +05:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2015-10-28 15:04:17 -04:00
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|