mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-24 09:16:07 +08:00
bda80df05c
Summary: Fixes T2272 If the label is too long, the unread icons will now ellipsis truncate the text correctly instead of being pushed off of the side. I made the max-width of the sidebar 17px wider to allow for Karim's french "Inbox" translation. Fixes T2266 Added some more protection to places where filenames could be blank when downloading. This was partially fixed by Rob's D1685 Fixes T2258 You can now finish selecting a participant by pressing `space`, but only when the participant looks like an email address. When you do this we directly add the email address to the chip instead of looking up a contact. This allows you to send just to the email instead of adding a potentially erroneous name into the input field Test Plan: edgehill --test Reviewers: bengotow Reviewed By: bengotow Maniphest Tasks: T2272, T2266, T2258 Differential Revision: https://phab.nylas.com/D1729
66 lines
1.9 KiB
CoffeeScript
66 lines
1.9 KiB
CoffeeScript
React = require 'react'
|
|
{Actions} = require("nylas-exports")
|
|
{ScrollRegion} = require("nylas-component-kit")
|
|
SidebarDividerItem = require("./account-sidebar-divider-item")
|
|
SidebarTagItem = require("./account-sidebar-tag-item")
|
|
SidebarSheetItem = require("./account-sidebar-sheet-item")
|
|
SidebarStore = require ("./account-sidebar-store")
|
|
|
|
class AccountSidebar extends React.Component
|
|
@displayName: 'AccountSidebar'
|
|
|
|
@containerRequired: false
|
|
@containerStyles:
|
|
minWidth: 165
|
|
maxWidth: 207
|
|
|
|
constructor: (@props) ->
|
|
@state = @_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: =>
|
|
<ScrollRegion id="account-sidebar" className="account-sidebar">
|
|
<div className="account-sidebar-sections">
|
|
{@_sections()}
|
|
</div>
|
|
</ScrollRegion>
|
|
|
|
_sections: =>
|
|
return @state.sections.map (section) =>
|
|
<section key={section.label}>
|
|
<div className="heading">{section.label}</div>
|
|
{@_itemComponents(section)}
|
|
</section>
|
|
|
|
_itemComponents: (section) =>
|
|
section.items?.map (item) =>
|
|
if section.type is 'tag'
|
|
itemClass = SidebarTagItem
|
|
else if section.type is 'sheet'
|
|
itemClass = item.sidebarComponent ? SidebarSheetItem
|
|
else
|
|
throw new Error("Unsure how to render item type #{section.type}")
|
|
|
|
<itemClass
|
|
key={item.id ? item.type}
|
|
item={item}
|
|
select={item.id is @state.selected?.id }/>
|
|
|
|
_onStoreChange: =>
|
|
@setState @_getStateFromStores()
|
|
|
|
_getStateFromStores: =>
|
|
sections: SidebarStore.sections()
|
|
selected: SidebarStore.selected()
|
|
|
|
|
|
module.exports = AccountSidebar
|