From 73111fd73013d8de6403cafa33416a23ad17058c Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 3 Apr 2024 18:07:33 -0300 Subject: content: generateGroupSidebar: base on generatePageSidebar --- .../dependencies/generateGroupGalleryPage.js | 10 +++--- src/content/dependencies/generateGroupInfoPage.js | 6 +++- src/content/dependencies/generateGroupSidebar.js | 37 ++++++++++++---------- 3 files changed, 31 insertions(+), 22 deletions(-) (limited to 'src/content') diff --git a/src/content/dependencies/generateGroupGalleryPage.js b/src/content/dependencies/generateGroupGalleryPage.js index b29c586f..d07847c6 100644 --- a/src/content/dependencies/generateGroupGalleryPage.js +++ b/src/content/dependencies/generateGroupGalleryPage.js @@ -178,10 +178,12 @@ export default { }), ], - ... - relations.sidebar - ?.slot('currentExtra', 'gallery') - ?.content, + leftSidebar: + (relations.sidebar + ? relations.sidebar + .slot('currentExtra', 'gallery') + .content /* TODO: Kludge. */ + : null), navLinkStyle: 'hierarchical', navLinks: diff --git a/src/content/dependencies/generateGroupInfoPage.js b/src/content/dependencies/generateGroupInfoPage.js index 2e1d1688..b5b456aa 100644 --- a/src/content/dependencies/generateGroupInfoPage.js +++ b/src/content/dependencies/generateGroupInfoPage.js @@ -207,7 +207,11 @@ export default { ], ], - ...relations.sidebar?.content ?? {}, + leftSidebar: + (relations.sidebar + ? relations.sidebar + .content /* TODO: Kludge. */ + : null), navLinkStyle: 'hierarchical', navLinks: relations.navLinks.content, diff --git a/src/content/dependencies/generateGroupSidebar.js b/src/content/dependencies/generateGroupSidebar.js index 98b288fa..3abb3392 100644 --- a/src/content/dependencies/generateGroupSidebar.js +++ b/src/content/dependencies/generateGroupSidebar.js @@ -1,18 +1,21 @@ export default { - contentDependencies: ['generateGroupSidebarCategoryDetails'], + contentDependencies: [ + 'generateGroupSidebarCategoryDetails', + 'generatePageSidebar', + ], + extraDependencies: ['html', 'language', 'wikiData'], - sprawl({groupCategoryData}) { - return {groupCategoryData}; - }, + sprawl: ({groupCategoryData}) => ({groupCategoryData}), - relations(relation, sprawl, group) { - return { - categoryDetails: - sprawl.groupCategoryData.map(category => - relation('generateGroupSidebarCategoryDetails', category, group)), - }; - }, + relations: (relation, sprawl, group) => ({ + sidebar: + relation('generatePageSidebar'), + + categoryDetails: + sprawl.groupCategoryData.map(category => + relation('generateGroupSidebarCategoryDetails', category, group)), + }), slots: { currentExtra: { @@ -20,10 +23,11 @@ export default { }, }, - generate(relations, slots, {html, language}) { - return { - leftSidebarClass: 'category-map-sidebar-box', - leftSidebarContent: [ + generate: (relations, slots, {html, language}) => + relations.sidebar.slots({ + attributes: {class: 'category-map-sidebar-box'}, + + content: [ html.tag('h1', language.$('groupSidebar.title')), @@ -31,6 +35,5 @@ export default { .map(details => details.slot('currentExtra', slots.currentExtra)), ], - }; - }, + }), }; -- cgit 1.3.0-6-gf8a5