[client] Add version, build date, and changelog to UI

This commit is contained in:
Starbeamrainbowlabs 2019-01-26 22:14:18 +00:00
parent 844d23e0a6
commit 68b86a2f91
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
6 changed files with 23 additions and 2 deletions

View file

@ -5,6 +5,7 @@
@import "../../node_modules/leaflet.markercluster/dist/MarkerCluster.css"; @import "../../node_modules/leaflet.markercluster/dist/MarkerCluster.css";
@import "../../node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css"; @import "../../node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css";
@import "./nanomodal.css";
@import "./popup.css"; @import "./popup.css";
/** Ensure that some assets are copied that aren't by default **/ /** Ensure that some assets are copied that aren't by default **/

View file

@ -0,0 +1,5 @@
.nanoModal {
max-width: 50vw;
max-height: 70vh;
overflow-y: scroll;
}

View file

@ -2,7 +2,7 @@
export default { export default {
version: "__VERSION__", version: "__VERSION__",
buid_date: new Date("__BUILD_DATE__"), build_date: new Date("__BUILD_DATE__"),
// The url of api.php. Can be relative. // The url of api.php. Can be relative.
api_root: "../api.php", api_root: "../api.php",
// The default location to show on the map when loading the page. // The default location to show on the map when loading the page.

View file

@ -1,6 +1,7 @@
"use strict"; "use strict";
import SmartSettings from 'smartsettings'; import SmartSettings from 'smartsettings';
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';
@ -34,7 +35,6 @@ class UI {
}).bind(this) }).bind(this)
}, },
{ {
// TODO: Add a setting for the different reading types here
type: "select", type: "select",
name: "Reading Type", name: "Reading Type",
items: this.reading_types.map((type) => type.friendly_text), items: this.reading_types.map((type) => type.friendly_text),
@ -43,6 +43,15 @@ class UI {
this.map_manager.heatmap.update_reading_type(new_type); this.map_manager.heatmap.update_reading_type(new_type);
}).bind(this) }).bind(this)
},
{
type: "button",
name: `${Config.version}, built ${Config.build_date.toDateString()}`,
callback: (async (_event) => {
NanoModal(
await GetFromUrl(`${Config.api_root}?action=changelog`)
).show();
})
} }
]); ]);
this.ui_panel.setIndex("Reading Type", this.reading_types.findIndex((type) => type.id == "PM25")); this.ui_panel.setIndex("Reading Type", this.reading_types.findIndex((type) => type.id == "PM25"));

5
package-lock.json generated
View file

@ -1820,6 +1820,11 @@
} }
} }
}, },
"nanomodal": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/nanomodal/-/nanomodal-5.1.1.tgz",
"integrity": "sha1-qiEiUSr49vpr3G8y1nqm3whvfK0="
},
"normalize-path": { "normalize-path": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",

View file

@ -24,6 +24,7 @@
"leaflet-timedimension": "^1.1.0", "leaflet-timedimension": "^1.1.0",
"leaflet.markercluster": "^1.4.1", "leaflet.markercluster": "^1.4.1",
"moment": "^2.23.0", "moment": "^2.23.0",
"nanomodal": "^5.1.1",
"smartsettings": "^1.2.3" "smartsettings": "^1.2.3"
}, },
"devDependencies": { "devDependencies": {