Remove dark mode and fix boot splash HTML breakage.
Deploy Ladill Frontdesk / deploy (push) Successful in 25s
Deploy Ladill Frontdesk / deploy (push) Successful in 25s
Drop dark-mode toggle, fd-theme storage, and Tailwind dark variant to match sibling Ladill apps. Include boot splash in app-layout instead of regex middleware that truncated the body tag on Alpine x-init. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,46 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Middleware;
|
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Facades\View;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Injects a branded boot splash (Ladill Mail style) into authenticated HTML
|
|
||||||
* pages. The splash shows once per browser session while the app loads, then
|
|
||||||
* fades out — masking the client-side boot so the app feels instant.
|
|
||||||
*/
|
|
||||||
class InjectBootSplash
|
|
||||||
{
|
|
||||||
public function handle(Request $request, Closure $next): Response
|
|
||||||
{
|
|
||||||
$response = $next($request);
|
|
||||||
|
|
||||||
if (! $request->isMethod('GET') || ! Auth::check()) {
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! str_contains((string) $response->headers->get('Content-Type', ''), 'text/html')) {
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
$content = $response->getContent();
|
|
||||||
if (! is_string($content)
|
|
||||||
|| stripos($content, '<body') === false
|
|
||||||
|| str_contains($content, 'id="ladill-boot"')) {
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
$splash = View::make('partials.boot-splash')->render();
|
|
||||||
$content = preg_replace_callback('/<body\b[^>]*>/i', fn ($m) => $m[0].$splash, $content, 1);
|
|
||||||
|
|
||||||
if (is_string($content)) {
|
|
||||||
$response->setContent($content);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -21,7 +21,6 @@ return Application::configure(basePath: dirname(__DIR__))
|
|||||||
'redirect' => $request->fullUrl(),
|
'redirect' => $request->fullUrl(),
|
||||||
]));
|
]));
|
||||||
$middleware->web(append: [
|
$middleware->web(append: [
|
||||||
\App\Http\Middleware\InjectBootSplash::class,
|
|
||||||
SetActingAccount::class,
|
SetActingAccount::class,
|
||||||
]);
|
]);
|
||||||
$middleware->alias([
|
$middleware->alias([
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
@import 'tailwindcss';
|
@import 'tailwindcss';
|
||||||
@plugin '@tailwindcss/forms';
|
@plugin '@tailwindcss/forms';
|
||||||
@custom-variant dark (&:where(.dark, .dark *));
|
|
||||||
|
|
||||||
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
|
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
|
||||||
@source '../../storage/framework/views/*.php';
|
@source '../../storage/framework/views/*.php';
|
||||||
|
|||||||
@@ -11,9 +11,8 @@
|
|||||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600,700&display=swap" rel="stylesheet" />
|
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600,700&display=swap" rel="stylesheet" />
|
||||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||||
</head>
|
</head>
|
||||||
<body class="h-full font-sans antialiased bg-slate-100 dark:bg-slate-950 text-slate-900 dark:text-slate-100"
|
<body class="h-full font-sans antialiased bg-slate-100 text-slate-900" x-data="{ sidebarOpen: false }">
|
||||||
x-data="{ sidebarOpen: false, dark: localStorage.getItem('fd-theme') === 'dark' }"
|
@include('partials.boot-splash')
|
||||||
x-init="$watch('dark', v => { localStorage.setItem('fd-theme', v ? 'dark' : 'light'); document.documentElement.classList.toggle('dark', v) }); document.documentElement.classList.toggle('dark', dark)">
|
|
||||||
<div class="min-h-screen max-lg:min-h-dvh">
|
<div class="min-h-screen max-lg:min-h-dvh">
|
||||||
<div x-show="sidebarOpen" x-cloak class="fixed inset-0 z-30 bg-black/50 lg:hidden" @click="sidebarOpen = false"></div>
|
<div x-show="sidebarOpen" x-cloak class="fixed inset-0 z-30 bg-black/50 lg:hidden" @click="sidebarOpen = false"></div>
|
||||||
<aside x-data="{ ready: false }" x-init="requestAnimationFrame(() => ready = true)"
|
<aside x-data="{ ready: false }" x-init="requestAnimationFrame(() => ready = true)"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
$initials = collect(explode(' ', trim((string) $user?->name)))
|
$initials = collect(explode(' ', trim((string) $user?->name)))
|
||||||
->filter()->take(2)->map(fn ($p) => strtoupper(substr($p, 0, 1)))->implode('');
|
->filter()->take(2)->map(fn ($p) => strtoupper(substr($p, 0, 1)))->implode('');
|
||||||
@endphp
|
@endphp
|
||||||
<header class="flex items-center justify-between h-16 border-b border-slate-200 bg-white dark:border-slate-800 dark:bg-slate-900 px-4 sm:px-6">
|
<header class="flex items-center justify-between h-16 border-b border-slate-200 bg-white px-4 sm:px-6">
|
||||||
<div class="flex flex-1 items-center gap-3 min-w-0">
|
<div class="flex flex-1 items-center gap-3 min-w-0">
|
||||||
<button @click="sidebarOpen = !sidebarOpen" class="lg:hidden shrink-0 text-slate-500 hover:text-slate-700" aria-label="Menu">
|
<button @click="sidebarOpen = !sidebarOpen" class="lg:hidden shrink-0 text-slate-500 hover:text-slate-700" aria-label="Menu">
|
||||||
<svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/></svg>
|
<svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/></svg>
|
||||||
@@ -26,10 +26,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
<button type="button" @click="dark = !dark" class="hidden lg:inline-flex text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200" aria-label="Toggle dark mode">
|
|
||||||
<svg x-show="!dark" class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79Z"/></svg>
|
|
||||||
<svg x-show="dark" x-cloak class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m8.66-9h-1M4.34 12h-1M18.364 5.636l-.707.707M6.343 17.657l-.707.707M18.364 18.364l-.707-.707M6.343 6.343l-.707-.707M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z"/></svg>
|
|
||||||
</button>
|
|
||||||
@includeIf('partials.topbar-widgets-prepend')
|
@includeIf('partials.topbar-widgets-prepend')
|
||||||
@include('partials.topbar-desktop-widgets', ['user' => $user, 'showUser' => true])
|
@include('partials.topbar-desktop-widgets', ['user' => $user, 'showUser' => true])
|
||||||
@includeIf('partials.topbar-widgets-append')
|
@includeIf('partials.topbar-widgets-append')
|
||||||
|
|||||||
@@ -122,12 +122,4 @@ class FrontdeskPhase11Test extends TestCase
|
|||||||
->assertOk()
|
->assertOk()
|
||||||
->assertJsonPath('status', 'already_synced');
|
->assertJsonPath('status', 'already_synced');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_app_layout_supports_dark_mode_toggle_markup(): void
|
|
||||||
{
|
|
||||||
$this->actingAs($this->user)
|
|
||||||
->get(route('frontdesk.dashboard'))
|
|
||||||
->assertOk()
|
|
||||||
->assertSee('Toggle dark mode', false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user