// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import UserStore from 'stores/user_store.jsx'; import * as utils from 'utils/utils.jsx'; import NotificationsTab from './user_settings_notifications.jsx'; import SecurityTab from './user_settings_security.jsx'; import GeneralTab from './user_settings_general.jsx'; import DeveloperTab from './user_settings_developer.jsx'; import DisplayTab from './user_settings_display.jsx'; import AdvancedTab from './user_settings_advanced.jsx'; import React from 'react'; export default class UserSettings extends React.Component { constructor(props) { super(props); this.getActiveTab = this.getActiveTab.bind(this); this.onListenerChange = this.onListenerChange.bind(this); this.state = {user: UserStore.getCurrentUser()}; } componentDidMount() { UserStore.addChangeListener(this.onListenerChange); } componentWillUnmount() { UserStore.removeChangeListener(this.onListenerChange); } getActiveTab() { return this.refs.activeTab; } onListenerChange() { var user = UserStore.getCurrentUser(); if (!utils.areObjectsEqual(this.state.user, user)) { this.setState({user}); } } render() { if (this.props.activeTab === 'general') { return (