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

@ -72,6 +72,7 @@
"releases": "Releases", "releases": "Releases",
"wiki": "Wiki", "wiki": "Wiki",
"issues": "Issues", "issues": "Issues",
"new-version-available": "{version} available now!",
"item": { "item": {
"weight": "Weight", "weight": "Weight",
"quantity": "Quantity", "quantity": "Quantity",

View file

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

View file

@ -26,4 +26,10 @@
margin: 0; margin: 0;
} }
} }
p {
text-align: center;
font-size: small;
margin: 0;
}
} }

View file

@ -45,4 +45,9 @@
</a> </a>
</li> </li>
</ul> </ul>
{{#if hasNewVersion}}
<p>
{{localize "taf.misc.new-version-available" version=newVersion}}
</p>
{{/if}}
</section> </section>