   key = "core.accountSidebarCollapsed.#{id}"
   NylasEnv.config.get(key)
 
+toggleItemCollapsed = (item) ->
+  return unless item.children.length > 0
+  key = "core.accountSidebarCollapsed.#{item.id}"
+  NylasEnv.config.set(key, not item.collapsed)
+
 
 class SidebarItem
 

      count,
      sheet,
      children,
      onSelect: (item) ->
        Actions.selectRootSheet(item.sheet)
    }

  @forDrafts: ({accountId, name, children} = {}) ->
    sheet = WorkspaceStore.Sheet.Drafts
    iconName = 'drafts.png'
    name ?= 'Drafts'
    count = if accountId?
      DraftCountStore.count(accountId)
    else
      DraftCountStore.totalCount()
    @forSheet(name, iconName, sheet, count)


module.exports = SidebarItem

      counterStyle: counterStyle
      dataTransferType: dataTransferType
      onDelete: onDeleteItem
      onToggleCollapsed: toggleItemCollapsed
      onDrop: (item, ids) ->
        return unless ids
        item.perspective.applyToThreads(ids)
