Update the settings sidebar to include a semi-persistent notification about new versions

This commit is contained in:
Oliver 2026-05-11 22:37:43 -06:00
parent 09ac9624ed
commit e164e046a5
4 changed files with 21 additions and 1 deletions

View file

@ -1,5 +1,7 @@
import { filePath } from "../../consts.mjs";
import { getLatestVersion } from "../../utils/ReleaseChannels.mjs";
const { isNewerVersion } = foundry.utils;
const { renderTemplate } = foundry.applications.handlebars;
const { Settings } = foundry.applications.sidebar.tabs;
@ -13,9 +15,15 @@ export class TAFSettingsSidebar extends Settings {
// add the more customized system info into the sidebar
const systemBlock = this.element.querySelector(`section.system`);
if (!systemBlock) {
const latest = await getLatestVersion();
const latestVersion = latest.tag_name.slice(1);
const htmlString = await renderTemplate(
filePath(`templates/settings-sidebar-addition.hbs`),
{ system: game.system, },
{
system: game.system,
hasNewVersion: isNewerVersion(latestVersion, game.system.version),
newVersion: latest.tag_name,
},
);
const temp = document.createElement(`div`);