From 3f34802b495b6e568530f66ece264f4a160d881b Mon Sep 17 00:00:00 2001 From: Davide Iadeluca Date: Tue, 17 Sep 2024 12:06:45 +0200 Subject: [PATCH] refactor(core): improve extensibility of `IndexPage` --- .../js/src/forum/components/IndexPage.tsx | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/framework/core/js/src/forum/components/IndexPage.tsx b/framework/core/js/src/forum/components/IndexPage.tsx index 404eb3487d..7991610f32 100644 --- a/framework/core/js/src/forum/components/IndexPage.tsx +++ b/framework/core/js/src/forum/components/IndexPage.tsx @@ -60,19 +60,39 @@ export default class IndexPage -
-
-
    {listItems(this.viewItems().toArray())}
-
    {listItems(this.actionItems().toArray())}
-
- -
+
{this.contentItems().toArray()}
); } + contentItems(): ItemList { + const items = new ItemList(); + + items.add('toolbar', this.toolbarView(), 100); + items.add('discussionList', this.discussionListView(), 90); + + return items; + } + + toolbarView(): Mithril.Children { + return
{this.toolbarItems().toArray()}
; + } + + discussionListView(): Mithril.Children { + return ; + } + + toolbarItems(): ItemList { + const items = new ItemList(); + + items.add('view',
    {listItems(this.viewItems().toArray())}
, 100); + items.add('action',
    {listItems(this.actionItems().toArray())}
, 90); + + return items; + } + setTitle() { app.setTitle(extractText(app.translator.trans('core.forum.index.meta_title_text'))); app.setTitleCount(0);