Click gps tile to open map
This commit is contained in:
@@ -32,9 +32,7 @@ class DashboardHeader extends HTMLElement {
|
||||
const requestStart = performance.now();
|
||||
const response = await fetch('/api/status');
|
||||
const requestEnd = performance.now();
|
||||
|
||||
if (!response.ok) throw new Error('Status fetch failed');
|
||||
|
||||
const status = await response.json();
|
||||
this.statusCache = status;
|
||||
this.updateUI(status, requestStart, requestEnd);
|
||||
@@ -289,11 +287,17 @@ class DashboardHeader extends HTMLElement {
|
||||
const expandToggle = this.shadowRoot.getElementById('expand-toggle');
|
||||
const expandIcon = this.shadowRoot.getElementById('expand-icon');
|
||||
const expandedStatus = this.shadowRoot.getElementById('expanded-status');
|
||||
const gpsTile = this.shadowRoot.getElementById('gps-tile');
|
||||
|
||||
expandToggle.addEventListener('click', () => {
|
||||
expandIcon.classList.toggle('expanded');
|
||||
expandedStatus.classList.toggle('visible');
|
||||
});
|
||||
|
||||
gpsTile.addEventListener('click', () => {
|
||||
if(this.statusCache.gps?.latitude != null)
|
||||
window.open(`//${location.host}:1500/styles/dark/#14/${this.statusCache.gps.latitude}/${this.statusCache.gps.longitude}`);
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
Reference in New Issue
Block a user