mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 16:02:44 +08:00
Make unread discussion titles less overwhelming
This commit is contained in:
parent
76d0e7770c
commit
ca53a63fd8
|
@ -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())}))}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user