diff --git a/web/src/elements/sidebar/Sidebar.ts b/web/src/elements/sidebar/Sidebar.ts index 144c90c24..54f191323 100644 --- a/web/src/elements/sidebar/Sidebar.ts +++ b/web/src/elements/sidebar/Sidebar.ts @@ -65,6 +65,32 @@ export class SidebarItem { } }); } + + async render(activePath: string): Promise { + if (this.condition) { + const result = await this.condition(); + if (!result) { + return html``; + } + } + return html`
  • + ${this.path ? + html` + ${this.name} + ` : + html` + ${this.name} + + + + +
    +
      + ${this._children.map((i) => until(i.render(activePath), html``))} +
    +
    `} +
  • `; + } } @customElement("ak-sidebar") @@ -118,37 +144,11 @@ export class Sidebar extends LitElement { }); } - async renderItem(item: SidebarItem): Promise { - if (item.condition) { - const result = await item.condition(); - if (!result) { - return html``; - } - } - return html`
  • - ${item.path ? - html` - ${item.name} - ` : - html` - ${item.name} - - - - -
    -
      - ${item._children.map((i) => until(this.renderItem(i), html``))} -
    -
    `} -
  • `; - } - render(): TemplateResult { return html``;