Added Weather IA
Some checks failed
Run Integration Tests / test (push) Failing after 10m2s

This commit is contained in:
partisan 2025-06-30 08:07:57 +02:00
parent e2f1707723
commit 0559fd2bba
5 changed files with 623 additions and 2 deletions

View file

@ -168,8 +168,8 @@
{{if .Instant}}
<div class="instant-container">
<div class="instant-box">
<h3>{{.Instant.Title}}</h3>
{{if eq .Instant.Type "currency"}}
<h3>{{.Instant.Title}}</h3> <!-- TODO: improve looks and feels of this ui -->
<div class="instant-result">
{{index .Instant.Content "display"}}
</div>
@ -208,7 +208,50 @@
</div>
</div>
{{end}}
{{if eq .Instant.Type "weather"}}
<div class="weather">
<div class="weather-header">
<span class="weather-location">
{{index .Instant.Content "city"}}, {{index .Instant.Content "country"}}
</span>
<span class="weather-temp">
{{with (index .Instant.Content "current")}}{{printf "%.0f" .Temperature}}{{end}}°
<span class="weather-deg">C</span>
</span>
</div>
<div class="weather-current">
<div class="weather-current-left">
<span class="weather-icon">
{{weatherIcon (index .Instant.Content "current")}}
</span>
<span class="weather-cond">
{{with (index .Instant.Content "current")}}{{.Condition}}{{end}}
</span>
</div>
<div class="weather-current-right">
<span class="weather-detail" title="Humidity">
💧 {{with (index .Instant.Content "current")}}{{.Humidity}}{{end}}%
</span>
<span class="weather-detail" title="Wind">
💨 {{with (index .Instant.Content "current")}}{{printf "%.1f" .Wind}}{{end}} m/s
</span>
</div>
</div>
<div class="weather-forecast">
{{range $i, $day := (index .Instant.Content "forecast")}}
<div class="weather-forecast-day">
<div class="weather-forecast-date">{{formatShortDate $day.Date}}</div>
<div class="weather-forecast-temps">
<span>{{printf "%.0f" $day.MinTemp}}&ndash;{{printf "%.0f" $day.MaxTemp}}°C</span>
</div>
<div class="weather-forecast-cond">{{$day.Condition}}</div>
</div>
{{end}}
</div>
</div>
{{end}}
{{if eq .Instant.Type "wiki"}}
<h3>{{.Instant.Title}}</h3>
<div class="instant-result">{{index .Instant.Content "text"}}</div>
<div><a href="{{index .Instant.Content "link"}}" target="_blank">Read more on Wikipedia →</a></div>
{{end}}