Skip to content

Commit 29a549b

Browse files
refactor(core): improve extensibility of IndexPage
1 parent fdaf097 commit 29a549b

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

framework/core/js/src/forum/components/IndexPage.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,29 @@ export default class IndexPage<CustomAttrs extends IIndexPageAttrs = IIndexPageA
6363
view() {
6464
return (
6565
<PageStructure className="IndexPage" hero={this.hero.bind(this)} sidebar={this.sidebar.bind(this)}>
66-
<div className="IndexPage-toolbar">
67-
<ul className="IndexPage-toolbar-view">{listItems(this.viewItems().toArray())}</ul>
68-
<ul className="IndexPage-toolbar-action">{listItems(this.actionItems().toArray())}</ul>
69-
</div>
70-
<DiscussionList state={app.discussions} />
66+
{this.contentItems().toArray()}
7167
</PageStructure>
7268
);
7369
}
7470

71+
contentItems(): ItemList<Mithril.Children> {
72+
const items = new ItemList<Mithril.Children>();
73+
74+
items.add('toolbar', <div className="IndexPage-toolbar">{this.toolbarItems().toArray()}</div>, 100);
75+
items.add('discussionList', <DiscussionList state={app.discussions} />, 90);
76+
77+
return items;
78+
}
79+
80+
toolbarItems(): ItemList<Mithril.Children> {
81+
const items = new ItemList<Mithril.Children>();
82+
83+
items.add('view', <ul className="IndexPage-toolbar-view">{listItems(this.viewItems().toArray())}</ul>, 100);
84+
items.add('action', <ul className="IndexPage-toolbar-action">{listItems(this.actionItems().toArray())}</ul>, 90);
85+
86+
return items;
87+
}
88+
7589
setTitle() {
7690
app.setTitle(extractText(app.translator.trans('core.forum.index.meta_title_text')));
7791
app.setTitleCount(0);

0 commit comments

Comments
 (0)