_ = require 'underscore' React = require 'react' classNames = require 'classnames' {ListTabular, RetinaImg, MailLabel, MailImportantIcon, InjectedComponentSet} = require 'nylas-component-kit' {Thread, AccountStore, CategoryStore, FocusedPerspectiveStore} = require 'nylas-exports' {ThreadArchiveQuickAction, ThreadTrashQuickAction} = require './thread-list-quick-actions' {timestamp, subject} = require './formatting-utils' ThreadListParticipants = require './thread-list-participants' ThreadListStore = require './thread-list-store' ThreadListIcon = require './thread-list-icon' c1 = new ListTabular.Column name: "★" resolver: (thread) => [ ] c2 = new ListTabular.Column name: "Participants" width: 200 resolver: (thread) => hasDraft = _.find (thread.metadata ? []), (m) -> m.draft if hasDraft
else c3LabelComponentCache = {} c3 = new ListTabular.Column name: "Message" flex: 4 resolver: (thread) => attachment = [] labels = [] if thread.hasAttachments attachment =
if AccountStore.accountForId(thread.accountId).usesLabels() currentCategories = FocusedPerspectiveStore.current().categories() ? [] ignored = [].concat(currentCategories, CategoryStore.hiddenCategories(thread.accountId)) ignoredIds = _.pluck(ignored, 'id') for label in (thread.sortedCategories()) continue if label.id in ignoredIds c3LabelComponentCache[label.id] ?= labels.push c3LabelComponentCache[label.id] {labels} {subject(thread.subject)} {thread.snippet} {attachment} c4 = new ListTabular.Column name: "Date" resolver: (thread) => {timestamp(thread.lastMessageReceivedTimestamp)} c5 = new ListTabular.Column name: "HoverActions" resolver: (thread) =>
]} matching={role: "ThreadListQuickAction"} className="thread-injected-quick-actions" exposedProps={thread: thread}/>
cNarrow = new ListTabular.Column name: "Item" flex: 1 resolver: (thread) => pencil = [] attachment = [] hasDraft = _.find (thread.metadata ? []), (m) -> m.draft if thread.hasAttachments attachment =
if hasDraft pencil = labels = [] if AccountStore.accountForId(thread.accountId).usesLabels() currentCategories = FocusedPerspectiveStore.current().categories() ? [] ignored = [].concat(currentCategories, CategoryStore.hiddenCategories(thread.accountId)) ignoredIds = _.pluck(ignored, 'id') for label in (thread.sortedCategories()) continue if label.id in ignoredIds c3LabelComponentCache[label.id] ?= labels.push c3LabelComponentCache[label.id]
{pencil} {attachment} {timestamp(thread.lastMessageReceivedTimestamp)}
{subject(thread.subject)}
{thread.snippet} 
{labels}
module.exports = Narrow: [cNarrow] Wide: [c1, c2, c3, c4, c5]