diff --git a/internal_packages/account-sidebar/lib/account-sidebar-section.cjsx b/internal_packages/account-sidebar/lib/account-sidebar-section.cjsx index bc2adf7f3..6a4885f2f 100644 --- a/internal_packages/account-sidebar/lib/account-sidebar-section.cjsx +++ b/internal_packages/account-sidebar/lib/account-sidebar-section.cjsx @@ -34,7 +34,8 @@ class AccountSidebarSection extends React.Component _createItemButton: ({label}) ->
+ onMouseDown={@_onCreateButtonMouseDown} + onMouseUp={@_onCreateButtonClicked.bind(@, label)}> @setState(showCreateInput: false) } + onBlur={@_onInputBlur} placeholder={placeholder}/>
@@ -87,9 +88,16 @@ class AccountSidebarSection extends React.Component components + _onCreateButtonMouseDown: => + @_clickingCreateButton = true + _onCreateButtonClicked: (sectionLabel) => + @_clickingCreateButton = false @setState(showCreateInput: not @state.showCreateInput) + _onInputBlur: => + @setState(showCreateInput: false) if not @_clickingCreateButton + _onInputKeyDown: (event, section) => if event.key is 'Escape' @setState(showCreateInput: false) diff --git a/internal_packages/account-sidebar/lib/account-sidebar-store.coffee b/internal_packages/account-sidebar/lib/account-sidebar-store.coffee index 480d61ba5..4f8df1f99 100644 --- a/internal_packages/account-sidebar/lib/account-sidebar-store.coffee +++ b/internal_packages/account-sidebar/lib/account-sidebar-store.coffee @@ -143,6 +143,7 @@ class AccountSidebarStore extends NylasStore _destroyCategory: (sidebarItem) -> category = sidebarItem.mailViewFilter.category + return if category.isDeleted is true Actions.queueTask(new DestroyCategoryTask({category})) _itemUnreadCount: (category) => diff --git a/src/components/disclosure-triangle.cjsx b/src/components/disclosure-triangle.cjsx index 24890b2ca..478aad15b 100644 --- a/src/components/disclosure-triangle.cjsx +++ b/src/components/disclosure-triangle.cjsx @@ -6,7 +6,10 @@ class DisclosureTriangle extends React.Component @propTypes: collapsed: React.PropTypes.bool visible: React.PropTypes.bool - onToggleCollapsed: React.PropTypes.func.isRequired + onToggleCollapsed: React.PropTypes.func + + @defaultProps: + onToggleCollapsed: -> render: -> classnames = "disclosure-triangle"