mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
Refactor deployment indicator to use server-side route detection
Replace client-side JavaScript URL checking with Laravel's routeIs() for determining when to reduce indicator opacity. This simplifies the code and uses route names as the source of truth. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,12 @@ class DeploymentsIndicator extends Component
|
|||||||
return $this->deployments->count();
|
return $this->deployments->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Computed]
|
||||||
|
public function shouldReduceOpacity(): bool
|
||||||
|
{
|
||||||
|
return request()->routeIs('project.application.deployment.*');
|
||||||
|
}
|
||||||
|
|
||||||
public function toggleExpanded()
|
public function toggleExpanded()
|
||||||
{
|
{
|
||||||
$this->expanded = ! $this->expanded;
|
$this->expanded = ! $this->expanded;
|
||||||
|
|||||||
@@ -1,17 +1,10 @@
|
|||||||
<div wire:poll.3000ms x-data="{
|
<div wire:poll.3000ms x-data="{
|
||||||
expanded: @entangle('expanded'),
|
expanded: @entangle('expanded'),
|
||||||
isDeploymentPage: false,
|
reduceOpacity: @js($this->shouldReduceOpacity)
|
||||||
checkPage() {
|
|
||||||
this.isDeploymentPage = window.location.pathname.includes('/deployment');
|
|
||||||
},
|
|
||||||
init() {
|
|
||||||
this.checkPage();
|
|
||||||
document.addEventListener('livewire:navigated', () => this.checkPage());
|
|
||||||
}
|
|
||||||
}" class="fixed bottom-0 z-60 mb-4 left-0 lg:left-56 ml-4">
|
}" class="fixed bottom-0 z-60 mb-4 left-0 lg:left-56 ml-4">
|
||||||
@if ($this->deploymentCount > 0)
|
@if ($this->deploymentCount > 0)
|
||||||
<div class="relative transition-opacity duration-200"
|
<div class="relative transition-opacity duration-200"
|
||||||
:class="{ 'opacity-100': expanded || !isDeploymentPage, 'opacity-60 hover:opacity-100': isDeploymentPage && !expanded }">
|
:class="{ 'opacity-100': expanded || !reduceOpacity, 'opacity-60 hover:opacity-100': reduceOpacity && !expanded }">
|
||||||
<!-- Indicator Button -->
|
<!-- Indicator Button -->
|
||||||
<button @click="expanded = !expanded"
|
<button @click="expanded = !expanded"
|
||||||
class="flex items-center gap-2 px-4 py-2 rounded-lg shadow-lg transition-all duration-200 dark:bg-coolgray-100 bg-white dark:border dark:border-coolgray-200 hover:shadow-xl">
|
class="flex items-center gap-2 px-4 py-2 rounded-lg shadow-lg transition-all duration-200 dark:bg-coolgray-100 bg-white dark:border dark:border-coolgray-200 hover:shadow-xl">
|
||||||
|
|||||||
Reference in New Issue
Block a user