var React = require('react'); var ReactBootstrap = require('react-bootstrap'); var Alert = ReactBootstrap.Alert; var Input = ReactBootstrap.Input; var Button = ReactBootstrap.Button; var DropdownButton = ReactBootstrap.DropdownButton; var MenuItem = ReactBootstrap.MenuItem; var Row = ReactBootstrap.Row; var Col = ReactBootstrap.Col; var User = require('./models.js').User; const LoginBar = React.createClass({ getInitialState: function() { return {username: '', password: ''}; }, onUsernameChange: function(e) { this.setState({username: e.target.value}); }, onPasswordChange: function(e) { this.setState({password: e.target.value}); }, handleSubmit: function(e) { var user = new User(); e.preventDefault(); user.Username = this.refs.username.getValue(); user.Password = this.refs.password.getValue(); this.props.onLoginSubmit(user); }, handleNewUserSubmit: function(e) { e.preventDefault(); this.props.onCreateNewUser(); }, render: function() { return (
); } }); const LogoutBar = React.createClass({ handleOnSelect: function(e, key) { if (key == 1) { if (this.props.onAccountSettings != null) this.props.onAccountSettings(); } else if (key == 2) { this.props.onLogoutSubmit(); } }, render: function() { var signedInString = "Signed in as "+this.props.user.Name; return (
Account Settings Logout
); } }); module.exports = React.createClass({ displayName: "TopBar", render: function() { var barContents; var errorAlert; if (!this.props.user.isUser()) barContents = ; else barContents = ; if (this.props.error.isError()) errorAlert =

Error!

Error {this.props.error.ErrorId}: {this.props.error.ErrorString}

; return (
{barContents} {errorAlert}
); } });