From d7524a743d3a78a12bac4ce51baab25043c845ec Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Wed, 3 Jun 2026 12:54:50 +0200 Subject: [PATCH] fix(env-vars): show single empty state for searches Move the environment variable search field above the production section and hide production and preview headings when a search has no results. --- .../Shared/EnvironmentVariable/All.php | 16 ++++ .../shared/environment-variable/all.blade.php | 94 ++++++++++--------- ...ronmentVariableMultilineToggleViewTest.php | 16 ++++ 3 files changed, 80 insertions(+), 46 deletions(-) diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Livewire/Project/Shared/EnvironmentVariable/All.php index 65f0bd437..2a1a47b4d 100644 --- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php +++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php @@ -45,6 +45,7 @@ public function updatedSearch() unset($this->environmentVariablesPreview); unset($this->hardcodedEnvironmentVariables); unset($this->hardcodedEnvironmentVariablesPreview); + unset($this->hasEnvironmentVariables); } public function mount() @@ -111,6 +112,19 @@ private function searchTerm(): string return trim($this->search); } + public function getHasEnvironmentVariablesProperty(): bool + { + return $this->environmentVariables->isNotEmpty() || + $this->environmentVariablesPreview->isNotEmpty() || + $this->hardcodedEnvironmentVariables->isNotEmpty() || + $this->hardcodedEnvironmentVariablesPreview->isNotEmpty(); + } + + public function getIsSearchActiveProperty(): bool + { + return $this->searchTerm() !== ''; + } + public function getHardcodedEnvironmentVariablesProperty() { return $this->getHardcodedVariables(false); @@ -313,6 +327,7 @@ private function handleSingleSubmit($data) unset($this->environmentVariablesPreview); unset($this->hardcodedEnvironmentVariables); unset($this->hardcodedEnvironmentVariablesPreview); + unset($this->hasEnvironmentVariables); $this->dispatch('success', 'Environment variable added.'); } @@ -446,6 +461,7 @@ public function refreshEnvs() unset($this->environmentVariablesPreview); unset($this->hardcodedEnvironmentVariables); unset($this->hardcodedEnvironmentVariablesPreview); + unset($this->hasEnvironmentVariables); $this->getDevView(); } } diff --git a/resources/views/livewire/project/shared/environment-variable/all.blade.php b/resources/views/livewire/project/shared/environment-variable/all.blade.php index 77ac92ffe..f49765286 100644 --- a/resources/views/livewire/project/shared/environment-variable/all.blade.php +++ b/resources/views/livewire/project/shared/environment-variable/all.blade.php @@ -43,64 +43,66 @@ @endif @if ($view === 'normal') -