Skip to content

Commit 49fdce4

Browse files
authored
Added version to dashboard footer (alexjustesen#2537)
Co-authored-by: Alex Justesen <[email protected]>
1 parent 8e869a0 commit 49fdce4

File tree

3 files changed

+96
-78
lines changed

3 files changed

+96
-78
lines changed

resources/views/layouts/app.blade.php

Lines changed: 3 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -35,86 +35,11 @@
3535
</head>
3636
<body class="antialiased min-h-dvh bg-gray-50 dark:bg-gray-950 text-gray-950 dark:text-white">
3737
<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">
38-
<header class="flex flex-col gap-4 sm:flex-row sm:justify-between sm:items-center">
39-
<div>
40-
<h1 class="text-2xl font-bold tracking-tight text-gray-950 dark:text-white sm:text-3xl">{{ $title ?? 'Page Title' }} - {{ config('app.name') }}</h1>
41-
</div>
42-
43-
<div class="flex items-center flex-shrink-0 gap-4">
44-
<div
45-
x-data="{ theme: null }"
46-
x-init="
47-
theme = localStorage.getItem('theme') || 'system'
48-
$watch('theme', () => {
49-
localStorage.setItem('theme', theme)
50-
const effectiveTheme = theme === 'system'
51-
? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
52-
: theme
53-
if (effectiveTheme === 'dark') {
54-
document.documentElement.classList.add('dark')
55-
} else {
56-
document.documentElement.classList.remove('dark')
57-
}
58-
$dispatch('theme-changed', theme)
59-
})
60-
"
61-
class="flex items-center gap-1 p-1 rounded-lg bg-gray-100 dark:bg-gray-800"
62-
>
63-
<button
64-
type="button"
65-
x-on:click="theme = 'light'"
66-
x-bind:class="{ 'bg-white dark:bg-gray-900 shadow-sm': theme === 'light' }"
67-
class="p-2 rounded-md transition-all"
68-
aria-label="Light mode"
69-
>
70-
<x-tabler-sun class="size-4" />
71-
</button>
72-
73-
<button
74-
type="button"
75-
x-on:click="theme = 'dark'"
76-
x-bind:class="{ 'bg-white dark:bg-gray-900 shadow-sm': theme === 'dark' }"
77-
class="p-2 rounded-md transition-all"
78-
aria-label="Dark mode"
79-
>
80-
<x-tabler-moon class="size-4" />
81-
</button>
82-
83-
<button
84-
type="button"
85-
x-on:click="theme = 'system'"
86-
x-bind:class="{ 'bg-white dark:bg-gray-900 shadow-sm': theme === 'system' }"
87-
class="p-2 rounded-md transition-all"
88-
aria-label="System theme"
89-
>
90-
<x-tabler-device-desktop class="size-4" />
91-
</button>
92-
</div>
93-
94-
@auth
95-
<x-filament::button
96-
href="{{ url('/admin') }}"
97-
icon="tabler-layout-dashboard"
98-
iconButton="true"
99-
tag="a"
100-
size="lg"
101-
>
102-
{{ __('general.admin') }}
103-
</x-filament::button>
104-
@else
105-
<x-filament::button
106-
href="{{ url('/login') }}"
107-
icon="tabler-login"
108-
tag="a"
109-
size="lg"
110-
>
111-
{{ __('auth.sign_in') }}
112-
</x-filament::button>
113-
@endauth
114-
</div>
115-
</header>
38+
@include('layouts.partials.header')
11639
11740
{{ $slot }}
41+
42+
@include('layouts.partials.footer')
11843
</main>
11944
12045
{{-- Scripts --}}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<footer>
2+
<div class="flex items-center justify-end">
3+
<div class="flex justify-center gap-x-2">
4+
@if (\App\Services\GitHub\Repository::updateAvailable())
5+
<x-filament::badge>
6+
{{ __('general.update_available') }}
7+
</x-filament::badge>
8+
@endif
9+
10+
<a href="https://github.com/alexjustesen/speedtest-tracker/releases" class="underline text-sm text-gray-700 hover:text-gray-300" target="_blank" rel="noopener noreferrer">
11+
{{ config('speedtest.build_version') }}
12+
</a>
13+
</div>
14+
</div>
15+
</footer>
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<header class="flex flex-col gap-4 sm:flex-row sm:justify-between sm:items-center">
2+
<div>
3+
<h1 class="text-2xl font-bold tracking-tight text-gray-950 dark:text-white sm:text-3xl">{{ $title ?? 'Page Title' }} - {{ config('app.name') }}</h1>
4+
</div>
5+
6+
<div class="flex items-center shrink-0 gap-4">
7+
<div
8+
x-data="{ theme: null }"
9+
x-init="
10+
theme = localStorage.getItem('theme') || 'system'
11+
$watch('theme', () => {
12+
localStorage.setItem('theme', theme)
13+
const effectiveTheme = theme === 'system'
14+
? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
15+
: theme
16+
if (effectiveTheme === 'dark') {
17+
document.documentElement.classList.add('dark')
18+
} else {
19+
document.documentElement.classList.remove('dark')
20+
}
21+
$dispatch('theme-changed', theme)
22+
})
23+
"
24+
class="flex items-center gap-1 p-1 rounded-lg bg-gray-100 dark:bg-gray-800"
25+
>
26+
<button
27+
type="button"
28+
x-on:click="theme = 'light'"
29+
x-bind:class="{ 'bg-white dark:bg-gray-900 shadow-sm': theme === 'light' }"
30+
class="p-2 rounded-md transition-all"
31+
aria-label="Light mode"
32+
>
33+
<x-tabler-sun class="size-4" />
34+
</button>
35+
36+
<button
37+
type="button"
38+
x-on:click="theme = 'dark'"
39+
x-bind:class="{ 'bg-white dark:bg-gray-900 shadow-sm': theme === 'dark' }"
40+
class="p-2 rounded-md transition-all"
41+
aria-label="Dark mode"
42+
>
43+
<x-tabler-moon class="size-4" />
44+
</button>
45+
46+
<button
47+
type="button"
48+
x-on:click="theme = 'system'"
49+
x-bind:class="{ 'bg-white dark:bg-gray-900 shadow-sm': theme === 'system' }"
50+
class="p-2 rounded-md transition-all"
51+
aria-label="System theme"
52+
>
53+
<x-tabler-device-desktop class="size-4" />
54+
</button>
55+
</div>
56+
57+
@auth
58+
<x-filament::button
59+
href="{{ url('/admin') }}"
60+
icon="tabler-layout-dashboard"
61+
iconButton="true"
62+
tag="a"
63+
size="lg"
64+
>
65+
{{ __('general.admin') }}
66+
</x-filament::button>
67+
@else
68+
<x-filament::button
69+
href="{{ url('/login') }}"
70+
icon="tabler-login"
71+
tag="a"
72+
size="lg"
73+
>
74+
{{ __('auth.sign_in') }}
75+
</x-filament::button>
76+
@endauth
77+
</div>
78+
</header>

0 commit comments

Comments
 (0)