From 2f0badf53a83a42d7f04ab90ccfd627df5a60416 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Sat, 30 May 2026 20:28:32 +0200 Subject: [PATCH] Added an 'empty' styling for tabs. Used for NPC sheet Features tab when it has no features --- module/applications/sheets/actors/npc.mjs | 17 ++++++++++++----- styles/less/global/tab-navigation.less | 4 ++++ templates/sheets/actors/npc/notes.hbs | 5 +---- templates/sheets/global/tabs/tab-navigation.hbs | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/module/applications/sheets/actors/npc.mjs b/module/applications/sheets/actors/npc.mjs index d0f6e459..c9d7b092 100644 --- a/module/applications/sheets/actors/npc.mjs +++ b/module/applications/sheets/actors/npc.mjs @@ -46,9 +46,14 @@ export default class NPCSheet extends DHBaseActorSheet { } }; + prepareTabs(context) { + context.tabs.features.empty = this.document.system.features.length === 0; + } + /**@inheritdoc */ async _prepareContext(options) { const context = await super._prepareContext(options); + this.prepareTabs(context); return context; } @@ -88,6 +93,13 @@ export default class NPCSheet extends DHBaseActorSheet { }); } + /** + * Prepare render context for the Features part. + * @param {ApplicationRenderContext} context + * @param {ApplicationRenderOptions} options + * @returns {Promise} + * @protected + */ async _prepareFeaturesContext(context, _options) { const featureForms = ['passive', 'action', 'reaction']; context.features = this.document.system.features.sort((a, b) => @@ -124,9 +136,4 @@ export default class NPCSheet extends DHBaseActorSheet { }; } } - - /**@inheritdoc */ - _attachPartListeners(partId, htmlElement, options) { - super._attachPartListeners(partId, htmlElement, options); - } } diff --git a/styles/less/global/tab-navigation.less b/styles/less/global/tab-navigation.less index 038a9749..f6d99ffb 100755 --- a/styles/less/global/tab-navigation.less +++ b/styles/less/global/tab-navigation.less @@ -21,6 +21,10 @@ a { color: @color-text-emphatic; + + &.empty:not(.active) { + opacity: 0.4; + } } } } diff --git a/templates/sheets/actors/npc/notes.hbs b/templates/sheets/actors/npc/notes.hbs index a5c3f706..bc9ac3cf 100644 --- a/templates/sheets/actors/npc/notes.hbs +++ b/templates/sheets/actors/npc/notes.hbs @@ -3,10 +3,7 @@ data-tab='{{tabs.notes.id}}' data-group='{{tabs.notes.group}}' > -
- {{localize tabs.notes.label}} - {{formInput notes.field value=notes.value enriched=notes.enriched toggled=true}} -
+ {{formInput notes.field value=notes.value enriched=notes.enriched toggled=true}} {{#if (and showAttribution document.system.attribution.artist)}} diff --git a/templates/sheets/global/tabs/tab-navigation.hbs b/templates/sheets/global/tabs/tab-navigation.hbs index f9a31d3e..8af1f140 100755 --- a/templates/sheets/global/tabs/tab-navigation.hbs +++ b/templates/sheets/global/tabs/tab-navigation.hbs @@ -4,7 +4,7 @@