From b4451efb0f957d3cd3d9750f903899d8a87e15f3 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 18 Oct 2026 14:45:35 +0200 Subject: fix(weather cards): review fixes Hour and day labels go through weather.clock, hourly clamps rain chance and caps at 24 hours, week widens the scale by min and max together and sizes the glyph apart from the text, details compass letters never exceed row text, now always hints at the fetcher. Co-Authored-By: Claude Sonnet 5.5 --- widgets/week.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'widgets/week.lua') diff --git a/widgets/week.lua b/widgets/week.lua index 262121f..3cf34d1 100644 --- a/widgets/week.lua +++ b/widgets/week.lua @@ -19,8 +19,9 @@ local function draw_days(cr, x, y, w, h, colors, days, S) local lo, hi = math.huge, -math.huge for _, d in ipairs(days) do - if d.min then lo = math.min(lo, d.min) end - if d.max then hi = math.max(hi, d.max) end + if d.min and d.max then + lo, hi = math.min(lo, d.min, d.max), math.max(hi, d.min, d.max) + end end local span = (hi > lo) and (hi - lo) or 1 -- Columns as fractions of the width: day | glyph | min | bar | max. @@ -33,10 +34,13 @@ local function draw_days(cr, x, y, w, h, colors, days, S) local by = y + step * (i - 0.5) + size * 0.35 -- baseline, centred in the row card.font(cr, card.FONT_MONO, size, false) card.rgba(cr, colors.label) + local name = weather.clock(d.t, '%a') card.text(cr, x, by, i == 1 and 'TODAY' - or (d.t and os.date('%a', d.t):upper() or '--')) + or (name == '--' and name or name:upper())) card.rgba(cr, colors.highlight) + card.font(cr, card.FONT_MONO, size * 1.4, false) card.text(cr, gx, by, weather.icon(d.code, true)) + card.font(cr, card.FONT_MONO, size, false) card.rgba(cr, colors.value) card.text_right(cr, minx, by, weather.deg(d.min)) card.text_right(cr, x + w, by, weather.deg(d.max)) -- cgit v1.2.3