From 2726d7d51bb89c0ab41783ab359b5ed7ad29a758 Mon Sep 17 00:00:00 2001 From: siddharth ravikumar Date: Sun, 12 Jun 2022 19:44:30 -0400 Subject: weather: update `Weather` Add `SearchEnabled` field. Used to determined weather to render a link to the search or not. --- templates/weather.tmpl | 3 +++ weather/weather.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/templates/weather.tmpl b/templates/weather.tmpl index ab2f0e2..19e7462 100644 --- a/templates/weather.tmpl +++ b/templates/weather.tmpl @@ -82,11 +82,14 @@ {{ end }} + {{ if .SearchEnabled }} + {{ end }} + diff --git a/weather/weather.go b/weather/weather.go index 9cc6ebf..2eb2bf7 100644 --- a/weather/weather.go +++ b/weather/weather.go @@ -9,6 +9,7 @@ import ( "time" "ricketyspace.net/peach/nws" + "ricketyspace.net/peach/photon" "ricketyspace.net/peach/version" ) @@ -19,6 +20,7 @@ type Weather struct { Now WeatherNow Q2HTimeline WeatherTimeline // Q2H forecast of the next 12 hours. BiDailyTimeline WeatherTimeline // BiDaily forecast for the next 3 days. + SearchEnabled bool } type WeatherNow struct { @@ -106,6 +108,7 @@ func NewWeather(lat, lng float32) (*Weather, error, int) { w.BiDailyTimeline = WeatherTimeline{ Periods: bdPeriods, } + w.SearchEnabled = photon.Enabled() return w, nil, 200 } -- cgit v1.2.3