Mailspring/internal_packages/account-sidebar/lib/account-sidebar.cjsx
Ben Gotow 0669468ec0 fix(*): Small fixes for drafts, interface tweaks
Summary:
Message list can be narrower

Account sidebar is narrower

Never open new windows on single click

Blue send button

Clean up cruft from draft deletion

Render composer empty, setProps when draft populated

Use new `pristine` attribute to discard un-changed new drafts

_addToProxy needs deep equals to prevent "save to = [], cc = []"

Mark as read on click, not afterwards

Allow toolbar / sheet items to style based on the workspace mode

specs covering draft unloading / behavior of cleanup

Always, always reset mode to spec after each test

New tests for destroy draft functionality

Test Plan: Run a handful of new tests

Reviewers: evan

Reviewed By: evan

Differential Revision: https://review.inboxapp.com/D1335
2015-03-23 16:33:28 -07:00

55 lines
1.4 KiB
CoffeeScript

React = require 'react'
{Actions} = require("inbox-exports")
SidebarDividerItem = require("./account-sidebar-divider-item")
SidebarTagItem = require("./account-sidebar-tag-item")
SidebarStore = require ("./account-sidebar-store")
module.exports =
AccountSidebar = React.createClass
displayName: 'AccountSidebar'
getInitialState: ->
@_getStateFromStores()
componentDidMount: ->
@unsubscribe = SidebarStore.listen @_onStoreChange
# It's important that every React class explicitly stops listening to
# atom events before it unmounts. Thank you event-kit
# This can be fixed via a Reflux mixin
componentWillUnmount: ->
@unsubscribe() if @unsubscribe
render: ->
<div id="account-sidebar" className="account-sidebar">
<div className="account-sidebar-sections">
{@_sections()}
</div>
</div>
_sections: ->
return @state.sections.map (section) =>
<section key={section.label}>
{@_itemComponents(section)}
</section>
_itemComponents: (section) ->
return section.tags?.map (tag) =>
<SidebarTagItem
key={tag.id}
tag={tag}
select={tag?.id == @state?.selected}/>
_onStoreChange: ->
@setState @_getStateFromStores()
if not SidebarStore.selectedId()?
Actions.selectTagId("inbox")
_getStateFromStores: ->
sections: SidebarStore.sections()
selected: SidebarStore.selectedId()
AccountSidebar.minWidth = 165
AccountSidebar.maxWidth = 190