Dashboard Studio 1.6.0: app icon, clock weather, icon-only tab rail
- App store icon (icon.png) and favicon, drawn by tools/make_icon.py - Clock can show a weather entity with today's high and low from weather.get_forecasts - Side menu gets an icon-only rail style (now the default): full height, centered icons, active marker, names as hover/focus tooltips; phones keep a labelled bottom tab bar Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -330,8 +330,29 @@
|
||||
{ k: "h24", t: "check", l: "24-hour time", d: true },
|
||||
{ k: "seconds", t: "check", l: "Show seconds", d: false },
|
||||
{ k: "date", t: "check", l: "Show date", d: true },
|
||||
{ k: "weather", t: "entity", l: "Weather (optional)", domains: ["weather"] },
|
||||
{ k: "forecast", t: "check", l: "Show today’s high and low", d: true },
|
||||
],
|
||||
render: (c) => `<div class="clock" data-clock data-h24="${c.h24 ? 1 : 0}" data-sec="${c.seconds ? 1 : 0}" data-date="${c.date ? 1 : 0}">${clockHTML(c.h24, c.seconds, c.date)}</div>`,
|
||||
entities: (c) => (c.weather ? [c.weather] : []),
|
||||
render(c, { ha }) {
|
||||
const s = c.weather && ha.states[c.weather];
|
||||
const wx = s ? `<button class="clock-wx wbtn" data-act="more" data-e="${esc(c.weather)}" aria-label="${esc(friendly(s))}: ${esc(st(s.state))}, ${esc(s.attributes.temperature ?? "–")}°">
|
||||
<span class="clock-wx-ico">${Icons.svg(WX[s.state] || "cloud")}</span><span class="clock-wx-temp num">${esc(s.attributes.temperature ?? "–")}°</span>
|
||||
<span class="clock-wx-text">${esc(st(s.state))}</span><span class="clock-hl num" data-hl></span></button>` : "";
|
||||
return `<div class="clock"><div class="clock-time" data-clock data-h24="${c.h24 ? 1 : 0}" data-sec="${c.seconds ? 1 : 0}" data-date="${c.date ? 1 : 0}">${clockHTML(c.h24, c.seconds, c.date)}</div>${wx}</div>`;
|
||||
},
|
||||
async after(el, c, ctx) {
|
||||
if (!c.weather || c.forecast === false || !ctx.ha.states[c.weather]) return;
|
||||
const cache = ctx.cache;
|
||||
if (cache.key !== c.weather || Date.now() - cache.at > 30 * 60 * 1000) {
|
||||
cache.key = c.weather; cache.at = Date.now();
|
||||
cache.loading = ctx.ha.forecast(c.weather, "daily").then((f) => (cache.today = f[0])).catch(() => (cache.today = null));
|
||||
}
|
||||
await cache.loading;
|
||||
const hl = el.querySelector("[data-hl]");
|
||||
const f = cache.today;
|
||||
if (hl && f && f.temperature != null) hl.textContent = f.templow != null ? t("High {0}° · Low {1}°", Math.round(f.temperature), Math.round(f.templow)) : t("High {0}°", Math.round(f.temperature));
|
||||
},
|
||||
};
|
||||
|
||||
function clockHTML(h24, sec, date) {
|
||||
|
||||
Reference in New Issue
Block a user