Skip to content

Commit 4912a2e

Browse files
[1.x] [extensibility] refactor(core): improve extensibility of DiscussionPage (#4046)
* refactor(core): improve extensibility of `DiscussionPage` * chore(core): improve type safety
1 parent ca6d826 commit 4912a2e

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,21 @@ export default class DiscussionPage<CustomAttrs extends IDiscussionPageAttrs = I
7979
}
8080
}
8181

82-
view() {
83-
return (
84-
<div className="DiscussionPage">
85-
<DiscussionListPane state={app.discussions} />
86-
<div className="DiscussionPage-discussion">{this.discussion ? this.pageContent().toArray() : this.loadingItems().toArray()}</div>
87-
</div>
82+
view(): Mithril.Children {
83+
return <div className="DiscussionPage">{this.viewItems().toArray()}</div>;
84+
}
85+
86+
viewItems(): ItemList<Mithril.Children> {
87+
const items = new ItemList<Mithril.Children>();
88+
89+
items.add('pane', <DiscussionListPane state={app.discussions} />, 100);
90+
items.add(
91+
'discussions',
92+
<div className="DiscussionPage-discussion">{this.discussion ? this.pageContent().toArray() : this.loadingItems().toArray()}</div>,
93+
90
8894
);
95+
96+
return items;
8997
}
9098

9199
/**

0 commit comments

Comments
 (0)