Update the settings sidebar to include a semi-persistent notification about new versions
This commit is contained in:
parent
09ac9624ed
commit
e164e046a5
4 changed files with 21 additions and 1 deletions
|
|
@ -72,6 +72,7 @@
|
|||
"releases": "Releases",
|
||||
"wiki": "Wiki",
|
||||
"issues": "Issues",
|
||||
"new-version-available": "{version} available now!",
|
||||
"item": {
|
||||
"weight": "Weight",
|
||||
"quantity": "Quantity",
|
||||
|
|
|
|||
|
|
@ -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`);
|
||||
|
|
|
|||
|
|
@ -26,4 +26,10 @@
|
|||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: center;
|
||||
font-size: small;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,4 +45,9 @@
|
|||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{{#if hasNewVersion}}
|
||||
<p>
|
||||
{{localize "taf.misc.new-version-available" version=newVersion}}
|
||||
</p>
|
||||
{{/if}}
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue