add home link
This commit is contained in:
@@ -243,6 +243,18 @@ function updateText(id, text) {
|
|||||||
if (el) el.textContent = text;
|
if (el) el.textContent = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateSiteMeta(site, model, tzLabel) {
|
||||||
|
const home = document.getElementById("site-home");
|
||||||
|
const suffix = document.getElementById("site-meta-suffix");
|
||||||
|
if (home) {
|
||||||
|
home.textContent = site || "--";
|
||||||
|
home.setAttribute("href", "/");
|
||||||
|
}
|
||||||
|
if (suffix) {
|
||||||
|
suffix.textContent = ` | model ${model || "--"} | ${tzLabel}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function upsertChart(id, config) {
|
function upsertChart(id, config) {
|
||||||
const ctx = document.getElementById(id);
|
const ctx = document.getElementById(id);
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
@@ -302,7 +314,7 @@ function baseOptions(range) {
|
|||||||
function renderDashboard(data) {
|
function renderDashboard(data) {
|
||||||
const latest = data.latest;
|
const latest = data.latest;
|
||||||
const tzLabel = state.tz === "utc" ? "UTC" : "Local";
|
const tzLabel = state.tz === "utc" ? "UTC" : "Local";
|
||||||
updateText("site-meta", `${data.site} | model ${data.model} | ${tzLabel}`);
|
updateSiteMeta(data.site, data.model, tzLabel);
|
||||||
updateText("last-updated", `updated ${formatDateTime(data.generated_at)}`);
|
updateText("last-updated", `updated ${formatDateTime(data.generated_at)}`);
|
||||||
const forecastMeta = data.forecast && data.forecast.points && data.forecast.points.length
|
const forecastMeta = data.forecast && data.forecast.points && data.forecast.points.length
|
||||||
? `forecast retrieved ${formatDateTime(data.forecast.retrieved_at)}`
|
? `forecast retrieved ${formatDateTime(data.forecast.retrieved_at)}`
|
||||||
|
|||||||
@@ -14,7 +14,10 @@
|
|||||||
<header class="topbar">
|
<header class="topbar">
|
||||||
<div>
|
<div>
|
||||||
<div class="title">Weatherstation Console</div>
|
<div class="title">Weatherstation Console</div>
|
||||||
<div class="subtitle" id="site-meta">Loading...</div>
|
<div class="subtitle" id="site-meta">
|
||||||
|
<a class="site-link" id="site-home" href="/">--</a>
|
||||||
|
<span id="site-meta-suffix"></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="segmented" role="group" aria-label="time range">
|
<div class="segmented" role="group" aria-label="time range">
|
||||||
|
|||||||
@@ -51,6 +51,16 @@ body {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.site-link {
|
||||||
|
color: var(--text);
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-link:hover {
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
.controls {
|
.controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
|||||||
Reference in New Issue
Block a user