From c7952c980f51cea0e43324bb608d7937f2413b5b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 18 Jul 2026 21:11:52 -0700 Subject: [PATCH] Synchronize weather hero icon --- shell/plugins/panels/weather/Panel.qml | 3 +-- test/shell.d/weather-test.sh | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/shell/plugins/panels/weather/Panel.qml b/shell/plugins/panels/weather/Panel.qml index 9e6a0afd..d12c5d18 100644 --- a/shell/plugins/panels/weather/Panel.qml +++ b/shell/plugins/panels/weather/Panel.qml @@ -108,7 +108,6 @@ Panel { readonly property bool hasConfiguredCoordinates: !isNaN(parseFloat(String(configuredLocationState.latitude))) && !isNaN(parseFloat(String(configuredLocationState.longitude))) readonly property var openMeteoCurrent: Model.openMeteoCurrentCondition(dailyForecastReport) readonly property var current: (hasConfiguredCoordinates && openMeteoCurrent) ? openMeteoCurrent : ((report && report.current_condition && report.current_condition[0]) ? report.current_condition[0] : openMeteoCurrent) - readonly property string currentIcon: Model.currentIcon(current, label) readonly property var areaInfo: report && report.nearest_area && report.nearest_area[0] ? report.nearest_area[0] : null readonly property var forecastDays: buildForecastDays() readonly property string reportCountry: areaInfo && areaInfo.country && areaInfo.country[0] ? areaInfo.country[0].value : "" @@ -484,7 +483,7 @@ Panel { id: heroIcon anchors.verticalCenter: parent.verticalCenter anchors.verticalCenterOffset: 5 - text: root.currentIcon || "—" + text: root.label || "—" color: root.bar.foreground font.family: root.bar.fontFamily // Decorative condition emoji; intentionally larger than the diff --git a/test/shell.d/weather-test.sh b/test/shell.d/weather-test.sh index 30d8bb60..c31790dd 100644 --- a/test/shell.d/weather-test.sh +++ b/test/shell.d/weather-test.sh @@ -5,6 +5,7 @@ set -euo pipefail source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" run_node_test <<'JS' +const fs = require('fs') const weather = requireFromRoot('shell/plugins/panels/weather/Model.js') assertDeepEqual( @@ -111,6 +112,10 @@ assert(weather.dayIcon({ openMeteoWeatherCode: 95 }).length > 0, 'weather maps O assertEqual(weather.currentIcon({ openMeteoWeatherCode: 0, isDay: 1 }, ''), weather.iconForOpenMeteoCode(0), 'weather uses the current Open-Meteo icon with current values') assertEqual(weather.currentIcon({ openMeteoWeatherCode: 0, isDay: 0 }, ''), weather.iconForCode(113, true), 'weather uses the nighttime Open-Meteo icon after sunset') assert(weather.iconForOpenMeteoCode(45, true) !== weather.iconForOpenMeteoCode(45, false), 'weather distinguishes nighttime fog from daytime fog') +assert( + fs.readFileSync(root + '/shell/plugins/panels/weather/Panel.qml', 'utf8').includes('text: root.label || "—"'), + 'weather hero and bar use the same resolved icon' +) assert(!weather.weatherResponseCompletesSave(true, 'wttr'), 'weather keeps the spinner through a non-authoritative pinned-location response') assert(weather.weatherResponseCompletesSave(true, 'open-meteo'), 'weather completes a pinned-location save with Open-Meteo data') assert(weather.weatherResponseCompletesSave(false, 'wttr'), 'weather completes a name-only location save with wttr data')