React = require 'react' {RetinaImg} = require 'nylas-component-kit' {EdgehillAPI} = require 'nylas-exports' Page = require './page' OnboardingActions = require './onboarding-actions' NylasApiEnvironmentStore = require './nylas-api-environment-store' class LoginPage extends Page @displayName: "LoginPage" constructor: (@props) -> @state = email: "" environment: NylasApiEnvironmentStore.getEnvironment() componentDidMount: -> @_usub = NylasApiEnvironmentStore.listen => @setState environment: NylasApiEnvironmentStore.getEnvironment() componentWillUnmount: -> @_usub?() render: =>
{@_renderClose("quit")}

Welcome to Nylas

Enter your email address:
{@_environmentComponent()}
_renderError: -> if @state.error
{@state.error}
else
_onEmailChange: (event) => @setState email: event.target.value _onSubmit: (e) => valid = React.findDOMNode(@refs.form).reportValidity() if valid url = EdgehillAPI.urlForConnecting("inbox", @state.email) OnboardingActions.moveToPage("add-account-auth", {url}) else e.preventDefault() _environmentComponent: => return
unless atom.inDevMode()
_onEnvChange: (event) => OnboardingActions.changeAPIEnvironment event.target.value module.exports = LoginPage