diff options
author | floppydiskette <floppydisk@hyprcat.net> | 2024-08-31 00:47:01 +0100 |
---|---|---|
committer | floppydiskette <floppydisk@hyprcat.net> | 2024-08-31 00:47:01 +0100 |
commit | a715ae58afa15a98006e2271522bef5a00ca071f (patch) | |
tree | 5e64ac5ac9e30fd14b96f8e88d3f449fda223ac1 /resources | |
parent | 97d8f4447d0839d3f251a7dfc2f5f123c36c4d5e (diff) |
Handle any errors if unable to get presence or weather data
Diffstat (limited to 'resources')
-rw-r--r-- | resources/views/components/discord-status.blade.php | 8 | ||||
-rw-r--r-- | resources/views/components/weather.blade.php | 18 |
2 files changed, 17 insertions, 9 deletions
diff --git a/resources/views/components/discord-status.blade.php b/resources/views/components/discord-status.blade.php index 00d2c7a..868fc03 100644 --- a/resources/views/components/discord-status.blade.php +++ b/resources/views/components/discord-status.blade.php @@ -1,3 +1,7 @@ -<span>I'm</span> -<h2 class="online-status" style="color: {{ $status["color"] }};text-shadow: var(--firefox-shadow) {{ $status["color"] }}4f !important">{{ $status["text"] }}!</h2> +@if($status == null) + <p>Status Unavailable</p> +@else + <span>I'm</span> + <h2 class="online-status" style="color: {{ $status["color"] }};text-shadow: var(--firefox-shadow) {{ $status["color"] }}4f !important">{{ $status["text"] }}!</h2> +@endif <p><strong>Time in Britain:</strong> <span id="clock"></span></p> diff --git a/resources/views/components/weather.blade.php b/resources/views/components/weather.blade.php index b4dfcaa..879f1cb 100644 --- a/resources/views/components/weather.blade.php +++ b/resources/views/components/weather.blade.php @@ -1,11 +1,15 @@ <p><strong>Weather Conditions:</strong></p> <hr style="margin: 4px 0"> -<p><strong>Temperature:</strong> {{ round(($conditions[0]["temp"] - 32) * (5/9), 1) }} degC</p> -<p><strong>Rain:</strong> {{ ($conditions[0]["rain_rate_last"] * 0.2) }}mm/hr ({{ $conditions[0]["rainfall_daily"] }}mm today)</p> -@if ($conditions[0]["wind_speed_last"] != 0) - <p><strong>Wind:</strong> {{ round($conditions[0]["wind_speed_last"], 1) }}mph ({{ $conditions[0]["wind_dir_last"] }} deg)</p> +@if($conditions == null) + <p>Data Unavailable</p> @else - <p><strong>Wind:</strong> 0mph</p> + <p><strong>Temperature:</strong> {{ round(($conditions[0]["temp"] - 32) * (5/9), 1) }} degC</p> + <p><strong>Rain:</strong> {{ ($conditions[0]["rain_rate_last"] * 0.2) }}mm/hr ({{ $conditions[0]["rainfall_daily"] }}mm today)</p> + @if ($conditions[0]["wind_speed_last"] != 0) + <p><strong>Wind:</strong> {{ round($conditions[0]["wind_speed_last"], 1) }}mph ({{ $conditions[0]["wind_dir_last"] }} deg)</p> + @else + <p><strong>Wind:</strong> 0mph</p> + @endif + <p><strong>Humidity:</strong> {{ round($conditions[0]["hum"], 1) }}%</p> + <p><strong>Pressure:</strong> {{ round($conditions[2]["bar_sea_level"], 1) }} inHg</p> @endif -<p><strong>Humidity:</strong> {{ round($conditions[0]["hum"], 1) }}%</p> -<p><strong>Pressure:</strong> {{ round($conditions[2]["bar_sea_level"], 1) }} inHg</p> |