diff --git a/packages/forms/resources/views/components/wizard.blade.php b/packages/forms/resources/views/components/wizard.blade.php index 48204ea6af4..9b94a3b57eb 100644 --- a/packages/forms/resources/views/components/wizard.blade.php +++ b/packages/forms/resources/views/components/wizard.blade.php @@ -281,11 +281,13 @@ class="h-full w-full text-gray-200 dark:text-white/5 rtl:rotate-180" isDisabled()) - x-on:click="$wire.dispatchFormEvent( - 'wizard::nextStep', - '{{ $statePath }}', - getStepIndex(step), - )" + x-on:click=" + $wire.dispatchFormEvent( + 'wizard::nextStep', + '{{ $statePath }}', + getStepIndex(step), + ) + " @endif x-show="! isLastStep()" > diff --git a/packages/panels/resources/views/components/layout/simple.blade.php b/packages/panels/resources/views/components/layout/simple.blade.php index 1d0a0eb85fd..f5dafcfffb9 100644 --- a/packages/panels/resources/views/components/layout/simple.blade.php +++ b/packages/panels/resources/views/components/layout/simple.blade.php @@ -15,7 +15,9 @@ class="absolute end-0 top-0 flex h-16 items-center gap-x-4 pe-4 md:pe-6 lg:pe-8" > @if (filament()->hasDatabaseNotifications()) - @livewire(Filament\Livewire\DatabaseNotifications::class, ['lazy' => true]) + @livewire(Filament\Livewire\DatabaseNotifications::class, [ + 'lazy' => filament()->hasLazyLoadedDatabaseNotifications() + ]) @endif diff --git a/packages/panels/resources/views/components/page/sub-navigation/sidebar.blade.php b/packages/panels/resources/views/components/page/sub-navigation/sidebar.blade.php index 61107e3e60f..51c65e44b99 100644 --- a/packages/panels/resources/views/components/page/sub-navigation/sidebar.blade.php +++ b/packages/panels/resources/views/components/page/sub-navigation/sidebar.blade.php @@ -2,7 +2,9 @@ 'navigation', ]) -
class(['fi-page-sub-navigation-sidebar-ctn hidden w-72 flex-col md:flex']) }}> +
class(['fi-page-sub-navigation-sidebar-ctn hidden w-72 flex-col md:flex']) }} +> {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_SIDEBAR_BEFORE, scopes: $this->getRenderHookScopes()) }}
    auth()->check()) @if (filament()->hasDatabaseNotifications()) - @livewire(Filament\Livewire\DatabaseNotifications::class, ['lazy' => true]) + @livewire(Filament\Livewire\DatabaseNotifications::class, [ + 'lazy' => filament()->hasLazyLoadedDatabaseNotifications(), + ]) @endif diff --git a/packages/panels/src/Facades/Filament.php b/packages/panels/src/Facades/Filament.php index 0202e5e582b..7c6d88e5747 100644 --- a/packages/panels/src/Facades/Filament.php +++ b/packages/panels/src/Facades/Filament.php @@ -100,6 +100,7 @@ * @method static bool hasDarkMode() * @method static bool hasDarkModeForced() * @method static bool hasDatabaseNotifications() + * @method static bool hasLazyLoadedDatabaseNotifications() * @method static bool hasEmailVerification() * @method static bool hasLogin() * @method static bool hasNavigation() diff --git a/packages/panels/src/FilamentManager.php b/packages/panels/src/FilamentManager.php index db97c983c0f..2453fd9f56f 100644 --- a/packages/panels/src/FilamentManager.php +++ b/packages/panels/src/FilamentManager.php @@ -566,6 +566,11 @@ public function hasDatabaseNotifications(): bool return $this->getCurrentPanel()->hasDatabaseNotifications(); } + public function hasLazyLoadedDatabaseNotifications(): bool + { + return $this->getCurrentPanel()->hasLazyLoadedDatabaseNotifications(); + } + public function hasEmailVerification(): bool { return $this->getCurrentPanel()->hasEmailVerification(); diff --git a/packages/panels/src/Panel/Concerns/HasNotifications.php b/packages/panels/src/Panel/Concerns/HasNotifications.php index a8686661707..43ea40f5d22 100644 --- a/packages/panels/src/Panel/Concerns/HasNotifications.php +++ b/packages/panels/src/Panel/Concerns/HasNotifications.php @@ -8,11 +8,21 @@ trait HasNotifications { protected bool | Closure $hasDatabaseNotifications = false; + protected bool | Closure $hasLazyLoadedDatabaseNotifications = true; + protected string | Closure | null $databaseNotificationsPolling = '30s'; - public function databaseNotifications(bool | Closure $condition = true): static + public function databaseNotifications(bool | Closure $condition = true, bool | Closure $isLazy = true): static { $this->hasDatabaseNotifications = $condition; + $this->lazyLoadedDatabaseNotifications($isLazy); + + return $this; + } + + public function lazyLoadedDatabaseNotifications(bool | Closure $condition = true): static + { + $this->hasLazyLoadedDatabaseNotifications = $condition; return $this; } @@ -29,6 +39,11 @@ public function hasDatabaseNotifications(): bool return (bool) $this->evaluate($this->hasDatabaseNotifications); } + public function hasLazyLoadedDatabaseNotifications(): bool + { + return (bool) $this->evaluate($this->hasLazyLoadedDatabaseNotifications); + } + public function getDatabaseNotificationsPollingInterval(): ?string { return $this->evaluate($this->databaseNotificationsPolling);