diff --git a/resources/views/components/helper.blade.php b/resources/views/components/helper.blade.php index 72ac38d78..6b90b5929 100644 --- a/resources/views/components/helper.blade.php +++ b/resources/views/components/helper.blade.php @@ -73,8 +73,10 @@ const viewportBottom = viewportTop + viewportHeight; const availableWidth = Math.max(0, viewportWidth - padding * 2); const availableHeight = Math.max(0, viewportHeight - padding * 2); + const maxPopupWidth = 320; + const popupWidth = Math.min(maxPopupWidth, availableWidth); - this.style = `max-width: ${availableWidth}px; max-height: ${availableHeight}px; overflow-y: auto;`; + this.style = `max-width: ${popupWidth}px; max-height: ${availableHeight}px; overflow-y: auto;`; const triggerRect = trigger.getBoundingClientRect(); const popupRect = popup.getBoundingClientRect(); @@ -120,7 +122,7 @@ x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" :style="style" - class="info-helper-popup fixed z-[9999] w-max max-w-[min(20rem,calc(100vw-2rem))]" + class="info-helper-popup fixed z-[9999] w-max max-w-[min(20rem,calc(100vw-2rem))] whitespace-normal" @mouseenter="cancelHide()" @mouseleave="hide()" @focusout="closeWhenFocusLeaves()" @click.stop>
{!! $helper !!} diff --git a/resources/views/livewire/project/shared/destination.blade.php b/resources/views/livewire/project/shared/destination.blade.php index d8c74a516..720e85bdc 100644 --- a/resources/views/livewire/project/shared/destination.blade.php +++ b/resources/views/livewire/project/shared/destination.blade.php @@ -1,14 +1,6 @@
@if ($resource->getMorphClass() === 'App\Models\Application') @php - $primaryStatus = str($resource->realStatus()); - $primaryStatusType = match (true) { - $primaryStatus->startsWith('running') => 'success', - $primaryStatus->startsWith('exited') => 'error', - $primaryStatus->startsWith(['starting', 'restarting']) => 'warning', - default => 'neutral', - }; - $primaryStatusLabel = $primaryStatus->before(':')->headline()->value() ?: 'Unknown'; $additionalDestinations = $resource->additional_networks; $hasAdditionalDestinations = $additionalDestinations->isNotEmpty(); @endphp @@ -41,21 +33,13 @@
- @if ($primaryStatus->startsWith('running')) - - @elseif ($primaryStatus->startsWith(['starting', 'restarting'])) - - @elseif ($primaryStatus->startsWith('exited')) - - @else - - @endif + @if ($hasAdditionalDestinations) Deploy - @if ($primaryStatus->startsWith('running')) + @if (str($resource->status)->startsWith('running')) Stop diff --git a/tests/Feature/ApplicationDestinationStatusBadgeTest.php b/tests/Feature/ApplicationDestinationStatusBadgeTest.php new file mode 100644 index 000000000..11eeba515 --- /dev/null +++ b/tests/Feature/ApplicationDestinationStatusBadgeTest.php @@ -0,0 +1,10 @@ +before('@else')->value(); + + expect($applicationSection) + ->toContain('') + ->not->toContain('toContain('window.visualViewport') ->toContain('viewport?.offsetLeft') ->toContain('viewport?.offsetTop') - ->toContain('max-width: ${availableWidth}px;') + ->toContain('max-width: ${popupWidth}px;') ->toContain('max-height: ${availableHeight}px;') ->toContain('overflow-y: auto;'); }); +test('helper popup width is capped while allowing content to wrap vertically', function () { + $helper = file_get_contents(resource_path('views/components/helper.blade.php')); + + expect($helper) + ->toContain('const maxPopupWidth = 320;') + ->toContain('const popupWidth = Math.min(maxPopupWidth, availableWidth);') + ->toContain('max-width: ${popupWidth}px;') + ->toContain('whitespace-normal'); +}); + test('helper popup supports focus dismissal and tooltip aria relationships', function () { $helper = file_get_contents(resource_path('views/components/helper.blade.php'));