Add the sidebar for the module
This commit is contained in:
parent
dc3224fb6a
commit
1d58317346
6 changed files with 127 additions and 0 deletions
58
module/apps/ArtSidebar.mjs
Normal file
58
module/apps/ArtSidebar.mjs
Normal 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
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue