Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Custom 500 server error page #1417

Merged
merged 4 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions app/View/Components/GuestLayout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\View\Components;

use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class GuestLayout extends Component
{
public $title = '';

public function __construct(?string $title = '')
{
$this->title = $title;
}

/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('layouts.guest');
}
}
1 change: 0 additions & 1 deletion public/build/assets/app-Cvdm5QA4.css

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/app-zAziKUDq.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resources/css/app.css": {
"file": "assets/app-Cvdm5QA4.css",
"file": "assets/app-zAziKUDq.css",
"src": "resources/css/app.css",
"isEntry": true
},
Expand Down
19 changes: 19 additions & 0 deletions resources/views/errors/500.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<x-guest-layout :title="__('Server Error')">
<div class="grid px-4 min-h-dvh place-content-center">
<div class="text-center">
<h1 class="font-black text-gray-200 dark:text-gray-800 text-9xl">500</h1>

<p class="text-2xl font-bold tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl">{{ __('Oops, server error!') }}</p>

<p class="mt-4 text-gray-500 dark:text-gray-300">There was an issue, check the logs or view the docs for help.</p>

<a
href="https://docs.speedtest-tracker.dev/help/faqs#im-getting-a-500-or-server-error-error"
target="_blank"
rel="nofollow"
class="inline-block px-5 py-3 mt-6 text-sm font-medium text-white rounded bg-amber-400 hover:bg-amber-500 focus:outline-none focus:ring focus:ring-amber-400/80">
{{ __('Documentation') }}
</a>
</div>
</div>
</x-guest-layout>
4 changes: 2 additions & 2 deletions resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="min-h-dvh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Expand Down Expand Up @@ -27,7 +27,7 @@
}
</script>
</head>
<body class="min-h-screen antialiased bg-gray-50 dark:bg-gray-950 text-gray-950 dark:text-white">
<body class="antialiased min-h-dvh bg-gray-50 dark:bg-gray-950 text-gray-950 dark:text-white">
<main class="p-4 sm:p-6 lg:p-8 mx-auto max-w-{{ config('speedtest.content_width') }} space-y-4 sm:space-y-8">
<header class="flex flex-col gap-4 sm:flex-row sm:justify-between sm:items-center">
<div>
Expand Down
36 changes: 36 additions & 0 deletions resources/views/layouts/guest.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="min-h-dvh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>{{ $title }} - {{ config('app.name') }}</title>
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}">

{{-- Fonts --}}
<link href="{{ asset('fonts/inter/inter.css') }}" rel="stylesheet" />

{{-- Styles --}}
@filamentStyles
@vite('resources/css/app.css')

<script>
const theme = localStorage.getItem('theme') ?? 'system'

if (
theme === 'dark' ||
(theme === 'system' &&
window.matchMedia('(prefers-color-scheme: dark)')
.matches)
) {
document.documentElement.classList.add('dark')
}
</script>
</head>
<body class="antialiased min-h-dvh bg-gray-50 dark:bg-gray-950 text-gray-950 dark:text-white">
{{ $slot }}

{{-- Scripts --}}
@filamentScripts
</body>
</html>
Loading