From 9aaaaf39bdb3e592e03091868f3e95b8fcb19f27 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Sun, 24 Mar 2024 19:36:11 +0100 Subject: [PATCH] don't render more button if there is only one action --- .../entity-actions-bundle.element.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/components/entity-actions-bundle/entity-actions-bundle.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/components/entity-actions-bundle/entity-actions-bundle.element.ts index 16da646483..a60adfb9cd 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/components/entity-actions-bundle/entity-actions-bundle.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/components/entity-actions-bundle/entity-actions-bundle.element.ts @@ -29,7 +29,7 @@ export class UmbEntityActionsBundleElement extends UmbLitElement { public label?: string; @state() - private _hasActions = false; + private _numberOfActions = 0; @state() private _firstActionManifest?: ManifestEntityAction; @@ -52,8 +52,8 @@ export class UmbEntityActionsBundleElement extends UmbLitElement { umbExtensionsRegistry.byType('entityAction'), async (manifests) => { const actions = manifests.filter((manifest) => manifest.forEntityTypes.includes(this.entityType!)); - this._hasActions = actions.length > 0; - this._firstActionManifest = this._hasActions ? actions[0] : undefined; + this._numberOfActions = actions.length; + this._firstActionManifest = this._numberOfActions > 0 ? actions[0] : undefined; if (!this._firstActionManifest) return; this._firstActionApi = await createExtensionApi(this, this._firstActionManifest, [ { unique: this.unique, entityType: this.entityType }, @@ -75,14 +75,12 @@ export class UmbEntityActionsBundleElement extends UmbLitElement { } render() { - return html` - ${this._hasActions - ? html` ${this.#renderFirstAction()} ${this.#renderMore()} ` - : nothing} - `; + if (this._numberOfActions === 0) return nothing; + return html` ${this.#renderFirstAction()} ${this.#renderMore()} `; } #renderMore() { + if (this._numberOfActions === 1) return nothing; return html` `;