mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
36 lines
825 B
Text
36 lines
825 B
Text
|
React = require 'react'
|
||
|
_ = require "underscore"
|
||
|
{Flexbox} = require 'nylas-component-kit'
|
||
|
classNames = require 'classnames'
|
||
|
|
||
|
SettingsStore = require './settings-store'
|
||
|
Tabs = require './tabs'
|
||
|
|
||
|
class SettingsView extends React.Component
|
||
|
@displayName: 'SettingsView'
|
||
|
|
||
|
constructor: (@props) ->
|
||
|
@state = @_getStateFromStores()
|
||
|
|
||
|
render: =>
|
||
|
SettingsTabComponent = Tabs[@state.tabIndex].component
|
||
|
<div className="settings-view">
|
||
|
<SettingsTabComponent />
|
||
|
</div>
|
||
|
|
||
|
componentDidMount: =>
|
||
|
@_unsubscribers = []
|
||
|
@_unsubscribers.push SettingsStore.listen(@_onChange)
|
||
|
|
||
|
componentWillUnmount: =>
|
||
|
unsubscribe() for unsubscribe in @_unsubscribers
|
||
|
|
||
|
_getStateFromStores: =>
|
||
|
tabIndex: SettingsStore.tabIndex()
|
||
|
|
||
|
_onChange: =>
|
||
|
@setState(@_getStateFromStores())
|
||
|
|
||
|
|
||
|
module.exports = SettingsView
|