mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-25 05:54:44 +08:00
Fix display of labels vs. folders in the sidebar
This commit is contained in:
parent
73b7fe5553
commit
f7f345baf9
7 changed files with 15 additions and 20 deletions
|
@ -3,6 +3,7 @@ _ = require 'underscore'
|
|||
SyncbackCategoryTask,
|
||||
DestroyCategoryTask,
|
||||
CategoryStore,
|
||||
Label,
|
||||
Category,
|
||||
ExtensionRegistry,
|
||||
RegExpUtils} = require 'nylas-exports'
|
||||
|
@ -165,21 +166,27 @@ class SidebarSection
|
|||
items.push(item)
|
||||
seenItems[itemKey] = item
|
||||
|
||||
|
||||
title ?= account.categoryLabel()
|
||||
CategoryClass = CategoryStore.getInboxCategory(account).constructor
|
||||
iconName = null
|
||||
if CategoryClass == Label
|
||||
title ?= "Labels"
|
||||
iconName = "tag.png"
|
||||
else
|
||||
title ?= "Folders"
|
||||
iconName = "folder.png"
|
||||
collapsed = isSectionCollapsed(title)
|
||||
if collapsible
|
||||
onCollapseToggled = toggleSectionCollapsed
|
||||
|
||||
return {
|
||||
title: title
|
||||
iconName: account.categoryIcon()
|
||||
iconName: iconName
|
||||
items: items
|
||||
collapsed: collapsed
|
||||
onCollapseToggled: onCollapseToggled
|
||||
onItemCreated: (displayName) ->
|
||||
return unless displayName
|
||||
category = new Category
|
||||
category = new CategoryClass
|
||||
displayName: displayName
|
||||
accountId: account.id
|
||||
Actions.queueTask(new SyncbackCategoryTask({category}))
|
||||
|
|
|
@ -117,7 +117,7 @@ class SidebarStore extends NylasStore
|
|||
if multiAccount
|
||||
opts.title = acc.label
|
||||
opts.collapsible = true
|
||||
SidebarSection.forUserCategories(acc, opts)
|
||||
return SidebarSection.forUserCategories(acc, opts)
|
||||
@trigger()
|
||||
|
||||
|
||||
|
|
|
@ -14,12 +14,10 @@ describe('MailboxPerspective', function mailboxPerspective() {
|
|||
a1: {
|
||||
id: 'a1',
|
||||
preferredRemovalDestination: () => ({displayName: 'archive'}),
|
||||
categoryIcon: () => null,
|
||||
},
|
||||
a2: {
|
||||
id: 'a2',
|
||||
preferredRemovalDestination: () => ({displayName: 'trash2'}),
|
||||
categoryIcon: () => null,
|
||||
},
|
||||
}
|
||||
this.perspective = new MailboxPerspective(this.accountIds)
|
||||
|
|
|
@ -119,14 +119,6 @@ export default class Account extends ModelWithMetadata {
|
|||
return this.me()
|
||||
}
|
||||
|
||||
categoryLabel() {
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
categoryIcon() {
|
||||
return 'bla.png'
|
||||
}
|
||||
|
||||
// Public: Returns the localized, properly capitalized provider name,
|
||||
// like Gmail, Exchange, or Outlook 365
|
||||
displayProvider() {
|
||||
|
|
|
@ -253,12 +253,10 @@ class CategoryMailboxPerspective extends MailboxPerspective
|
|||
# Note: We pick the display name and icon assuming that you won't create a
|
||||
# perspective with Inbox and Sent or anything crazy like that... todo?
|
||||
@name = @_categories[0].displayName
|
||||
if @_categories[0].name
|
||||
@iconName = "#{@_categories[0].name}.png"
|
||||
if @_categories[0].role
|
||||
@iconName = "#{@_categories[0].role}.png"
|
||||
else
|
||||
account = AccountStore.accountForId(@accountIds[0])
|
||||
@iconName = "folder.png"
|
||||
@iconName = account.categoryIcon() if account
|
||||
@iconName = if @_categories[0] instanceof Label then "label.png" else "folder.png"
|
||||
@
|
||||
|
||||
toJSON: =>
|
||||
|
|
BIN
packages/client-app/static/images/source-list/label@1x.png
Normal file
BIN
packages/client-app/static/images/source-list/label@1x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 275 B |
BIN
packages/client-app/static/images/source-list/label@2x.png
Normal file
BIN
packages/client-app/static/images/source-list/label@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 493 B |
Loading…
Add table
Reference in a new issue