diff --git a/static/app.js b/static/app.js index e27d13c..0fc5373 100644 --- a/static/app.js +++ b/static/app.js @@ -77,7 +77,8 @@ const fmtPrecip = (v) => (v == null ? "—" : `${v.toFixed(2)}"`); const fmtWind = (v) => (v == null ? "—" : `${Math.round(v)} mph`); const fmtHumid = (v) => (v == null ? "—" : `${v.toFixed(1)} g/m³`); // Compact cell formatters for the dense recent/forecast table (units live in the -// column headers, so values stay short). Precip shows a dot for a dry day. +// column headers, so values stay short). Dry days label the running dry streak +// (see precipCell) rather than the rain amount. const cTemp = (v) => (v == null ? "—" : `${Math.round(v)}°`); const cHum = (v) => (v == null ? "—" : `${Math.round(v)}%`); const cWind = (v) => (v == null ? "—" : `${Math.round(v)}`); @@ -177,6 +178,21 @@ function rdCell(g, fmt, date, isFc, isToday) { return `${fmt(g.value)}`; } +// Precip cell: rain days show the amount (tinted by intensity tier); dry days +// label the running dry streak — "3d" = 3 days since measurable rain, warmed by +// the same dryness ramp as the chart — instead of a bare dot. +function precipCell(d, isFc, isToday) { + const g = d.precip; + const dd = ` data-date="${d.date}"`; + const cls = "rd-c" + (isFc ? " rd-fc" : isToday ? " rd-today" : ""); + if (!g) return `—`; + if (g.value === 0 && d.dsr != null && d.dsr > 0) { + return `${d.dsr}d`; + } + const col = TIER_COLORS[g.class] || ""; + return `${cRain(g.value)}`; +} + // Compact "graded days" table — a ROW per metric, a COLUMN per day (newest first). // Wide runs (e.g. 2 weeks) scroll horizontally inside their own container; the // metric-label column stays pinned. Tapping any cell/day opens that day's detail. @@ -197,7 +213,9 @@ function daysTable(rows, todayDate) { }).join(""); const body = RD_METRICS.map(([key, label, fmt]) => `