Add settings panel with strip reopen button and AV disabled notification
CI / ci (push) Successful in 46s
CI / ci (push) Successful in 46s
Features: - Added ScryingPoolSettings application with reopen/close strip buttons - Registered settings menu in module settings (GM only) - Added template for settings panel with styled buttons - Added translations for settings UI - Added info notification when AV is not available Files: - src/ui/gm/ScryingPoolSettings.js: New settings application - templates/settings.hbs: Settings panel template - lang/en.json: Added translations - module.js: Registered settings menu and AV notification Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* Scrying Pool Settings Application
|
||||
* Provides a settings panel with a button to reopen the strip
|
||||
*/
|
||||
export class ScryingPoolSettings extends foundry.applications.api.ApplicationV2 {
|
||||
static DEFAULT_OPTIONS = {
|
||||
id: 'scrying-pool-settings',
|
||||
classes: ['scrying-pool-settings'],
|
||||
window: { title: 'Scrying Pool Settings', resizable: true },
|
||||
position: { width: 400, height: 200 },
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
form: {
|
||||
template: 'modules/scrying-pool/templates/settings.hbs',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {object} options - Application options
|
||||
* @param {object} roleRenderer - The role renderer instance to access openStrip/closeStrip
|
||||
*/
|
||||
constructor(roleRenderer, options = {}) {
|
||||
super(options);
|
||||
this._roleRenderer = roleRenderer;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
async _prepareContext(options) {
|
||||
return {
|
||||
hasStrip: this._roleRenderer?._strip?.rendered ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
async _onRender(context, options) {
|
||||
super._onRender(context, options);
|
||||
|
||||
// Add click handler for reopen button
|
||||
const reopenBtn = this.element.querySelector('[data-action="reopen-strip"]');
|
||||
if (reopenBtn) {
|
||||
reopenBtn.addEventListener('click', () => {
|
||||
this._roleRenderer?.openStrip();
|
||||
this.close();
|
||||
});
|
||||
}
|
||||
|
||||
// Add click handler for close button
|
||||
const closeBtn = this.element.querySelector('[data-action="close-strip"]');
|
||||
if (closeBtn) {
|
||||
closeBtn.addEventListener('click', () => {
|
||||
this._roleRenderer?.closeStrip();
|
||||
this.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the strip open/closed
|
||||
*/
|
||||
_toggleStrip() {
|
||||
if (this._roleRenderer?._strip?.rendered) {
|
||||
this._roleRenderer.closeStrip();
|
||||
} else {
|
||||
this._roleRenderer?.openStrip();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user