// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import NavbarDropdown from './navbar_dropdown.jsx'; import TutorialTip from './tutorial/tutorial_tip.jsx'; import UserStore from '../stores/user_store.jsx'; import PreferenceStore from '../stores/preference_store.jsx'; import * as Utils from '../utils/utils.jsx'; import Constants from '../utils/constants.jsx'; import {FormattedHTMLMessage} from 'mm-intl'; const Preferences = Constants.Preferences; const TutorialSteps = Constants.TutorialSteps; const Tooltip = ReactBootstrap.Tooltip; const OverlayTrigger = ReactBootstrap.OverlayTrigger; export default class SidebarHeader extends React.Component { constructor(props) { super(props); this.toggleDropdown = this.toggleDropdown.bind(this); this.onPreferenceChange = this.onPreferenceChange.bind(this); this.state = this.getStateFromStores(); } componentDidMount() { PreferenceStore.addChangeListener(this.onPreferenceChange); } componentWillUnmount() { PreferenceStore.removeChangeListener(this.onPreferenceChange); } getStateFromStores() { const tutorialStep = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 999); return {showTutorialTip: tutorialStep === TutorialSteps.MENU_POPOVER}; } onPreferenceChange() { this.setState(this.getStateFromStores()); } toggleDropdown(e) { e.preventDefault(); if (this.refs.dropdown.blockToggle) { this.refs.dropdown.blockToggle = false; return; } $('.team__header').find('.dropdown-toggle').dropdown('toggle'); } createTutorialTip() { const screens = []; screens.push(