diff --git a/app/Livewire/Settings/Advanced.php b/app/Livewire/Settings/Advanced.php index b011d2dc1..fb9c91263 100644 --- a/app/Livewire/Settings/Advanced.php +++ b/app/Livewire/Settings/Advanced.php @@ -38,6 +38,9 @@ class Advanced extends Component #[Validate('boolean')] public bool $disable_two_step_confirmation; + #[Validate('boolean')] + public bool $is_wire_navigate_enabled; + public function rules() { return [ @@ -50,6 +53,7 @@ public function rules() 'allowed_ips' => ['nullable', 'string', new ValidIpOrCidr], 'is_sponsorship_popup_enabled' => 'boolean', 'disable_two_step_confirmation' => 'boolean', + 'is_wire_navigate_enabled' => 'boolean', ]; } @@ -68,6 +72,7 @@ public function mount() $this->is_api_enabled = $this->settings->is_api_enabled; $this->disable_two_step_confirmation = $this->settings->disable_two_step_confirmation; $this->is_sponsorship_popup_enabled = $this->settings->is_sponsorship_popup_enabled; + $this->is_wire_navigate_enabled = $this->settings->is_wire_navigate_enabled ?? true; } public function submit() @@ -146,6 +151,7 @@ public function instantSave() $this->settings->allowed_ips = $this->allowed_ips; $this->settings->is_sponsorship_popup_enabled = $this->is_sponsorship_popup_enabled; $this->settings->disable_two_step_confirmation = $this->disable_two_step_confirmation; + $this->settings->is_wire_navigate_enabled = $this->is_wire_navigate_enabled; $this->settings->save(); $this->dispatch('success', 'Settings updated!'); } catch (\Exception $e) { diff --git a/app/Models/InstanceSettings.php b/app/Models/InstanceSettings.php index 62b576012..376242ca0 100644 --- a/app/Models/InstanceSettings.php +++ b/app/Models/InstanceSettings.php @@ -29,6 +29,7 @@ class InstanceSettings extends Model 'auto_update_frequency' => 'string', 'update_check_frequency' => 'string', 'sentinel_token' => 'encrypted', + 'is_wire_navigate_enabled' => 'boolean', ]; protected static function booted(): void diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 670716164..8b1c0c74a 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -2916,6 +2916,18 @@ function instanceSettings() return InstanceSettings::get(); } +function wireNavigate(): string +{ + try { + $settings = instanceSettings(); + + // Return wire:navigate.hover for SPA navigation with prefetching, or empty string if disabled + return ($settings->is_wire_navigate_enabled ?? true) ? 'wire:navigate.hover' : ''; + } catch (\Exception $e) { + return 'wire:navigate.hover'; + } +} + function getHelperVersion(): string { $settings = instanceSettings(); diff --git a/database/migrations/2025_12_17_000001_add_is_wire_navigate_enabled_to_instance_settings_table.php b/database/migrations/2025_12_17_000001_add_is_wire_navigate_enabled_to_instance_settings_table.php new file mode 100644 index 000000000..9c89dab93 --- /dev/null +++ b/database/migrations/2025_12_17_000001_add_is_wire_navigate_enabled_to_instance_settings_table.php @@ -0,0 +1,28 @@ +boolean('is_wire_navigate_enabled')->default(true); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('instance_settings', function (Blueprint $table) { + $table->dropColumn('is_wire_navigate_enabled'); + }); + } +}; diff --git a/resources/views/components/limit-reached.blade.php b/resources/views/components/limit-reached.blade.php index d53dae3f3..1fc26bbe0 100644 --- a/resources/views/components/limit-reached.blade.php +++ b/resources/views/components/limit-reached.blade.php @@ -1,6 +1,6 @@