From e128f2a82887a6283396be9095df757d8b965d37 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 12 Apr 2026 18:07:46 -0600 Subject: [PATCH] Enable the item tab hiding on the Attribute-only actor sheet --- module/apps/AttributeOnlyPlayerSheet.mjs | 28 +++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/module/apps/AttributeOnlyPlayerSheet.mjs b/module/apps/AttributeOnlyPlayerSheet.mjs index 317bf7f..ff725e5 100644 --- a/module/apps/AttributeOnlyPlayerSheet.mjs +++ b/module/apps/AttributeOnlyPlayerSheet.mjs @@ -1,5 +1,7 @@ import { PlayerSheet } from "./PlayerSheet.mjs"; +const { deepClone } = foundry.utils; + const removedParts = new Set([`content`, `tabs`]); export class AttributeOnlyPlayerSheet extends PlayerSheet { @@ -16,8 +18,32 @@ export class AttributeOnlyPlayerSheet extends PlayerSheet { delete parts.content; return parts; }; + + static get TABS() { + const tabs = deepClone(super.TABS); + tabs.primary.tabs = tabs.primary.tabs + .filter(tab => tab.id !== `content`); + tabs.primary.initial = tabs.primary.tabs.at(0).id; + return tabs; + }; // #endregion Options + // #region Instance Data + /** + * This method is used in order to ensure that when we hide specific + * tabs due to programmatic logic (e.g. having no items), that the tab + * doesn't stay selected in the app if the logic for it being visible + * no longer holds true. + */ + _assertSelectedTabs() { + // Intention No-Op Function + }; + + get hasContentTab() { + return false; + }; + // #endregion Instance Data + // #region Lifecycle _configureRenderOptions(options) { super._configureRenderOptions(options); @@ -30,7 +56,7 @@ export class AttributeOnlyPlayerSheet extends PlayerSheet { // #region Data Prep async _prepareItems(ctx) { await super._prepareItems(ctx); - ctx.tabActive = true; + ctx.tabActive &&= this.hasItemsTab; }; // #endregion Data Prep };