From 9e1273742932a00c819f68a20ed3646e7c50dcf0 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Wed, 1 Jan 2025 01:55:44 -0700 Subject: [PATCH] RC-76 | Crypt Application Setup --- Apps/CryptApp/main.hbs | 3 +++ module/Apps/CryptApp.mjs | 43 ++++++++++++++++++++++++++++++++++++++++ module/hooks/ready.mjs | 4 ++++ 3 files changed, 50 insertions(+) create mode 100644 Apps/CryptApp/main.hbs create mode 100644 module/Apps/CryptApp.mjs diff --git a/Apps/CryptApp/main.hbs b/Apps/CryptApp/main.hbs new file mode 100644 index 0000000..80f0024 --- /dev/null +++ b/Apps/CryptApp/main.hbs @@ -0,0 +1,3 @@ +
+ Hello +
\ No newline at end of file diff --git a/module/Apps/CryptApp.mjs b/module/Apps/CryptApp.mjs new file mode 100644 index 0000000..09b2cf8 --- /dev/null +++ b/module/Apps/CryptApp.mjs @@ -0,0 +1,43 @@ +import { filePath } from "../consts.mjs"; +import { GenericAppMixin } from "./GenericApp.mjs"; +import { Logger } from "../utils/Logger.mjs"; + +const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; + +export class CryptApp extends GenericAppMixin(HandlebarsApplicationMixin(ApplicationV2)) { + // #region Options + static DEFAULT_OPTIONS = { + window: { + title: `Crypt Overview`, + frame: true, + positioned: true, + resizable: false, + minimizable: true, + }, + actions: {}, + }; + + static PARTS = { + main: { + template: filePath(`Apps/CryptApp/main.hbs`), + }, + }; + // #endregion + + // #region Lifecycle + async _renderFrame(options) { + const frame = await super._renderFrame(options); + this.window.close.remove(); // Prevent closing + return frame; + } + + async _preparePartContext(partId, ctx, opts) { + ctx = await super._preparePartContext(partId, ctx, opts); + Logger.log(`Context`, ctx); + return ctx; + }; + // #endregion + + // #region Actions + // #endregion +}; diff --git a/module/hooks/ready.mjs b/module/hooks/ready.mjs index 0f69cef..6536a48 100644 --- a/module/hooks/ready.mjs +++ b/module/hooks/ready.mjs @@ -1,3 +1,4 @@ +import { CryptApp } from "../Apps/CryptApp.mjs"; import { Logger } from "../utils/Logger.mjs"; Hooks.once(`ready`, () => { @@ -17,4 +18,7 @@ Hooks.once(`ready`, () => { ui.sidebar.expand(); if (game.paused) { game.togglePause() }; }; + + CONFIG.ui.crypt = new CryptApp(); + CONFIG.ui.crypt.render({ force: true }); });