aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/superpowers/specs/2026-10-18-mirage-weather-cards-design.md5
-rw-r--r--lib/weather.lua18
-rw-r--r--test/test_weather.lua6
-rw-r--r--widgets/now.lua18
4 files changed, 11 insertions, 36 deletions
diff --git a/docs/superpowers/specs/2026-10-18-mirage-weather-cards-design.md b/docs/superpowers/specs/2026-10-18-mirage-weather-cards-design.md
index dc3bd16..3d8b049 100644
--- a/docs/superpowers/specs/2026-10-18-mirage-weather-cards-design.md
+++ b/docs/superpowers/specs/2026-10-18-mirage-weather-cards-design.md
@@ -48,7 +48,7 @@ only what DESIGN.md calls a card's variable band.
| Card | Header left | Big value (top-right) | Rows | Variable band |
|---|---|---|---|---|
-| `now` | condition glyph | current temperature, `body` | feels like, high / low, rain chance, description in `FONT_UI` | none |
+| `now` | condition glyph | current temperature, `body` | feels like, high / low, rain chance, last update | the condition glyph, large, in the leftover height |
| `hourly` | glyph + "Next 24h" | next hour's temperature, `body` | none | temperature curve over 24 hours; every 3rd hour labelled with glyph and temperature; rain-chance bars under the curve in `value`, half alpha, with a minimum height so a low chance still shows |
| `week` | glyph + "Week" | none (band carries the value) | one per day: day name, glyph, min, range bar, max | the range bar in each row, positioned on the week's overall min..max scale |
| `details` | glyph + "Details" | none | wind (speed + compass point), humidity, UV, AQI | a small wind compass with a needle at the wind direction |
@@ -126,7 +126,6 @@ Rewritten for Open-Meteo, same contract as today: pure functions on strings
and numbers, nothing raises, nil on bad input.
- `ICON` / `icon(code, is_day)`: WMO weather code to Nerd Font glyph.
-- `describe(code)`: WMO code to a short English description.
- `parse(src)`: returns `{units, current, sun, air, hours, days}` or nil when
`current`, `sun` or at least one `hour` is missing.
- `moon(epoch)`: returns `phase` (0..1, 0 = new) and `illumination` (0..1),
@@ -166,7 +165,7 @@ board.
- `test/test_weather.lua` rewritten against a fixture
`test/fixtures/weather.txt` (location-free; any names use `Example City`):
- - WMO code to glyph and description, day and night, unknown code fallback.
+ - WMO code to glyph, day and night, unknown code fallback.
- `parse`: full fixture, missing `air`, missing `current` (nil), garbage
input (nil), empty string (nil).
- `moon`: known full and new moon dates within one day of tolerance.
diff --git a/lib/weather.lua b/lib/weather.lua
index 3cb7b64..28b3341 100644
--- a/lib/weather.lua
+++ b/lib/weather.lua
@@ -59,24 +59,6 @@ function M.icon(code, is_day)
return I.unknown
end
-local DESCRIBE = {
- [0] = 'Clear sky', [1] = 'Mainly clear', [2] = 'Partly cloudy', [3] = 'Overcast',
- [45] = 'Fog', [48] = 'Rime fog',
- [51] = 'Light drizzle', [53] = 'Drizzle', [55] = 'Dense drizzle',
- [56] = 'Freezing drizzle', [57] = 'Freezing drizzle',
- [61] = 'Light rain', [63] = 'Rain', [65] = 'Heavy rain',
- [66] = 'Freezing rain', [67] = 'Freezing rain',
- [71] = 'Light snow', [73] = 'Snow', [75] = 'Heavy snow', [77] = 'Snow grains',
- [80] = 'Rain showers', [81] = 'Rain showers', [82] = 'Violent showers',
- [85] = 'Snow showers', [86] = 'Snow showers',
- [95] = 'Thunderstorm', [96] = 'Thunderstorm, hail', [99] = 'Thunderstorm, hail',
-}
-
--- WMO code in words. Reading a nil key from a table is not an error.
-function M.describe(code)
- return DESCRIBE[code] or 'Unknown'
-end
-
-- Nearest integer, or nil when v is NaN, infinite or too big for an integer:
-- %d and utf8.char raise on those, and a raise is a blank dashboard.
local function round(v) return math.tointeger(math.floor(v + 0.5)) end
diff --git a/test/test_weather.lua b/test/test_weather.lua
index 2a77b43..e845c5c 100644
--- a/test/test_weather.lua
+++ b/test/test_weather.lua
@@ -53,12 +53,6 @@ assert(weather.icon(0, nil) == I.clear_day, 'nil is_day draws the day face')
-- draws a snow cloud in the target font is not something an assertion can
-- see; the glyph sheet in Task 3 is that check.
--- === Descriptions =========================================================
-assert(weather.describe(0) == 'Clear sky', 'code 0 words')
-assert(weather.describe(63) == 'Rain', 'code 63 words')
-assert(weather.describe(99) == 'Thunderstorm, hail', 'code 99 words')
-assert(weather.describe(4) == 'Unknown', 'gap code words')
-assert(weather.describe(nil) == 'Unknown', 'nil code words')
-- === Formatting ===========================================================
assert(weather.deg(13.2) == '13\u{00B0}', 'rounds down')
diff --git a/widgets/now.lua b/widgets/now.lua
index 6273ed1..f00c46e 100644
--- a/widgets/now.lua
+++ b/widgets/now.lua
@@ -31,15 +31,15 @@ function M.draw(cr, rect, colors)
big = weather.deg(c.temp), rows = rows, share = 0.85,
})
- -- The condition in words, in the prose face, in what the rows left. It sits
- -- on the card's foot: the type is capped to match the other cards, so a tall
- -- cell leaves height over, and that gap belongs above the line, not below.
- local size = S * 0.36
- local foot = inner.y + inner.h - size * 0.25
- if y + size * 1.4 <= foot then
- card.font(cr, card.FONT_UI, size, false)
- card.rgba(cr, colors.body)
- card.text(cr, inner.x, foot, weather.describe(c.code))
+ -- The condition as a large glyph, the card's variable band: the type is
+ -- capped to match the other cards, so a tall cell leaves height over, and the
+ -- glyph takes it. Dropped when there is no room for one bigger than a row.
+ local size = math.min(inner.y + inner.h - y, inner.w * 0.45)
+ if size > S * 0.6 then
+ card.font(cr, card.FONT_MONO, size, false)
+ card.rgba(cr, colors.highlight)
+ card.text_centre(cr, inner.x + inner.w / 2, inner.y + inner.h - size * 0.15,
+ weather.icon(c.code, c.is_day))
end
end