Mailspring/internal_packages/onboarding/lib/welcome-page.cjsx
Ben Gotow 467955dc2c fix(onboarding): Invitation code system, just in case
commit 64938016f6ffbf366a220e7abd9af6f7a4cb478b
Author: Ben Gotow <bengotow@gmail.com>
Date:   Sun Oct 4 16:42:38 2015 -0700

    Don't allow people to double click the token check button, make requests take at least 400msec

commit e548f3ee449c676a813c5630f1624963872ed6e6
Merge: 3350b91 e4b4933
Author: Ben Gotow <bengotow@gmail.com>
Date:   Sun Oct 4 16:39:56 2015 -0700

    Merge branch 'token-auth' of github.com:nylas/N1 into token-auth

    # Conflicts:
    #	internal_packages/onboarding/lib/token-auth-page.cjsx

commit 3350b917449c29299fa078d59a4a5a9339fdf29b
Author: Ben Gotow <bengotow@gmail.com>
Date:   Sun Oct 4 16:38:52 2015 -0700

    Improve a few error states, adding "checking" state when checking token

commit e4b49334cbf59145d9bdd955d35636f16a7c4924
Author: EthanBlackburn <ethan@nylas.com>
Date:   Sun Oct 4 16:21:39 2015 -0700

    Correct retry behavior

commit 11cd9a75b2a1ca0f4347160df93815743909ccea
Author: EthanBlackburn <ethan@nylas.com>
Date:   Sat Oct 3 18:06:55 2015 -0700

    Removed old auth token variable

commit afe451cd70de528def3443d8b373fd24f4aa5cde
Author: EthanBlackburn <ethan@nylas.com>
Date:   Sat Oct 3 16:08:12 2015 -0700

    Added token auth page
2015-10-04 16:49:41 -07:00

129 lines
4.8 KiB
CoffeeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

React = require 'react'
shell = require 'shell'
classnames = require 'classnames'
{RetinaImg, TimeoutTransitionGroup} = require 'nylas-component-kit'
PageRouterStore = require './page-router-store'
OnboardingActions = require './onboarding-actions'
class WelcomePage extends React.Component
@displayName: "WelcomePage"
constructor: (@props) ->
@state =
step: 0
lastStep: 0
render: ->
<div className="welcome-page page opaque">
<div className="quit" onClick={ -> OnboardingActions.closeWindow() }>
<RetinaImg name="onboarding-close.png" mode={RetinaImg.Mode.ContentPreserve}/>
</div>
<div className="steps-container">{@_renderSteps()}</div>
<div className="footer">{@_renderButtons()}</div>
</div>
_renderButtons: ->
buttons = []
# if @state.step > 0
# buttons.push <span key="back" className="btn-back" onClick={@_onBack}>Back</span>
btnText = if @state.step is 2 then "Get Started" else "Continue"
buttons.push <button key="next" className="btn btn-large btn-continue" onClick={@_onContinue}>{btnText}</button>
return buttons
_renderSteps: -> [
@_renderStep0()
@_renderStep1()
@_renderStep2()
]
_stepClass: (n) ->
obj =
"step-wrap": true
"active": @state.step is n
obj["step-#{n}-wrap"] = true
className = classnames(obj)
return className
_renderStep0: ->
<div className={@_stepClass(0)} key="step-0">
<RetinaImg className="logo" style={zoom: 0.20, marginTop: 60, opacity: 0.7} url="nylas://onboarding/assets/nylas-pictographB@2x.png" mode={RetinaImg.Mode.ContentPreserve}/>
<p className="hero-text" style={marginTop: 30, fontSize: 44}>Say hello to N1.</p>
<p className="sub-text" style={marginTop: 0, fontSize: 24}>The next-generation email platform.</p>
<div style={fontSize:17, marginTop: 45}>Built with by Nylas</div>
<RetinaImg className="icons" style={position: "absolute", left: -45, top: 130} url="nylas://onboarding/assets/shapes-left@2x.png" mode={RetinaImg.Mode.ContentIsMask} />
<RetinaImg className="icons" style={position: "absolute", right: -40, top: 130} url="nylas://onboarding/assets/shapes-right@2x.png" mode={RetinaImg.Mode.ContentIsMask} />
{@_renderNavBubble(0)}
</div>
_renderStep1: ->
<div className={@_stepClass(1)} key="step-1">
<p className="hero-text" style={marginTop: 40}>Developers welcome.</p>
<div className="gear-outer-container"><div className="gear-container">
{@_gears()}
</div></div>
<RetinaImg className="gear-small" mode={RetinaImg.Mode.ContentPreserve}
url="nylas://onboarding/assets/gear-small@2x.png" />
<RetinaImg className="wrench" mode={RetinaImg.Mode.ContentPreserve}
url="nylas://onboarding/assets/wrench@2x.png" />
<p className="sub-text">N1 is built with modern web technologies and is easy to extend with JavaScript.</p>
{@_renderNavBubble(1)}
</div>
_gears: ->
gears = []
for i in [0..3]
gears.push <RetinaImg className="gear-large gear-large-#{i}"
mode={RetinaImg.Mode.ContentPreserve}
url="nylas://onboarding/assets/gear-large@2x.png" />
return gears
_renderStep2: ->
<div className={@_stepClass(2)} key="step-2">
<p className="hero-text" style={marginTop: 40}>N1 is made possible by the Nylas Sync Engine</p>
<div className="cell-wrap">
<div className="cell" style={float: "left"}>
<RetinaImg mode={RetinaImg.Mode.ContentPreserve}
style={paddingTop: 4, paddingBottom: 4}
url="nylas://onboarding/assets/cloud@2x.png" />
<p>A modern API layer for<br/>email, contacts &amp; calendar</p>
<a onClick={=> @_open("https://github.com/nylas/sync-engine")}>more info</a>
</div>
<div className="cell" style={float: "right"}>
<RetinaImg mode={RetinaImg.Mode.ContentPreserve}
url="nylas://onboarding/assets/lock@2x.png" />
<p>Secured using<br/>bank-grade encryption</p>
<a onClick={=> @_open("https://nylas.com/security/")}>more info</a>
</div>
</div>
{@_renderNavBubble(2)}
</div>
_open: (link) ->
shell.openExternal(link)
return
_renderNavBubble: (step=0) ->
bubbles = [0..2].map (n) =>
active = if n is step then "active" else ""
<div className="nav-bubble #{active}"
onClick={ => @setState step: n }></div>
<div className="nav-bubbles">
{bubbles}
</div>
_onBack: =>
@setState(step: @state.step - 1)
_onContinue: =>
if @state.step < 2
@setState(step: @state.step + 1)
else
if PageRouterStore.tokenAuthEnabled() is "no"
OnboardingActions.moveToPage("account-choose")
else
OnboardingActions.moveToPage("token-auth")
module.exports = WelcomePage