Fixed so that hidden countdowns don't take up space

This commit is contained in:
WBHarry 2026-06-12 15:37:50 +02:00
parent 8e5cdedaac
commit f91bfaecb1
3 changed files with 14 additions and 2 deletions

View file

@ -186,6 +186,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
context.userCountdownTypes = game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.userFlags.countdownTypeModes) context.userCountdownTypes = game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.userFlags.countdownTypeModes)
?? [shortterm.id, longterm.id]; ?? [shortterm.id, longterm.id];
context.typeToggles = context.typeToggles =
Object.values(CONFIG.DH.GENERAL.countdownType).map(type => ({ Object.values(CONFIG.DH.GENERAL.countdownType).map(type => ({
type: type.id, type: type.id,
@ -194,6 +195,13 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
})); }));
context.countdowns = this._getCountdownData(); context.countdowns = this._getCountdownData();
context.countdownTypesWithVisibleEntries = this.#getCountdowns().reduce((acc, data) => {
if (context.userCountdownTypes.includes(data.countdown.type) && !acc.includes(data.countdown.type))
acc.push(data.countdown.type);
return acc;
}, []);
return context; return context;
} }

View file

@ -106,6 +106,10 @@
max-height: 312px; max-height: 312px;
.countdown-category-container { .countdown-category-container {
display: flex;
flex-direction: column;
gap: 8px;
&.hidden { &.hidden {
display: none; display: none;
} }
@ -117,7 +121,7 @@
border-radius: 6px; border-radius: 6px;
&.change-glow { &.change-glow {
animation: shimmer 1s ease-in-out; animation: shimmer 1s ease-in-out infinite;
background: linear-gradient(-45deg, transparent 30%, light-dark(@dark-blue-40, @golden-40) 35%, transparent 40%); background: linear-gradient(-45deg, transparent 30%, light-dark(@dark-blue-40, @golden-40) 35%, transparent 40%);
background-size: 300%; background-size: 300%;
background-position-x: 100% background-position-x: 100%

View file

@ -1,5 +1,5 @@
{{#each countdowns as | category key |}} {{#each countdowns as | category key |}}
<div class="countdown-category-container {{#unless (includes @root.userCountdownTypes key)}}hidden{{/unless}}"> <div class="countdown-category-container {{#unless (includes @root.countdownTypesWithVisibleEntries key)}}hidden{{/unless}}">
{{#each category as |countdown id|}} {{#each category as |countdown id|}}
<div class="countdown-container {{#if ../iconOnly}}icon-only{{/if}}" data-countdown="{{id}}"> <div class="countdown-container {{#if ../iconOnly}}icon-only{{/if}}" data-countdown="{{id}}">
<div class="countdown-main-container"> <div class="countdown-main-container">