diff --git a/app/View/Components/DiscordStatus.php b/app/View/Components/DiscordStatus.php index 3ad3a3b..fac06ae 100644 --- a/app/View/Components/DiscordStatus.php +++ b/app/View/Components/DiscordStatus.php @@ -31,15 +31,13 @@ public function getDiscordPresence(): mixed { $response = Http::get('https://api.lanyard.rest/v1/users/' . Config::get('services.lanyard.user_id')); $data = $response->json(); - if (!isset($data["data"])) return null; $presence = $data["data"]; Cache::put('discord_presence', $presence, now()->addSeconds(60)); return $presence; } - public function getOnlineStatus(): ?array { + public function getOnlineStatus(): array { $presence = $this->getDiscordPresence(); - if ($presence == null) return null; return match ($presence["discord_status"]) { "online", "dnd" => [ "text" => "online", diff --git a/app/View/Components/Weather.php b/app/View/Components/Weather.php index dcf3ff7..69be9fd 100644 --- a/app/View/Components/Weather.php +++ b/app/View/Components/Weather.php @@ -3,7 +3,6 @@ namespace App\View\Components; use Closure; -use Exception; use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Config; @@ -26,16 +25,11 @@ public function getWeatherData(): mixed { return Cache::get('weather_data'); } - try { - $response = Http::get('http://' . Config::get('services.weatherlink') . '/v1/current_conditions'); - $data = $response->json(); - $conditions = $data["data"]["conditions"]; - Cache::put('weather_data', $conditions, now()->addSeconds(60)); - return $conditions; - } catch (Exception $ex) { - return null; - } - + $response = Http::get('http://'. Config::get('services.weatherlink') . '/v1/current_conditions'); + $data = $response->json(); + $conditions = $data["data"]["conditions"]; + Cache::put('weather_data', $conditions, now()->addSeconds(60)); + return $conditions; } /** diff --git a/resources/views/bookmarks.blade.php b/resources/views/bookmarks.blade.php index f75e9b4..c8d0e11 100644 --- a/resources/views/bookmarks.blade.php +++ b/resources/views/bookmarks.blade.php @@ -3,19 +3,9 @@ @foreach($categories as $category)

{{ $category->name }}

- @if($category->id == 1) -

(These are shuffled every load)

- @php - $sites = $category->sites->shuffle(); - @endphp - @else - @php - $sites = $category->sites; - @endphp - @endif
diff --git a/resources/views/components/discord-status.blade.php b/resources/views/components/discord-status.blade.php index 868fc03..00d2c7a 100644 --- a/resources/views/components/discord-status.blade.php +++ b/resources/views/components/discord-status.blade.php @@ -1,7 +1,3 @@ -@if($status == null) -

Status Unavailable

-@else - I'm -

{{ $status["text"] }}!

-@endif +I'm +

{{ $status["text"] }}!

Time in Britain:

diff --git a/resources/views/components/weather.blade.php b/resources/views/components/weather.blade.php index 879f1cb..b4dfcaa 100644 --- a/resources/views/components/weather.blade.php +++ b/resources/views/components/weather.blade.php @@ -1,15 +1,11 @@

Weather Conditions:


-@if($conditions == null) -

Data Unavailable

+

Temperature: {{ round(($conditions[0]["temp"] - 32) * (5/9), 1) }} degC

+

Rain: {{ ($conditions[0]["rain_rate_last"] * 0.2) }}mm/hr ({{ $conditions[0]["rainfall_daily"] }}mm today)

+@if ($conditions[0]["wind_speed_last"] != 0) +

Wind: {{ round($conditions[0]["wind_speed_last"], 1) }}mph ({{ $conditions[0]["wind_dir_last"] }} deg)

@else -

Temperature: {{ round(($conditions[0]["temp"] - 32) * (5/9), 1) }} degC

-

Rain: {{ ($conditions[0]["rain_rate_last"] * 0.2) }}mm/hr ({{ $conditions[0]["rainfall_daily"] }}mm today)

- @if ($conditions[0]["wind_speed_last"] != 0) -

Wind: {{ round($conditions[0]["wind_speed_last"], 1) }}mph ({{ $conditions[0]["wind_dir_last"] }} deg)

- @else -

Wind: 0mph

- @endif -

Humidity: {{ round($conditions[0]["hum"], 1) }}%

-

Pressure: {{ round($conditions[2]["bar_sea_level"], 1) }} inHg

+

Wind: 0mph

@endif +

Humidity: {{ round($conditions[0]["hum"], 1) }}%

+

Pressure: {{ round($conditions[2]["bar_sea_level"], 1) }} inHg