Compare commits

..

No commits in common. "5ac4fc3b9ceec0f83e829295e6b197a47cdd4e01" and "77c5cfcbb79e7131d58650fdc73016aece3e04f5" have entirely different histories.

4 changed files with 23 additions and 26 deletions

View file

@ -111,7 +111,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
switch (partId) {
case 'domains':
const selectedDomain = this.settings.domains[this.selected.domain] ?? null;
const selectedDomain = this.selected.domain ? this.settings.domains[this.selected.domain] : null;
const enrichedDescription = selectedDomain
? await foundry.applications.ux.TextEditor.implementation.enrichHTML(selectedDomain.description)
: null;

View file

@ -31,9 +31,9 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
minimizable: false
},
actions: {
toggleViewMode: DhCountdowns.#onToggleViewMode,
editCountdowns: DhCountdowns.#onEditCountdowns,
loopCountdown: DhCountdowns.#onLoopCountdown,
toggleViewMode: DhCountdowns.#toggleViewMode,
editCountdowns: DhCountdowns.#editCountdowns,
loopCountdown: DhCountdowns.#loopCountdown,
decreaseCountdown: (_, target) => this.editCountdown(false, target),
increaseCountdown: (_, target) => this.editCountdown(true, target)
},
@ -147,7 +147,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
return true;
}
static async #onToggleViewMode() {
static async #toggleViewMode() {
const currentMode = game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.userFlags.countdownMode);
const appMode = CONFIG.DH.GENERAL.countdownAppMode;
const newMode = currentMode === appMode.textIcon ? appMode.iconOnly : appMode.textIcon;
@ -158,16 +158,15 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
this.render();
}
static async #onEditCountdowns() {
static async #editCountdowns() {
new game.system.api.applications.ui.CountdownEdit().render(true);
}
static async #onLoopCountdown(_, target) {
static async #loopCountdown(_, target) {
if (!DhCountdowns.canPerformEdit()) return;
const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
const countdownId = target.closest('[data-countdown]').dataset.countdown;
const countdown = settings.countdowns[countdownId];
const countdown = settings.countdowns[target.id];
let progressMax = countdown.progress.start;
let message = null;
@ -186,7 +185,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
await waitForDiceSoNice(message);
await settings.updateSource({
[`countdowns.${countdownId}.progress`]: {
[`countdowns.${target.id}.progress`]: {
current: newMax,
start: newMax
}
@ -200,12 +199,11 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
if (!DhCountdowns.canPerformEdit()) return;
const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Countdowns);
const countdownId = target.closest('[data-countdown]').dataset.countdown;
const countdown = settings.countdowns[countdownId];
const countdown = settings.countdowns[target.id];
const newCurrent = increase
? Math.min(countdown.progress.current + 1, countdown.progress.start)
: Math.max(countdown.progress.current - 1, 0);
await settings.updateSource({ [`countdowns.${countdownId}.progress.current`]: newCurrent });
await settings.updateSource({ [`countdowns.${target.id}.progress.current`]: newCurrent });
await emitGMUpdate(GMUpdateEvent.UpdateCountdowns, DhCountdowns.gmSetSetting.bind(settings), settings, null, {
refreshType: RefreshType.Countdown
});

View file

@ -18,7 +18,7 @@
border: 0;
box-shadow: none;
color: @color-text-primary;
width: 18.75rem;
width: 300px;
pointer-events: all;
align-self: flex-end;
transition: 0.3s right ease-in-out;
@ -36,7 +36,7 @@
transition: opacity var(--ui-fade-duration);
}
&:not(.performance-low, .noblur) {
:not(.performance-low, .noblur) {
backdrop-filter: blur(5px);
}
@ -49,7 +49,8 @@
}
&.icon-only {
width: 12rem;
width: 180px;
min-width: 180px;
}
.countdowns-header,
@ -107,8 +108,8 @@
gap: 16px;
img {
width: 2.75rem;
height: 2.75rem;
width: 44px;
height: 44px;
border-radius: 6px;
}
@ -126,7 +127,7 @@
.countdown-tool-controls {
display: flex;
align-items: center;
gap: var(--spacer-12);
gap: 16px;
}
.progress-tag {

View file

@ -11,20 +11,18 @@
</header>
<div class="countdowns-container">
{{#each countdowns as | countdown id |}}
<div class="countdown-container {{#if ../iconOnly}}icon-only{{/if}}" data-countdown="{{id}}">
<div class="countdown-container {{#if ../iconOnly}}icon-only{{/if}}">
<div class="countdown-main-container">
<img src="{{countdown.img}}" {{#if ../iconOnly}}data-tooltip="{{countdown.name}}"{{/if}}/>
<div class="countdown-content">
{{#unless ../iconOnly}}
<header>{{countdown.name}}</header>
{{/unless}}
{{#unless ../iconOnly}}<label>{{countdown.name}}</label>{{/unless}}
<div class="countdown-tools">
<div class="countdown-tool-controls">
{{#if countdown.editable}}<a data-action="decreaseCountdown"><i class="fa-solid fa-minus"></i></a>{{/if}}
{{#if countdown.editable}}<a data-action="decreaseCountdown" id="{{id}}"><i class="fa-solid fa-minus"></i></a>{{/if}}
<div class="progress-tag">
{{countdown.progress.current}}/{{countdown.progress.start}}
</div>
{{#if countdown.editable}}<a data-action="increaseCountdown"><i class="fa-solid fa-plus"></i></a>{{/if}}
{{#if countdown.editable}}<a data-action="increaseCountdown" id="{{id}}"><i class="fa-solid fa-plus"></i></a>{{/if}}
</div>
<div class="countdown-tool-icons">
{{#if (not ../iconOnly)}}
@ -33,7 +31,7 @@
{{/if}}
{{#unless (eq countdown.progress.looping "noLooping")}}
<span data-tooltip="{{countdown.loopTooltip}}">
<a class="looping-container {{#if countdown.shouldLoop}}should-loop{{/if}}" {{#if countdown.loopDisabled}}disabled{{/if}} data-action="loopCountdown">
<a class="looping-container {{#if countdown.shouldLoop}}should-loop{{/if}}" {{#if countdown.loopDisabled}}disabled{{/if}} data-action="loopCountdown" id="{{id}}">
<i class="loop-marker fa-solid fa-repeat"></i>
{{#if (eq countdown.progress.looping "increasing")}}
<i class="direction-marker fa-solid fa-angles-up" data-tooltip="{{localize "DAGGERHEART.UI.Countdowns.increasingLoop"}}"></i>