Make unread discussion titles less overwhelming

This commit is contained in:
Toby Zerner 2015-09-08 10:27:50 +09:30
parent 76d0e7770c
commit ca53a63fd8
3 changed files with 8 additions and 3 deletions

View File

@ -51,6 +51,7 @@ export default class DiscussionListItem extends Component {
const discussion = this.props.discussion;
const startUser = discussion.startUser();
const isUnread = discussion.isUnread();
const isRead = discussion.isRead();
const showUnread = !this.showRepliesCount() && isUnread;
const jumpTo = Math.min(discussion.lastPostNumber(), (discussion.readNumber() || 0) + 1);
const relevantPosts = this.props.params.q ? discussion.relevantPosts() : [];
@ -71,7 +72,7 @@ export default class DiscussionListItem extends Component {
{icon('check')}
</a>
<div className={'DiscussionListItem-content Slidable-content' + (isUnread ? ' unread' : '')}>
<div className={'DiscussionListItem-content Slidable-content' + (isUnread ? ' unread' : '') + (isRead ? ' read' : '')}>
<a href={startUser ? app.route.user(startUser) : '#'}
className="DiscussionListItem-author"
title={extractText(app.trans('core.discussion_started', {user: startUser, ago: humanTime(discussion.startTime())}))}

View File

@ -25,6 +25,7 @@ export default class Discussion extends mixin(Model, {
readTime: Model.attribute('readTime', Model.transformDate),
readNumber: Model.attribute('readNumber'),
isUnread: computed('unreadCount', unreadCount => !!unreadCount),
isRead: computed('unreadCount', unreadCount => app.session.user && !unreadCount),
canReply: Model.attribute('canReply'),
canRename: Model.attribute('canRename'),
@ -61,7 +62,7 @@ export default class Discussion extends mixin(Model, {
const user = app.session.user;
if (user && user.readTime() < this.lastTime()) {
return Math.max(0, this.lastPostNumber() - (this.readNumber() || 0))
return Math.max(0, this.lastPostNumber() - (this.readNumber() || 0));
}
return 0;

View File

@ -44,8 +44,11 @@
overflow: hidden;
text-overflow: ellipsis;
.read & {
color: mix(@heading-color, @body-bg, 60%);
}
.unread & {
font-weight: bold;
font-weight: 600;
}
}
.DiscussionListItem-info {