fix: hide effect icon if it's not present, instead of showing alt text and a broken image icon

This commit is contained in:
Johannes Loher 2022-01-23 17:41:16 +01:00
parent c64adb0225
commit 20160ea9a0
2 changed files with 2 additions and 2 deletions

View file

@ -52,7 +52,6 @@ export class DS4ActorSheet extends ActorSheet<ActorSheet.Options, DS4ActorSheetD
const enrichedEffectPromises = this.actor.effects.map(async (effect) => { const enrichedEffectPromises = this.actor.effects.map(async (effect) => {
return { return {
...effect.toObject(), ...effect.toObject(),
icon: effect.data.icon ?? DS4ActiveEffect.FALLBACK_ICON,
sourceName: await effect.getCurrentSourceName(), sourceName: await effect.getCurrentSourceName(),
factor: effect.factor, factor: effect.factor,
isEffectivelyEnabled: !effect.data.disabled && !effect.isSurpressed, isEffectivelyEnabled: !effect.data.disabled && !effect.isSurpressed,
@ -418,7 +417,6 @@ interface DS4ActorSheetData extends ActorSheet.Data {
type ActiveEffectDataSource = foundry.data.ActiveEffectData["_source"]; type ActiveEffectDataSource = foundry.data.ActiveEffectData["_source"];
interface EnrichedActiveEffectDataSource extends ActiveEffectDataSource { interface EnrichedActiveEffectDataSource extends ActiveEffectDataSource {
icon: string;
sourceName: string; sourceName: string;
} }

View file

@ -15,7 +15,9 @@ SPDX-License-Identifier: MIT
--}} --}}
<div class="ds4-rollable-image{{#if rollable}} ds4-rollable-image--rollable {{rollableClass}}{{/if}}" <div class="ds4-rollable-image{{#if rollable}} ds4-rollable-image--rollable {{rollableClass}}{{/if}}"
title="{{#if rollable}}{{rollableTitle}}{{else}}{{title}}{{/if}}"> title="{{#if rollable}}{{rollableTitle}}{{else}}{{title}}{{/if}}">
{{#if src}}
<img class="ds4-rollable-image__image" alt="{{alt}}" src="{{src}}" /> <img class="ds4-rollable-image__image" alt="{{alt}}" src="{{src}}" />
{{/if}}
{{#if rollable}} {{#if rollable}}
<img class="ds4-rollable-image__overlay" alt="{{localize 'DS4.DiceOverlayImageAltText'}}" <img class="ds4-rollable-image__overlay" alt="{{localize 'DS4.DiceOverlayImageAltText'}}"
src="icons/svg/d20-black.svg" /> src="icons/svg/d20-black.svg" />