Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(ui): fix subscription access and mobile menu positioning

Andras Bacsaibb45668a804d
diff --git a/resources/css/app.css b/resources/css/app.css
index ccaf7181ee..0d80bf0b43 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -1959,6 +1959,19 @@ html[data-theme="custom"] textarea:disabled {
transform: translate(-50%, -50%) !important;
z-index: 9999 !important;
}
+
+ /* The mobile top bar's backdrop filter makes it the containing block for
+ fixed descendants. Keep this menu anchored below its trigger instead
+ of centering it within the short top bar. */
+ .listbox-panel.top-user-menu-panel {
+ position: absolute !important;
+ top: calc(100% + 0.25rem) !important;
+ right: 0 !important;
+ left: auto !important;
+ max-height: calc(100dvh - 4.5rem) !important;
+ overflow-y: auto !important;
+ transform: none !important;
+ }
}
.listbox-option {
diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php
index 1452445cee..0be0fd0aa4 100644
--- a/resources/views/components/navbar.blade.php
+++ b/resources/views/components/navbar.blade.php
@@ -167,6 +167,16 @@
<span class="menu-item-label" :class="collapsed && 'lg:hidden'">Keys & Tokens</span>
</a>
</li>
+ @if (isCloud() && auth()->user()->isAdmin())
+ <li>
+ <a title="Subscription" {{ wireNavigate() }}
+ class="{{ request()->is('subscription*') ? 'menu-item-active menu-item' : 'menu-item' }}"
+ :class="collapsed && 'lg:justify-center lg:px-0'" href="{{ route('subscription.show') }}">
+ <x-reicon name="subscription" class="menu-item-icon" />
+ <span class="menu-item-label" :class="collapsed && 'lg:hidden'">Subscription</span>
+ </a>
+ </li>
+ @endif
<li>
<a title="Tags" {{ wireNavigate() }}
class="{{ request()->is('tags*') ? 'menu-item-active menu-item' : 'menu-item' }}"
diff --git a/resources/views/components/top-user-menu.blade.php b/resources/views/components/top-user-menu.blade.php
index c64115fa37..6c61e417f5 100644
--- a/resources/views/components/top-user-menu.blade.php
+++ b/resources/views/components/top-user-menu.blade.php
@@ -82,7 +82,7 @@
</button>
<div x-show="open" x-cloak @class([
- 'listbox-panel z-[90]! max-h-none! w-52! min-w-0! overflow-visible! animate-in fade-in zoom-in-95 duration-150',
+ 'top-user-menu-panel listbox-panel z-[90]! max-h-none! w-52! min-w-0! overflow-visible! animate-in fade-in zoom-in-95 duration-150',
'right-0! left-auto!' => ! $sidebar,
'bottom-full! left-0! right-auto! top-auto! mb-1!' => $sidebar,
'origin-bottom-left' => $sidebar,
diff --git a/resources/views/livewire/subscription/actions.blade.php b/resources/views/livewire/subscription/actions.blade.php
index 319beaddee..18a093f6f0 100644
--- a/resources/views/livewire/subscription/actions.blade.php
+++ b/resources/views/livewire/subscription/actions.blade.php
@@ -84,7 +84,7 @@
@endif
{{-- Adjust Server Limit Modal --}}
- <template x-teleport="body">
+ <template x-teleport="body" wire:ignore>
<div x-show="showModal"
class="fixed top-0 left-0 z-99 flex items-center justify-center w-screen h-screen p-4" x-cloak>
<div x-show="showModal" class="absolute inset-0 w-full h-full bg-black/20 backdrop-blur-xs"
diff --git a/tests/Feature/Subscription/SubscriptionPricingPageTest.php b/tests/Feature/Subscription/SubscriptionPricingPageTest.php
index a7ed01e2dc..d89dbbcb01 100644
--- a/tests/Feature/Subscription/SubscriptionPricingPageTest.php
+++ b/tests/Feature/Subscription/SubscriptionPricingPageTest.php
@@ -62,6 +62,33 @@ test('unsubscribed cloud sidebar does not expose global search', function () {
$response->assertDontSee('>Search</span>', false);
});
+test('subscribed cloud sidebar shows subscription link for team admins', function () {
+ Subscription::create([
+ 'team_id' => $this->team->id,
+ 'stripe_subscription_id' => 'sub_active',
+ 'stripe_customer_id' => 'cus_active',
+ 'stripe_invoice_paid' => true,
+ 'stripe_plan_id' => 'price_active',
+ 'stripe_cancel_at_period_end' => false,
+ 'stripe_past_due' => false,
+ ]);
+
+ Once::flush();
+ session(['currentTeam' => $this->team->fresh()]);
+
+ $html = view('components.navbar')->render();
+
+ expect($html)
+ ->toContain('title="Subscription"')
+ ->toContain(route('subscription.show'));
+});
+
+test('subscription adjustment modal is protected from livewire morphing', function () {
+ $view = file_get_contents(resource_path('views/livewire/subscription/actions.blade.php'));
+
+ expect($view)->toContain('<template x-teleport="body" wire:ignore>');
+});
+
test('subscription pricing page does not render a single-item pricing tab strip', function () {
$html = view('components.dashboard.navbar', [
'section' => 'subscription',
diff --git a/tests/Feature/TopUserMenuTest.php b/tests/Feature/TopUserMenuTest.php
index 95d5d92028..bc817bb858 100644
--- a/tests/Feature/TopUserMenuTest.php
+++ b/tests/Feature/TopUserMenuTest.php
@@ -31,6 +31,18 @@ it('animates the dropdown panel when the user menu opens', function () {
expect($stylesheet)->toContain('@import "tw-animate-css";');
});
+it('positions the account menu below the mobile trigger', function () {
+ $menu = file_get_contents(resource_path('views/components/top-user-menu.blade.php'));
+ $stylesheet = file_get_contents(resource_path('css/app.css'));
+
+ expect($menu)->toContain('top-user-menu-panel');
+ expect($stylesheet)
+ ->toContain('.listbox-panel.top-user-menu-panel')
+ ->toContain('top: calc(100% + 0.25rem) !important;')
+ ->toContain('transform: none !important;')
+ ->toContain('max-height: calc(100dvh - 4.5rem) !important;');
+});
+
it('changes appearance from a submenu instead of navigating to a separate page', function () {
$menu = file_get_contents(resource_path('views/components/top-user-menu.blade.php'));