Update the startSidebarExpanded setting to bring it inline with the rest of the settings

This commit is contained in:
Oliver 2025-12-06 23:30:12 -07:00
parent f40d9f9381
commit 9875d49181
5 changed files with 36 additions and 42 deletions

View file

@ -1,22 +1,29 @@
import { __ID } from "../consts.mjs";
import { Logger } from "../utils/Logger.mjs";
const key = `startSidebarExpanded`;
const config = {
name: `OFT.setting.${key}.name`,
hint: `OFT.setting.${key}.hint`,
scope: `user`,
type: Boolean,
default: true,
config: true,
requiresReload: false,
};
export function startSidebarExpanded() {
Logger.log(`Registering setting: ${key}`);
export const startSidebarExpanded = {
value() {
return game.settings.get(__ID, key);
},
register() {
game.settings.register(__ID, key, config);
},
// #region Registration
game.settings.register(__ID, key, {
name: `OFT.setting.${key}.name`,
hint: `OFT.setting.${key}.hint`,
scope: `user`,
type: Boolean,
default: true,
config: true,
requiresReload: false,
});
// #endregion Registration
// #region Implementation
Hooks.once(`renderSidebar`, (app) => {
if (game.settings.get(__ID, key) && !game.ready) {
Logger.debug(`setting:${key} | Expanding sidebar`);
app.toggleExpanded(true);
};
});
// #endregion Implementation
};