From c196139ddf28e57dc945331adc9a65cf54c83aa1 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Thu, 9 Feb 2023 19:52:40 +0100 Subject: [PATCH] only render router-slot if there are any routes --- .../workspace-layout.element.ts | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-layout/workspace-layout.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-layout/workspace-layout.element.ts index e1139063e6..a03fece328 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-layout/workspace-layout.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-layout/workspace-layout.element.ts @@ -148,27 +148,10 @@ export class UmbWorkspaceLayout extends UmbLitElement { ${this.#renderViews()} - - { - this._routerPath = event.target.absoluteRouterPath; - }} - @change=${(event: UmbRouterSlotChangeEvent) => { - this._activePath = event.target.localActiveViewPath; - }}> - + ${this.#renderRoutes()} - - - extension.meta.workspaces.includes(this.alias)} - default-element="umb-workspace-action"> - + ${this.#renderWorkspaceActions()} `; @@ -197,6 +180,34 @@ export class UmbWorkspaceLayout extends UmbLitElement { : nothing} `; } + + #renderRoutes() { + return html` + ${this._routes.length > 0 + ? html` + { + this._routerPath = event.target.absoluteRouterPath; + }} + @change=${(event: UmbRouterSlotChangeEvent) => { + this._activePath = event.target.localActiveViewPath; + }}> + ` + : nothing} + `; + } + + #renderWorkspaceActions() { + return html` + extension.meta.workspaces.includes(this.alias)} + default-element="umb-workspace-action"> + `; + } } declare global {