fix(thread-list): Show an attachment indicator using thread metadata

This commit is contained in:
Ben Gotow 2015-07-17 16:34:48 -07:00
parent 63f5c4091d
commit 741f360df5
3 changed files with 19 additions and 9 deletions

View file

@ -85,13 +85,14 @@ class ThreadList extends React.Component
name: "Message" name: "Message"
flex: 4 flex: 4
resolver: (thread) => resolver: (thread) =>
attachments = [] attachment = []
if thread.hasAttachments hasAttachments = _.find (thread.metadata ? []), (m) -> m.files.length > 0
attachments = <div className="thread-icon thread-icon-attachment"></div> if hasAttachments
attachment = <div className="thread-icon thread-icon-attachment"></div>
<span className="details"> <span className="details">
<span className="subject">{subject(thread.subject)}</span> <span className="subject">{subject(thread.subject)}</span>
<span className="snippet">{thread.snippet}</span> <span className="snippet">{thread.snippet}</span>
{attachments} {attachment}
</span> </span>
c4 = new ListTabular.Column c4 = new ListTabular.Column
@ -111,16 +112,23 @@ class ThreadList extends React.Component
flex: 1 flex: 1
resolver: (thread) => resolver: (thread) =>
pencil = [] pencil = []
attachment = []
hasDraft = _.find (thread.metadata ? []), (m) -> m.draft hasDraft = _.find (thread.metadata ? []), (m) -> m.draft
hasAttachments = _.find (thread.metadata ? []), (m) -> m.files.length > 0
if hasDraft if hasDraft
pencil = <RetinaImg name="icon-draft-pencil.png" className="draft-icon" mode={RetinaImg.Mode.ContentPreserve} /> pencil = <RetinaImg name="icon-draft-pencil.png" className="draft-icon" mode={RetinaImg.Mode.ContentPreserve} />
if hasAttachments
attachment = <div className="thread-icon thread-icon-attachment"></div>
<div> <div>
<div style={display: 'flex'}> <div style={display: 'flex'}>
<ThreadListIcon thread={thread} /> <ThreadListIcon thread={thread} />
<ThreadListParticipants thread={thread} /> <ThreadListParticipants thread={thread} />
<span className="timestamp">{timestamp(thread.lastMessageTimestamp)}</span>
{pencil} {pencil}
<span style={flex:1}></span>
{attachment}
<span className="timestamp">{timestamp(thread.lastMessageTimestamp)}</span>
</div> </div>
<div className="subject">{subject(thread.subject)}</div> <div className="subject">{subject(thread.subject)}</div>
<div className="snippet">{thread.snippet}</div> <div className="snippet">{thread.snippet}</div>

View file

@ -83,8 +83,10 @@
position: relative; position: relative;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
flex-shrink:0;
top:2px; top:2px;
// Shrink, but only after snippet has shrunk
flex-shrink:0.1;
} }
.snippet { .snippet {
font-size: @font-size-small; font-size: @font-size-small;
@ -94,6 +96,7 @@
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
top:2px; top:2px;
flex: 1;
} }
.thread-icon { .thread-icon {
flex-shrink:0; flex-shrink:0;
@ -146,6 +149,8 @@
} }
.thread-icon-attachment { .thread-icon-attachment {
background-image:url(../static/images/thread-list/icon-attachment-@2x.png); background-image:url(../static/images/thread-list/icon-attachment-@2x.png);
margin-right:-15px;
margin-left:0;
} }
.thread-icon-unread { .thread-icon-unread {
background-image:url(../static/images/thread-list/icon-unread-@2x.png); background-image:url(../static/images/thread-list/icon-unread-@2x.png);
@ -250,7 +255,6 @@
.thread-list-narrow { .thread-list-narrow {
.timestamp { .timestamp {
flex: 1;
order: 100; order: 100;
} }
.participants { .participants {

View file

@ -116,6 +116,4 @@ class Thread extends Model
hasLabelName: (name) -> @hasCategoryName(name) hasLabelName: (name) -> @hasCategoryName(name)
hasFolderName: (name) -> @hasCategoryName(name) hasFolderName: (name) -> @hasCategoryName(name)
hasAttachments: null ## TODO
module.exports = Thread module.exports = Thread