mirror of
https://github.com/ConnectedHumber/Air-Quality-Web
synced 2024-11-25 06:53:00 +00:00
Display the changelog, but only on the 1st time after an update
This commit is contained in:
parent
721c813599
commit
6413171e6d
2 changed files with 20 additions and 5 deletions
|
@ -72,8 +72,7 @@ class Guage {
|
||||||
let draw_x = guage_size.x + guage_size.width + 3;
|
let draw_x = guage_size.x + guage_size.width + 3;
|
||||||
let draw_y = guage_size.y + (value * guage_size.height);
|
let draw_y = guage_size.y + (value * guage_size.height);
|
||||||
|
|
||||||
// this.context.fillStyle = "black";
|
// console.log(`Writing '${point}' to (${draw_x}, ${draw_y})`);
|
||||||
console.log(`Writing '${point}' to (${draw_x}, ${draw_y})`);
|
|
||||||
this.context.fillText(point, draw_x, draw_y);
|
this.context.fillText(point, draw_x, draw_y);
|
||||||
|
|
||||||
this.context.beginPath();
|
this.context.beginPath();
|
||||||
|
|
|
@ -6,6 +6,22 @@ import NanoModal from 'nanomodal';
|
||||||
import Config from './Config.mjs';
|
import Config from './Config.mjs';
|
||||||
import GetFromUrl from './Helpers/GetFromUrl.mjs';
|
import GetFromUrl from './Helpers/GetFromUrl.mjs';
|
||||||
|
|
||||||
|
async function show_changelog(only_if_changed) {
|
||||||
|
let current_version = `${Config.version}, built ${Config.build_date.toDateString()}`;
|
||||||
|
console.log(`[UI] Comparing current '${current_version}' to '${localStorage.getItem("last_seen_version")}'`);
|
||||||
|
if(only_if_changed && localStorage.getItem("last_seen_version") == current_version) {
|
||||||
|
console.log("[UI] Not showing changelog.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("[UI] Showing changelog");
|
||||||
|
NanoModal(
|
||||||
|
await GetFromUrl(`${Config.api_root}?action=changelog`)
|
||||||
|
).show();
|
||||||
|
localStorage.setItem("last_seen_version", current_version);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
class UI {
|
class UI {
|
||||||
constructor(in_config, in_map_manager) {
|
constructor(in_config, in_map_manager) {
|
||||||
this.config = in_config;
|
this.config = in_config;
|
||||||
|
@ -56,13 +72,13 @@ class UI {
|
||||||
type: "button",
|
type: "button",
|
||||||
name: `${Config.version}, built ${Config.build_date.toDateString()}`,
|
name: `${Config.version}, built ${Config.build_date.toDateString()}`,
|
||||||
callback: (async (_event) => {
|
callback: (async (_event) => {
|
||||||
NanoModal(
|
show_changelog(false);
|
||||||
await GetFromUrl(`${Config.api_root}?action=changelog`)
|
|
||||||
).show();
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
this.ui_panel.setIndex("Reading Type", this.reading_types.findIndex((type) => type.short_descr == "PM25"));
|
this.ui_panel.setIndex("Reading Type", this.reading_types.findIndex((type) => type.short_descr == "PM25"));
|
||||||
|
|
||||||
|
await show_changelog(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue