Add the sidebar for the module

This commit is contained in:
Oliver 2026-01-26 23:41:43 -07:00
parent dc3224fb6a
commit 1d58317346
6 changed files with 127 additions and 0 deletions

View file

@ -0,0 +1,58 @@
import { api } from "../api.mjs";
import { __ID__, filePath } from "../consts.mjs";
const { HandlebarsApplicationMixin } = foundry.applications.api;
const { AbstractSidebarTab } = foundry.applications.sidebar;
export class ArtSidebar extends HandlebarsApplicationMixin(AbstractSidebarTab) {
// #region Options
static tabName = `art`;
static DEFAULT_OPTIONS = {
classes: [
__ID__,
`ArtSidebar`,
],
window: {},
actions: {
openApp: this.#openApp,
},
};
static PARTS = {
tokens: {
template: filePath(`templates/ArtSidebar/tokens.hbs`),
},
artists: {
template: filePath(`templates/ArtSidebar/artists.hbs`),
},
};
// #endregion Options
// #region Data Prep
_preparePartContext(partID, ctx) {
switch (partID) {
};
return ctx;
};
_prepareTokensContext(ctx) {};
_prepareArtistsContext(ctx) {};
// #endregion Data Prep
// #region Actions
static async #openApp(event, target) {
const { app: appKey, ...options } = target.dataset;
delete options.action;
if (appKey in api.Apps) {
const app = new api.Apps[appKey](options);
await app.render({ force: true });
} else {
console.error(`Failed to find app with key: ${appKey}`);
};
};
// #endregion Actions
};