summaryrefslogtreecommitdiffstats
path: root/webapp/components/tutorial/tutorial_view.jsx
blob: 39e7b681684ff36f5ade2272eec284060c5b16d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2016 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>
        );
    }
}