Mailspring/internal_packages/preferences/lib/preferences.cjsx
Drew Regitsky 5533755b03 New onboarding flow, uses new Nylas auth
Summary:
Depends on D2049
This change replaces the onboarding flow to include new graphics, copy, and
support for the new Nylas auth flow. New account choosing UI presents a list
of account types, rather than guessing based on an entered email. Pages before
and after introduce the user to different features of the client.

Known issue: Polling for gmail account connection works, but continues even if
you leave the page.

Test Plan: Manual testing.

Reviewers: evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2050
2015-09-22 20:11:51 -07:00

50 lines
1.4 KiB
CoffeeScript

React = require 'react'
_ = require 'underscore'
{RetinaImg, Flexbox, ConfigPropContainer} = require 'nylas-component-kit'
PreferencesStore = require './preferences-store'
PreferencesHeader = require './preferences-header'
class Preferences extends React.Component
@displayName: 'Preferences'
constructor: (@props) ->
@state = _.extend @getStateFromStores(),
activeTab: PreferencesStore.tabs()[0]
componentDidMount: =>
@unlisteners = []
@unlisteners.push PreferencesStore.listen =>
@setState(@getStateFromStores())
componentWillUnmount: =>
unlisten() for unlisten in @unlisteners
componentDidUpdate: =>
if @state.tabs.length > 0 and not @state.activeTab
@setState(activeTab: @state.tabs[0])
getStateFromStores: =>
tabs: PreferencesStore.tabs()
render: =>
if @state.activeTab
bodyElement = <@state.activeTab.component config={@state.config} />
else
bodyElement = <div>No Tab Active</div>
<div className="preferences-wrap">
<PreferencesHeader tabs={@state.tabs}
activeTab={@state.activeTab}
changeActiveTab={@_onChangeActiveTab}/>
<ConfigPropContainer>
{bodyElement}
</ConfigPropContainer>
<div style={clear:'both'}></div>
</div>
_onChangeActiveTab: (tab) =>
@setState(activeTab: tab)
module.exports = Preferences