mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 21:57:55 +08:00
00c74cd1a9
Summary: There are now two objects, Folders & Labels. These inherit from `Category` (that's what Eben said they were using on the backend). There are two separate tasks. 1. MoveToFolderTask 2. ApplyLabelsTask It turns out that the semantics between the two are quite different. The reverse operation for moving to a folder is a bit tricky. As of 7-8-15, the Tasks are pretty much complete. I need to write tests for them still and do some manual testing in the client. Test Plan: Writing specs Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D1724
88 lines
2.7 KiB
CoffeeScript
88 lines
2.7 KiB
CoffeeScript
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: =>
|
|
<div className="page">
|
|
{@_renderClose("quit")}
|
|
|
|
<RetinaImg name="onboarding-logo.png" mode={RetinaImg.Mode.ContentPreserve} className="logo"/>
|
|
|
|
<h2>Welcome to Nylas</h2>
|
|
|
|
<RetinaImg name="onboarding-divider.png" mode={RetinaImg.Mode.ContentPreserve} />
|
|
|
|
<form role="form" ref="form" onSubmit={@_onSubmit} className="email-form thin-container">
|
|
<div className="prompt">Enter your email address:</div>
|
|
|
|
<input type="email"
|
|
required={true}
|
|
ref="email"
|
|
className="input-email input-bordered"
|
|
placeholder="you@gmail.com"
|
|
tabIndex="1"
|
|
value={@state.email}
|
|
onChange={@_onEmailChange}
|
|
id="email"
|
|
spellCheck="false"/>
|
|
|
|
<button className="btn btn-larger btn-gradient"
|
|
style={width:215}>Start using Nylas</button>
|
|
{@_environmentComponent()}
|
|
</form>
|
|
|
|
</div>
|
|
|
|
_renderError: ->
|
|
if @state.error
|
|
<div className="alert alert-danger" role="alert">
|
|
{@state.error}
|
|
</div>
|
|
else <div></div>
|
|
|
|
_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 <div></div> unless atom.inDevMode()
|
|
<div className="environment-selector">
|
|
<select value={@state.environment} onChange={@_onEnvChange}>
|
|
<option value="development">Development (edgehill-dev, api-staging)</option>
|
|
<option value="experimental">Experimental (edgehill-experimental, api-experimental)</option>
|
|
<option value="staging">Staging (edgehill-staging, api-staging)</option>
|
|
<option value="production">Production (edgehill, api)</option>
|
|
</select>
|
|
</div>
|
|
|
|
_onEnvChange: (event) =>
|
|
OnboardingActions.changeAPIEnvironment event.target.value
|
|
|
|
module.exports = LoginPage
|