Click gps tile to open map

This commit is contained in:
2026-04-06 22:05:08 -04:00
parent 7717f41cb2
commit 7410cf4d72

View File

@@ -32,9 +32,7 @@ class DashboardHeader extends HTMLElement {
const requestStart = performance.now(); const requestStart = performance.now();
const response = await fetch('/api/status'); const response = await fetch('/api/status');
const requestEnd = performance.now(); const requestEnd = performance.now();
if (!response.ok) throw new Error('Status fetch failed'); if (!response.ok) throw new Error('Status fetch failed');
const status = await response.json(); const status = await response.json();
this.statusCache = status; this.statusCache = status;
this.updateUI(status, requestStart, requestEnd); this.updateUI(status, requestStart, requestEnd);
@@ -289,11 +287,17 @@ class DashboardHeader extends HTMLElement {
const expandToggle = this.shadowRoot.getElementById('expand-toggle'); const expandToggle = this.shadowRoot.getElementById('expand-toggle');
const expandIcon = this.shadowRoot.getElementById('expand-icon'); const expandIcon = this.shadowRoot.getElementById('expand-icon');
const expandedStatus = this.shadowRoot.getElementById('expanded-status'); const expandedStatus = this.shadowRoot.getElementById('expanded-status');
const gpsTile = this.shadowRoot.getElementById('gps-tile');
expandToggle.addEventListener('click', () => { expandToggle.addEventListener('click', () => {
expandIcon.classList.toggle('expanded'); expandIcon.classList.toggle('expanded');
expandedStatus.classList.toggle('visible'); 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() { render() {