Hotfix: planner init crashed for admin accounts, killing autosave and the plans list
Test and deploy / test-and-deploy (push) Successful in 1m34s

The admin nav-link reveal ran before the generated nav existed
(getElementById('nav-admin') was null only for admins — which is why
tests and non-admin checks missed it), aborting init before form wiring,
autosave, and loadPlans. initSideNav now runs first, the reveal is
null-safe, and wireCuppingLink degrades instead of crashing (its button
lost its home when After-the-Roast moved — it now lives at the end of
the Roast Log section with a pointer to the Roasts page).

Also: the Roasts page graph now honors the planner's °C/°F preference.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Shane Maynard
2026-08-09 08:53:56 -04:00
co-authored by Claude Fable 5
parent c6c392730f
commit 0b4857c225
3 changed files with 27 additions and 4 deletions
+7 -2
View File
@@ -13,6 +13,11 @@ let planList = [];
const SVG_NS = "http://www.w3.org/2000/svg";
// Same display preference the planner's °C/°F toggle stores — data stays canonical °C,
// only labels convert.
const tempUnit = localStorage.getItem("roastPlannerTempUnit.v1") === "F" ? "F" : "C";
const displayTemp = (c) => (tempUnit === "F" ? Math.round((c * 9) / 5 + 32) : Math.round(c));
const fmtTime = (s) =>
s == null
? "—"
@@ -167,14 +172,14 @@ function renderGraph(detail) {
svgEl("line", { x1: x0, y1: yFor(c), x2: x1, y2: yFor(c), stroke: "#e5dcd2", "stroke-width": c === tempLo ? 1.2 : 0.7 }),
);
const label = svgEl("text", { x: x0 - 6, y: yFor(c) + 3, "text-anchor": "end", fill: "#8a7f74", "font-size": 10 });
label.textContent = String(c);
label.textContent = String(displayTemp(c));
svg.append(label);
}
const xTitle = svgEl("text", { x: (x0 + x1) / 2, y: y1 + 32, "text-anchor": "middle", fill: "#8a7f74", "font-size": 10.5 });
xTitle.textContent = "MINUTES FROM CHARGE";
svg.append(xTitle);
const yTitle = svgEl("text", { x: 14, y: (y0 + y1) / 2, fill: "#8a7f74", "font-size": 10.5, transform: `rotate(-90 14 ${(y0 + y1) / 2})`, "text-anchor": "middle" });
yTitle.textContent = "BEAN TEMP °C";
yTitle.textContent = `BEAN TEMP °${tempUnit}`;
svg.append(yTitle);
// Plan curve (dashed) under the actual curve