Add some TAF-specific links into the settings sidebar

This commit is contained in:
Oliver 2026-05-10 23:45:00 -06:00
parent 849da4bb54
commit 8cadd8318b
8 changed files with 122 additions and 4 deletions

View file

@ -67,6 +67,11 @@
"macro-is-in-use": "The Macro is used by {count} items/attributes in the world or Actors, the items will lose their ability to use the macro.", "macro-is-in-use": "The Macro is used by {count} items/attributes in the world or Actors, the items will lose their ability to use the macro.",
"roll": "Roll", "roll": "Roll",
"use": "Use", "use": "Use",
"version": "Version {version}",
"whats-new": "What's New",
"releases": "Releases",
"wiki": "Wiki",
"issues": "Issues",
"item": { "item": {
"weight": "Weight", "weight": "Weight",
"quantity": "Quantity", "quantity": "Quantity",

View file

@ -2,7 +2,7 @@ import { __ID__, filePath } from "../consts.mjs";
import { createContextMenuOption, deleteItemFromElement, editItemFromElement } from "./utils.mjs"; import { createContextMenuOption, deleteItemFromElement, editItemFromElement } from "./utils.mjs";
import { config } from "../config.mjs"; import { config } from "../config.mjs";
import { Logger } from "../utils/Logger.mjs"; import { Logger } from "../utils/Logger.mjs";
import { TAFDocumentSheetConfig } from "./TAFDocumentSheetConfig.mjs"; import { TAFDocumentSheetConfig } from "./overrides/TAFDocumentSheetConfig.mjs";
import { TAFDocumentSheetMixin } from "./mixins/TAFDocumentSheetMixin.mjs"; import { TAFDocumentSheetMixin } from "./mixins/TAFDocumentSheetMixin.mjs";
import { TAFActor } from "../documents/Actor.mjs"; import { TAFActor } from "../documents/Actor.mjs";

View file

@ -1,6 +1,6 @@
import { __ID__, filePath } from "../consts.mjs"; import { __ID__, filePath } from "../../consts.mjs";
import { getDefaultSizing } from "../utils/getSizing.mjs"; import { getDefaultSizing } from "../../utils/getSizing.mjs";
import { localizer } from "../utils/localizer.mjs"; import { localizer } from "../../utils/localizer.mjs";
const { diffObject, expandObject, flattenObject } = foundry.utils; const { diffObject, expandObject, flattenObject } = foundry.utils;
const { DocumentSheetConfig } = foundry.applications.apps; const { DocumentSheetConfig } = foundry.applications.apps;

View file

@ -0,0 +1,30 @@
import { filePath } from "../../consts.mjs";
const { renderTemplate } = foundry.applications.handlebars;
const { Settings } = foundry.applications.sidebar.tabs;
export class TAFSettingsSidebar extends Settings {
// #region Lifecycle
async _onRender() {
// remove the row from the HTML
const systemRow = this.element.querySelector(`.info .system`);
systemRow?.remove();
// add the more customized system info into the sidebar
const systemBlock = this.element.querySelector(`section.system`);
if (!systemBlock) {
const htmlString = await renderTemplate(
filePath(`templates/settings-sidebar-addition.hbs`),
{ system: game.system, },
);
const temp = document.createElement(`div`);
temp.innerHTML = htmlString;
const rendered = temp.firstChild;
const info = this.element.querySelector(`section.info`);
info.insertAdjacentElement(`afterend`, rendered);
};
};
// #endregion Lifecycle
};

View file

@ -26,6 +26,7 @@ import helpers from "../handlebarsHelpers/_index.mjs";
import { Logger } from "../utils/Logger.mjs"; import { Logger } from "../utils/Logger.mjs";
import { registerCustomComponents } from "../apps/elements/_index.mjs"; import { registerCustomComponents } from "../apps/elements/_index.mjs";
import { registerSockets } from "../sockets/_index.mjs"; import { registerSockets } from "../sockets/_index.mjs";
import { TAFSettingsSidebar } from "../apps/overrides/TAFSettingsSidebar.mjs";
Hooks.on(`init`, () => { Hooks.on(`init`, () => {
Logger.debug(`Initializing`); Logger.debug(`Initializing`);
@ -44,6 +45,10 @@ Hooks.on(`init`, () => {
CONFIG.Item.dataModels.attribute = AttributeItemData; CONFIG.Item.dataModels.attribute = AttributeItemData;
// #endregion Data Models // #endregion Data Models
// #region App Overrides
CONFIG.ui.settings = TAFSettingsSidebar;
// #endregion App Overrides
// #region Sheets // #region Sheets
foundry.documents.collections.Actors.registerSheet( foundry.documents.collections.Actors.registerSheet(
__ID__, __ID__,

View file

@ -0,0 +1,29 @@
#settings > .system {
.version-info {
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
gap: 8px;
.whats-new {
font-size: smaller;
}
}
.links {
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
flex-wrap: wrap;
gap: 8px;
list-style-type: none;
padding: 0;
margin: 0;
li {
margin: 0;
}
}
}

View file

@ -31,3 +31,4 @@
@import url("./Apps/PlayerSheet.css") layer(apps); @import url("./Apps/PlayerSheet.css") layer(apps);
@import url("./Apps/QueryStatus.css") layer(apps); @import url("./Apps/QueryStatus.css") layer(apps);
@import url("./Apps/TAFDocumentSheetConfig.css") layer(apps); @import url("./Apps/TAFDocumentSheetConfig.css") layer(apps);
@import url("./Apps/TAFSettingsSidebar.css") layer(apps);

View file

@ -0,0 +1,48 @@
<section class="system flexcol">
<h4 class="divider">
{{ system.title }}
</h4>
<div class="version-info">
<span class="version">
{{localize "taf.misc.version" version=system.version}}
</span>
<a
href="{{ system.url }}/releases/tag/v{{ system.version }}"
class="whats-new"
target="_blank"
rel="noopener noreferrer"
style="font-size: smaller"
>
{{localize "taf.misc.whats-new"}}
</a>
</div>
<ul class="links">
<li>
<a
href="{{ system.url }}/releases"
target="_blank"
rel="noopener noreferrer"
>
{{localize "taf.misc.releases"}}
</a>
</li>
<li>
<a
href="{{ system.url }}/wiki"
target="_blank"
rel="noopener noreferrer"
>
{{localize "taf.misc.wiki"}}
</a>
</li>
<li>
<a
href="{{ system.url }}/issues"
target="_blank"
rel="noopener noreferrer"
>
{{localize "taf.misc.issues"}}
</a>
</li>
</ul>
</section>