This commit is contained in:
WBHarry 2025-10-27 14:04:43 +01:00
parent 59a4f15680
commit 2f344c90e4
2 changed files with 8 additions and 14 deletions

View file

@ -13,15 +13,14 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
this.hideNewCountdowns = false; this.hideNewCountdowns = false;
} }
get title() {
return game.i18n.localize('DAGGERHEART.APPLICATIONS.CountdownEdit.title');
}
static DEFAULT_OPTIONS = { static DEFAULT_OPTIONS = {
classes: ['daggerheart', 'dialog', 'dh-style', 'countdown-edit'], classes: ['daggerheart', 'dialog', 'dh-style', 'countdown-edit'],
tag: 'form', tag: 'form',
position: { width: 600 }, position: { width: 600 },
window: { icon: 'fa-solid fa-clock-rotate-left' }, window: {
title: 'DAGGERHEART.APPLICATIONS.CountdownEdit.title',
icon: 'fa-solid fa-clock-rotate-left'
},
actions: { actions: {
addCountdown: CountdownEdit.#addCountdown, addCountdown: CountdownEdit.#addCountdown,
toggleCountdownEdit: CountdownEdit.#toggleCountdownEdit, toggleCountdownEdit: CountdownEdit.#toggleCountdownEdit,
@ -83,8 +82,7 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
canPerformEdit() { canPerformEdit() {
if (game.user.isGM) return true; if (game.user.isGM) return true;
const noGM = !game.users.find(x => x.isGM && x.active); if (!game.users.activeGM) {
if (noGM) {
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.gmRequired')); ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.gmRequired'));
return false; return false;
} }
@ -109,7 +107,7 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
static async updateData(_event, _, formData) { static async updateData(_event, _, formData) {
const { hideNewCountdowns, ...settingsData } = foundry.utils.expandObject(formData.object); const { hideNewCountdowns, ...settingsData } = foundry.utils.expandObject(formData.object);
// Sync current and max if max is changing and they were equal before // Sync current and max if max is changing and they were equal before
for (const [id, countdown] of Object.entries(settingsData.countdowns ?? {})) { for (const [id, countdown] of Object.entries(settingsData.countdowns ?? {})) {
const existing = this.data.countdowns[id]; const existing = this.data.countdowns[id];
@ -119,7 +117,7 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
} else { } else {
countdown.progress.current = Math.min(countdown.progress.current, countdown.progress.max); countdown.progress.current = Math.min(countdown.progress.current, countdown.progress.max);
} }
} }
this.hideNewCountdowns = hideNewCountdowns; this.hideNewCountdowns = hideNewCountdowns;
this.updateSetting(settingsData); this.updateSetting(settingsData);

View file

@ -25,7 +25,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
window: { window: {
icon: 'fa-solid fa-clock-rotate-left', icon: 'fa-solid fa-clock-rotate-left',
frame: true, frame: true,
title: 'Fear', title: 'DAGGERHEART.UI.Countdowns.title',
positioned: false, positioned: false,
resizable: false, resizable: false,
minimizable: false minimizable: false
@ -50,10 +50,6 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
} }
}; };
get title() {
return game.i18n.localize('DAGGERHEART.UI.Countdowns.title');
}
get element() { get element() {
return document.body.querySelector('.daggerheart.dh-style.countdowns'); return document.body.querySelector('.daggerheart.dh-style.countdowns');
} }