@@ -146,71 +146,76 @@ templ WeatherCompact(block core.Block) {
146146 }
147147 </div >
148148 <div class =" weather-info" >
149- <div class =" weather-location" >
150- if location , ok := block.Metadata ()[" location" ].(string ); ok {
151- { location }
152- } else {
153- Unknown
149+ if lat , latOk := block.Metadata ()[" latitude" ].(float64 ); latOk {
150+ if lon , lonOk := block.Metadata ()[" longitude" ].(float64 ); lonOk {
151+ <a
152+ href ={ templ.URL (fmt.Sprintf (" https://www.openstreetmap.org/?mlat=%.4f &mlon=%.4f &zoom=12" , lat, lon)) }
153+ target =" _blank"
154+ class =" weather-location-link"
155+ >
156+ if location , ok := block.Metadata ()[" location" ].(string ); ok {
157+ { location }
158+ } else {
159+ Unknown
160+ }
161+ if country , ok := block.Metadata ()[" country" ].(string ); ok {
162+ , { country }
163+ }
164+ </a >
154165 }
155- if country , ok := block.Metadata ()[" country" ].(string ); ok {
156- , { country }
157- }
158- </div >
166+ }
159167 <div class =" weather-meta" >
160168 <span class =" weather-time" >{ formatRelativeTime (block.CreatedAt ()) }</span >
161- if timezone , ok := block.Metadata ()[" timezone" ].(string ); ok && timezone != " " {
162- <span class =" weather-separator" >|</span >
163- <span class =" weather-timezone" >{ timezone }</span >
164- }
165- if lat , latOk := block.Metadata ()[" latitude" ].(float64 ); latOk {
166- if lon , lonOk := block.Metadata ()[" longitude" ].(float64 ); lonOk {
167- <span class =" weather-separator" >|</span >
168- <a
169- href ={ templ.URL (fmt.Sprintf (" https://www.openstreetmap.org/?mlat=%.4f &mlon=%.4f &zoom=12" , lat, lon)) }
170- target =" _blank"
171- class =" weather-map"
172- >
173- view map
174- </a >
175- }
176- }
177169 </div >
178170 </div >
179171 <div class =" weather-details" >
180172 <div class =" weather-detail" >
181173 if temp , ok := block.Metadata ()[" temperature" ].(float64 ); ok {
182- <span class =" detail-label" >🌡️ Temperature </span >
174+ <span class =" detail-label" >🌡️</span >
183175 <span class =" detail-value" >{ fmt.Sprintf (" %.1f " , temp) }°</span >
184176 }
185177 </div >
186178 if windSpeed , ok := block.Metadata ()[" wind_speed" ].(float64 ); ok {
187179 <div class =" weather-detail" >
188- <span class =" detail-label" >💨 Wind </span >
180+ <span class =" detail-label" >💨</span >
189181 <span class =" detail-value" >{ fmt.Sprintf (" %.1f " , windSpeed) } km/h</span >
190182 </div >
191183 }
192184 if humidity , ok := block.Metadata ()[" humidity" ].(float64 ); ok {
193185 <div class =" weather-detail" >
194- <span class =" detail-label" >💧 Humidity </span >
186+ <span class =" detail-label" >💧</span >
195187 <span class =" detail-value" >{ fmt.Sprintf (" %.1f " , humidity) }%</span >
196188 </div >
197189 }
198190 if uvIndex , ok := block.Metadata ()[" uv_index" ].(float64 ); ok {
199191 <div class =" weather-detail" >
200- <span class =" detail-label" >☀️ UV Index </span >
192+ <span class =" detail-label" >☀️</span >
201193 <span class =" detail-value" >{ fmt.Sprintf (" %.0f " , uvIndex) }</span >
202194 </div >
203195 }
204196 if pressure , ok := block.Metadata ()[" surface_pressure" ].(float64 ); ok {
205197 <div class =" weather-detail" >
206- <span class =" detail-label" >📊 Pressure </span >
198+ <span class =" detail-label" >📊</span >
207199 <span class =" detail-value" >{ fmt.Sprintf (" %.1f " , pressure) } hPa</span >
208200 </div >
209201 }
202+ if hourlyForecast , ok := block.Metadata ()[" hourly_forecast" ].([]interface {}); ok && len (hourlyForecast) > 0 {
203+ <div class =" weather-detail" >
204+ if hasRain (hourlyForecast) {
205+ <span class =" detail-label" >🌧️</span >
206+ <span class =" detail-value rain-yes" >Yes</span >
207+ } else {
208+ <span class =" detail-label" >🌧️</span >
209+ <span class =" detail-value rain-no" >No</span >
210+ }
211+ </div >
212+ }
210213 </div >
211214 </div >
212215}
213216
217+
218+
214219// HourlyForecast displays collapsible hourly forecast table
215220templ HourlyForecast (metadata map [string ]interface {}) {
216221 if hourlyForecast , ok := metadata[" hourly_forecast" ].([]interface {}); ok && len (hourlyForecast) > 0 {
0 commit comments