Mailspring/internal_packages/thread-list/lib/main.cjsx
Ben Gotow 343e592569 feat(draft-list) Refactor thread-list, create draft-list
Summary: Adds the draft list using a refactored list-tabular class. Also fixes several draft bugs that appeared after allowing editing.

Test Plan: Run tests (need to test new ListTabular component ASAP)

Reviewers: evan

Reviewed By: evan

Differential Revision: https://review.inboxapp.com/D1272
2015-03-09 18:25:53 -07:00

36 lines
No EOL
849 B
CoffeeScript

_ = require 'underscore-plus'
React = require "react"
{ComponentRegistry, WorkspaceStore} = require "inbox-exports"
ThreadList = require "./thread-list"
DraftList = require "./draft-list"
RootCenterComponent = React.createClass
displayName: 'RootCenterComponent'
getInitialState: ->
view: WorkspaceStore.selectedView()
componentDidMount: ->
@unsubscribe = WorkspaceStore.listen @_onStoreChange
componentWillUnmount: ->
@unsubscribe() if @unsubscribe
render: ->
views =
'threads': ThreadList
'drafts': DraftList
view = views[@state.view]
<view />
_onStoreChange: ->
@setState
view: WorkspaceStore.selectedView()
module.exports =
activate: (@state={}) ->
ComponentRegistry.register
view: RootCenterComponent
name: 'RootCenterComponent'
role: 'Root:Center'