import React from 'react'; import SideNavbar from '../widgets/side-navbar.jsx'; import ErrorPanel from '../widgets/error-panel.jsx'; import ContactsView from './contacts-view.jsx'; import CreateAccountView from './create-account-view.jsx'; import EditAccountView from './edit-account-view.jsx'; import LoginView from './login-view.jsx'; import NewTopicView from './new-topic-view.jsx'; import PasswordResetView from './password-reset-view.jsx'; import SettingsView from './settings-view.jsx'; import ValidationView from './validation-view.jsx'; export default class SidepanelView extends React.Component { constructor(props) { super(props); this.handleLoginRequested = this.handleLoginRequested.bind(this); } handleLoginRequested(login, password) { this.props.onLoginRequest(login, password); } render() { var title = null; var avatar = false; var onCancel = undefined; var view = this.props.state || (this.props.myUserId ? 'contacts' : 'login'); switch (view) { case 'login': title = "Sign In"; break; case 'register': title = "Create Account"; onCancel = this.props.onCancel; break; case 'settings': title = "Settings"; onCancel = this.props.onCancel; break; case 'edit': title = "Edit Account"; onCancel = this.props.onCancel; break; case 'contacts': title = this.props.title; avatar = this.props.avatar ? this.props.avatar : true; break; case 'newtpk': title = "Start New Chat"; onCancel = this.props.onCancel; break; case 'cred': title = "Confirm Credentials"; onCancel = this.props.onCancel; break; case 'reset': title = "Reset Password"; onCancel = this.props.onCancel; break; default:; }; return (