remove workspace editor redirect

This commit is contained in:
Niels Lyngsø
2024-07-02 19:37:35 +02:00
parent 58ff482ae5
commit 42d0d8a6da

View File

@@ -71,11 +71,8 @@ export class UmbWorkspaceEditorElement extends UmbLitElement {
} as UmbRoute;
});
newRoutes.push({
path: '',
redirectTo: newRoutes[0]?.path,
});
// Duplicate first workspace and use it for the empty path scenario. [NL]
newRoutes.push({ ...newRoutes[0], path: '' });
}
newRoutes.push({
@@ -116,15 +113,18 @@ export class UmbWorkspaceEditorElement extends UmbLitElement {
${repeat(
this._workspaceViews,
(view) => view.alias,
(view) => html`
<uui-tab
href="${this._routerPath}/view/${view.meta.pathname}"
.label="${view.meta.label ? this.localize.string(view.meta.label) : view.name}"
?active=${'view/' + view.meta.pathname === this._activePath}>
<umb-icon slot="icon" name=${view.meta.icon}></umb-icon>
${view.meta.label ? this.localize.string(view.meta.label) : view.name}
</uui-tab>
`,
(view, index) =>
// Notice how we use index 0 to determine which workspace that is active with empty path. [NL]
html`
<uui-tab
href="${this._routerPath}/view/${view.meta.pathname}"
.label="${view.meta.label ? this.localize.string(view.meta.label) : view.name}"
?active=${'view/' + view.meta.pathname === this._activePath ||
(index === 0 && this._activePath === '')}>
<umb-icon slot="icon" name=${view.meta.icon}></umb-icon>
${view.meta.label ? this.localize.string(view.meta.label) : view.name}
</uui-tab>
`,
)}
</uui-tab-group>
`