Skip to content

Commit c981e01

Browse files
authored
[Feature] Custom 500 server error page (alexjustesen#1417)
1 parent 92024fd commit c981e01

File tree

7 files changed

+84
-4
lines changed

7 files changed

+84
-4
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace App\View\Components;
4+
5+
use Closure;
6+
use Illuminate\Contracts\View\View;
7+
use Illuminate\View\Component;
8+
9+
class GuestLayout extends Component
10+
{
11+
public $title = '';
12+
13+
public function __construct(?string $title = '')
14+
{
15+
$this->title = $title;
16+
}
17+
18+
/**
19+
* Get the view / contents that represent the component.
20+
*/
21+
public function render(): View|Closure|string
22+
{
23+
return view('layouts.guest');
24+
}
25+
}

public/build/assets/app-Cvdm5QA4.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/build/assets/app-zAziKUDq.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"resources/css/app.css": {
3-
"file": "assets/app-Cvdm5QA4.css",
3+
"file": "assets/app-zAziKUDq.css",
44
"src": "resources/css/app.css",
55
"isEntry": true
66
},
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<x-guest-layout :title="__('Server Error')">
2+
<div class="grid px-4 min-h-dvh place-content-center">
3+
<div class="text-center">
4+
<h1 class="font-black text-gray-200 dark:text-gray-800 text-9xl">500</h1>
5+
6+
<p class="text-2xl font-bold tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl">{{ __('Oops, server error!') }}</p>
7+
8+
<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>
9+
10+
<a
11+
href="https://docs.speedtest-tracker.dev/help/faqs#im-getting-a-500-or-server-error-error"
12+
target="_blank"
13+
rel="nofollow"
14+
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">
15+
{{ __('Documentation') }}
16+
</a>
17+
</div>
18+
</div>
19+
</x-guest-layout>

resources/views/layouts/app.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
2+
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="min-h-dvh">
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -27,7 +27,7 @@
2727
}
2828
</script>
2929
</head>
30-
<body class="min-h-screen antialiased bg-gray-50 dark:bg-gray-950 text-gray-950 dark:text-white">
30+
<body class="antialiased min-h-dvh bg-gray-50 dark:bg-gray-950 text-gray-950 dark:text-white">
3131
<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">
3232
<header class="flex flex-col gap-4 sm:flex-row sm:justify-between sm:items-center">
3333
<div>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="min-h-dvh">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
7+
<title>{{ $title }} - {{ config('app.name') }}</title>
8+
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}">
9+
10+
{{-- Fonts --}}
11+
<link href="{{ asset('fonts/inter/inter.css') }}" rel="stylesheet" />
12+
13+
{{-- Styles --}}
14+
@filamentStyles
15+
@vite('resources/css/app.css')
16+
17+
<script>
18+
const theme = localStorage.getItem('theme') ?? 'system'
19+
20+
if (
21+
theme === 'dark' ||
22+
(theme === 'system' &&
23+
window.matchMedia('(prefers-color-scheme: dark)')
24+
.matches)
25+
) {
26+
document.documentElement.classList.add('dark')
27+
}
28+
</script>
29+
</head>
30+
<body class="antialiased min-h-dvh bg-gray-50 dark:bg-gray-950 text-gray-950 dark:text-white">
31+
{{ $slot }}
32+
33+
{{-- Scripts --}}
34+
@filamentScripts
35+
</body>
36+
</html>

0 commit comments

Comments
 (0)