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 };