mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-21 15:56:10 +08:00
feat(labels): replace account sidebar icon with proper image
This commit is contained in:
parent
98ad2e6ebc
commit
feac0d1b8a
|
@ -47,10 +47,20 @@ class AccountSidebarCategoryItem extends React.Component
|
||||||
onDragStateChange={ ({isDropping}) => @setState({isDropping}) }
|
onDragStateChange={ ({isDropping}) => @setState({isDropping}) }
|
||||||
onDrop={@_onDrop}>
|
onDrop={@_onDrop}>
|
||||||
{unread}
|
{unread}
|
||||||
<RetinaImg name={"#{@props.item.name}.png"} fallback={'folder.png'} mode={RetinaImg.Mode.ContentIsMask} />
|
|
||||||
|
{@_renderIcon()}
|
||||||
<span className="name"> {@props.item.displayName}</span>
|
<span className="name"> {@props.item.displayName}</span>
|
||||||
</DropZone>
|
</DropZone>
|
||||||
|
|
||||||
|
_renderIcon: ->
|
||||||
|
if @props.sectionType is "category" and NamespaceStore.current()
|
||||||
|
if NamespaceStore.current().usesLabels()
|
||||||
|
<RetinaImg name={"tag.png"} mode={RetinaImg.Mode.ContentIsMask} />
|
||||||
|
else
|
||||||
|
<RetinaImg name={"folder.png"} mode={RetinaImg.Mode.ContentIsMask} />
|
||||||
|
else if @props.sectionType is "mailboxes"
|
||||||
|
<RetinaImg name={"#{@props.item.name}.png"} fallback={'folder.png'} mode={RetinaImg.Mode.ContentIsMask} />
|
||||||
|
|
||||||
_shouldAcceptDrop: (e) =>
|
_shouldAcceptDrop: (e) =>
|
||||||
return false if @props.item.name in CategoryStore.LockedCategoryNames
|
return false if @props.item.name in CategoryStore.LockedCategoryNames
|
||||||
return false if @props.item.name is FocusedCategoryStore.categoryName()
|
return false if @props.item.name is FocusedCategoryStore.categoryName()
|
||||||
|
|
|
@ -60,7 +60,7 @@ class AccountSidebarStore extends NylasStore
|
||||||
@_sections = []
|
@_sections = []
|
||||||
if featureSheets.length > 0
|
if featureSheets.length > 0
|
||||||
@_sections.push { label: '', items: featureSheets, type: 'sheet' }
|
@_sections.push { label: '', items: featureSheets, type: 'sheet' }
|
||||||
@_sections.push { label: 'Mailboxes', items: standardCategories, type: 'category' }
|
@_sections.push { label: 'Mailboxes', items: standardCategories, type: 'mailboxes' }
|
||||||
@_sections.push { label: 'Views', items: extraSheets, type: 'sheet' }
|
@_sections.push { label: 'Views', items: extraSheets, type: 'sheet' }
|
||||||
@_sections.push { label: CategoryStore.categoryLabel(), items: userCategories, type: 'category' }
|
@_sections.push { label: CategoryStore.categoryLabel(), items: userCategories, type: 'category' }
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ class AccountSidebar extends React.Component
|
||||||
|
|
||||||
_itemComponents: (section) =>
|
_itemComponents: (section) =>
|
||||||
section.items?.map (item) =>
|
section.items?.map (item) =>
|
||||||
if section.type is 'category'
|
if section.type is 'mailboxes' or section.type is 'category'
|
||||||
itemClass = AccountSidebarCategoryItem
|
itemClass = AccountSidebarCategoryItem
|
||||||
else if section.type is 'sheet'
|
else if section.type is 'sheet'
|
||||||
itemClass = item.sidebarComponent ? SidebarSheetItem
|
itemClass = item.sidebarComponent ? SidebarSheetItem
|
||||||
|
@ -52,6 +52,7 @@ class AccountSidebar extends React.Component
|
||||||
<itemClass
|
<itemClass
|
||||||
key={item.id ? item.type}
|
key={item.id ? item.type}
|
||||||
item={item}
|
item={item}
|
||||||
|
sectionType={section.type}
|
||||||
select={item.id is @state.selected?.id }/>
|
select={item.id is @state.selected?.id }/>
|
||||||
|
|
||||||
_onStoreChange: =>
|
_onStoreChange: =>
|
||||||
|
|
Loading…
Reference in a new issue