Skip to content

Commit

Permalink
[1.x] [extensibility] refactor(core): improve extensibility of `Discu…
Browse files Browse the repository at this point in the history
…ssionPage` (#4046)

* refactor(core): improve extensibility of `DiscussionPage`

* chore(core): improve type safety
  • Loading branch information
DavideIadeluca authored Sep 30, 2024
1 parent ca6d826 commit 4912a2e
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions framework/core/js/src/forum/components/DiscussionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,21 @@ export default class DiscussionPage<CustomAttrs extends IDiscussionPageAttrs = I
}
}

view() {
return (
<div className="DiscussionPage">
<DiscussionListPane state={app.discussions} />
<div className="DiscussionPage-discussion">{this.discussion ? this.pageContent().toArray() : this.loadingItems().toArray()}</div>
</div>
view(): Mithril.Children {
return <div className="DiscussionPage">{this.viewItems().toArray()}</div>;
}

viewItems(): ItemList<Mithril.Children> {
const items = new ItemList<Mithril.Children>();

items.add('pane', <DiscussionListPane state={app.discussions} />, 100);
items.add(
'discussions',
<div className="DiscussionPage-discussion">{this.discussion ? this.pageContent().toArray() : this.loadingItems().toArray()}</div>,
90
);

return items;
}

/**
Expand Down

0 comments on commit 4912a2e

Please sign in to comment.