diff --git a/app/assets/javascripts/discourse/app/components/sidebar.js b/app/assets/javascripts/discourse/app/components/sidebar.js index 56acf0c914c..2235025463c 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar.js +++ b/app/assets/javascripts/discourse/app/components/sidebar.js @@ -1,7 +1,5 @@ import GlimmerComponent from "discourse/components/glimmer"; import { bind } from "discourse-common/utils/decorators"; -import { customSections as sidebarCustomSections } from "discourse/lib/sidebar/custom-sections"; -import { cached } from "@glimmer/tracking"; export default class Sidebar extends GlimmerComponent { constructor() { @@ -38,11 +36,4 @@ export default class Sidebar extends GlimmerComponent { document.removeEventListener("click", this.collapseSidebar); } } - - @cached - get customSections() { - return sidebarCustomSections.map((customSection) => { - return new customSection({ sidebar: this }); - }); - } } diff --git a/app/assets/javascripts/discourse/app/components/sidebar/sections.js b/app/assets/javascripts/discourse/app/components/sidebar/sections.js new file mode 100644 index 00000000000..c260f738651 --- /dev/null +++ b/app/assets/javascripts/discourse/app/components/sidebar/sections.js @@ -0,0 +1,17 @@ +import GlimmerComponent from "discourse/components/glimmer"; +import { customSections as sidebarCustomSections } from "discourse/lib/sidebar/custom-sections"; + +export default class SidebarSections extends GlimmerComponent { + customSections; + + constructor() { + super(...arguments); + this.customSections = this._customSections; + } + + get _customSections() { + return sidebarCustomSections.map((customSection) => { + return new customSection({ sidebar: this }); + }); + } +} diff --git a/app/assets/javascripts/discourse/app/templates/components/sidebar.hbs b/app/assets/javascripts/discourse/app/templates/components/sidebar.hbs index 12058f9218c..0750f30782f 100644 --- a/app/assets/javascripts/discourse/app/templates/components/sidebar.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/sidebar.hbs @@ -1,52 +1,5 @@ diff --git a/app/assets/javascripts/discourse/app/templates/components/sidebar/section-link.hbs b/app/assets/javascripts/discourse/app/templates/components/sidebar/section-link.hbs index 2ff45cec2b2..293bd5341e0 100644 --- a/app/assets/javascripts/discourse/app/templates/components/sidebar/section-link.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/sidebar/section-link.hbs @@ -12,17 +12,21 @@ {{#if (eq @prefixType "image")}} {{/if}} + {{#if (eq @prefixType "text")}} {{@prefixValue}} {{/if}} + {{#if (eq @prefixType "icon")}} {{d-icon @prefixValue class="prefix-icon"}} {{/if}} + {{#if @prefixBadge}} {{d-icon @prefixBadge class="prefix-badge"}} {{/if}} {{/if}} + {{@content}} @@ -41,6 +45,7 @@ {{/if}} + {{#if @hoverValue}}