_ = require 'underscore' React = require 'react' {Actions, Utils} = require 'nylas-exports' {InjectedComponentSet, ListTabular} = require 'nylas-component-kit' snippet = (html) => return "" unless html and typeof(html) is 'string' try text = Utils.extractTextFromHtml(html, maxLength: 400) text[0..200] catch return "" subject = (subj) -> if (subj ? "").trim().length is 0 return (No Subject) else return subj ParticipantsColumn = new ListTabular.Column name: "Participants" width: 200 resolver: (draft) => list = [].concat(draft.to, draft.cc, draft.bcc) if list.length > 0
{list.map((p) => p.displayName()).join(', ')}
else
(No Recipients)
ContentsColumn = new ListTabular.Column name: "Contents" flex: 4 resolver: (draft) => attachments = [] if draft.files?.length > 0 attachments =
{subject(draft.subject)} {snippet(draft.body)} {attachments} StatusColumn = new ListTabular.Column name: "State" resolver: (draft) => module.exports = Wide: [ParticipantsColumn, ContentsColumn, StatusColumn]