chore: style and formatting tweaks
6b554c56
3 file(s) · +14 −3
| 96 | 96 | .post-weather { |
|
| 97 | 97 | display: flex; |
|
| 98 | 98 | align-items: center; |
|
| 99 | + | flex-wrap: wrap; |
|
| 99 | 100 | gap: 0.75rem; |
|
| 100 | 101 | font-size: 12px; |
|
| 101 | 102 | opacity: 0.5; |
|
| 103 | 104 | ||
| 104 | 105 | .post-weather svg { |
|
| 105 | 106 | height: 16px; |
|
| 107 | + | } |
|
| 108 | + | ||
| 109 | + | .weather-location { |
|
| 110 | + | display: flex; |
|
| 111 | + | align-items: center; |
|
| 112 | + | gap: 0.75rem; |
|
| 106 | 113 | } |
|
| 107 | 114 | ||
| 108 | 115 | /* Post header (public single) */ |
|
| 40 | 40 | <p class="weather-conditions">{{.Weather.Conditions}}</p> |
|
| 41 | 41 | <p class="weather-temp">{{.Weather.Temperature}}</p> |
|
| 42 | 42 | • |
|
| 43 | + | <div class="weather-location"> |
|
| 43 | 44 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><!-- Icon from Phosphor by Phosphor Icons - https://github.com/phosphor-icons/core/blob/main/LICENSE --><path fill="currentColor" d="M128 68a36 36 0 1 0 36 36a36 36 0 0 0-36-36m0 64a28 28 0 1 1 28-28a28 28 0 0 1-28 28m0-112a84.09 84.09 0 0 0-84 84c0 30.42 14.17 62.79 41 93.62a250 250 0 0 0 40.73 37.66a4 4 0 0 0 4.58 0A250 250 0 0 0 171 197.62c26.81-30.83 41-63.2 41-93.62a84.09 84.09 0 0 0-84-84m37.1 172.23A254.6 254.6 0 0 1 128 227a254.6 254.6 0 0 1-37.1-34.81C73.15 171.8 52 139.9 52 104a76 76 0 0 1 152 0c0 35.9-21.15 67.8-38.9 88.23"/></svg> |
|
| 44 | - | <p class="weather-location">{{.Weather.Location}}</p> |
|
| 45 | + | <p>{{.Weather.Location}}</p> |
|
| 46 | + | </div> |
|
| 45 | 47 | {{end}} |
|
| 46 | 48 | </div> |
|
| 47 | 49 | {{if .Post.Tags}} |
| 8 | 8 | "strconv" |
|
| 9 | 9 | "strings" |
|
| 10 | 10 | "time" |
|
| 11 | + | "regexp" |
|
| 11 | 12 | ) |
|
| 12 | 13 | ||
| 13 | 14 | type parsedAttributes struct { |
|
| 385 | 386 | json.NewDecoder(forecastResp.Body).Decode(&weatherForecast) |
|
| 386 | 387 | temp := strconv.Itoa(weatherForecast.Properties.Periods[0].Temperature) |
|
| 387 | 388 | conditions := weatherForecast.Properties.Periods[0].ShortForecast |
|
| 388 | - | ||
| 389 | - | weather := fmt.Sprintf("%s,%s,%s,%s", conditions, temp, city, state) |
|
| 389 | + | var qualifierRE = regexp.MustCompile(`(?i)^(slight chance|chance|isolated|scattered|patchy|areas)\s+(of\s+)?`) |
|
| 390 | + | formattedConditions := strings.TrimSpace(qualifierRE.ReplaceAllString(conditions, "")) |
|
| 391 | + | weather := fmt.Sprintf("%s,%s,%s,%s", formattedConditions, temp, city, state) |
|
| 390 | 392 | return weather |
|
| 391 | 393 | } |
|
| 392 | 394 | ||