diff --git a/framework/core/js/src/forum/components/DiscussionListItem.tsx b/framework/core/js/src/forum/components/DiscussionListItem.tsx index 27e8e996d9..083918a13c 100644 --- a/framework/core/js/src/forum/components/DiscussionListItem.tsx +++ b/framework/core/js/src/forum/components/DiscussionListItem.tsx @@ -63,18 +63,22 @@ export default class DiscussionListItem{this.viewItems().toArray()}; + } + + viewItems(): ItemList { + const items = new ItemList(); + const discussion = this.attrs.discussion; const controls = DiscussionControls.controls(discussion, this).toArray(); - const attrs = this.elementAttrs(); - return ( -
- {this.controlsView(controls)} - {this.slidableUnderneathView()} - {this.contentView()} -
- ); + items.add('controls', this.controlsView(controls), 100); + items.add('slidableUnderneath', this.slidableUnderneathView(), 90); + items.add('content', this.contentView(), 80); + + return items; } controlsView(controls: Mithril.ChildArray): Mithril.Children { @@ -113,14 +117,22 @@ export default class DiscussionListItem - {this.authorAvatarView()} - {this.badgesView()} - {this.mainView()} - {this.replyCountItem()} + {this.contentItems().toArray()} ); } + contentItems(): ItemList { + const items = new ItemList(); + + items.add('authorAvatar', this.authorAvatarView(), 100); + items.add('badges', this.badgesView(), 90); + items.add('main', this.mainView(), 80); + items.add('replyCount', this.replyCountItem().toArray(), 70); + + return items; + } + authorAvatarView(): Mithril.Children { const discussion = this.attrs.discussion; const user = discussion.user(); @@ -149,12 +161,22 @@ export default class DiscussionListItem -

{highlight(discussion.title(), this.highlightRegExp)}

-
    {listItems(this.infoItems().toArray())}
+ {this.mainItems().toArray()} ); } + mainItems(): ItemList { + const items = new ItemList(); + + const discussion = this.attrs.discussion; + + items.add('title',

{highlight(discussion.title(), this.highlightRegExp)}

, 100); + items.add('info',
    {listItems(this.infoItems().toArray())}
, 90); + + return items; + } + getJumpTo() { const discussion = this.attrs.discussion; let jumpTo = 0; @@ -252,30 +274,38 @@ export default class DiscussionListItem { + const items = new ItemList(); + const discussion = this.attrs.discussion; const showUnread = !this.showRepliesCount() && discussion.isUnread(); if (showUnread) { - return ( + items.add( + 'unreadCount', + , + 100 ); - } + } else { + items.add( + 'count', + + - return ( - - + + {app.translator.trans('core.forum.discussion_list.total_replies_a11y_label', { count: discussion.replyCount() })} + + , + 100 + ); + } - - {app.translator.trans('core.forum.discussion_list.total_replies_a11y_label', { count: discussion.replyCount() })} - - - ); + return items; } }