Fix hosting profile dropdown and align menu with platform.
Deploy Ladill Hosting / deploy (push) Successful in 29s
Deploy Ladill Hosting / deploy (push) Successful in 29s
Add home.ladill.com helper, repair click-outside handling on topbar menus, and expand profile links on desktop and mobile. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -23,6 +23,13 @@ if (! function_exists('ladill_domains_url')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('ladill_home_url')) {
|
||||
function ladill_home_url(string $path = ''): string
|
||||
{
|
||||
return 'https://home.'.config('app.platform_domain').($path !== '' ? '/'.ltrim($path, '/') : '');
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('ladill_account_url')) {
|
||||
function ladill_account_url(string $path = ''): string
|
||||
{
|
||||
|
||||
@@ -47,8 +47,11 @@
|
||||
'profileName' => $navUser?->name ?? '',
|
||||
'profileSubtitle' => $navUser?->email ?? '',
|
||||
'profileMenuItems' => [
|
||||
['type' => 'link', 'label' => 'Profile', 'href' => $navAcct.'/profile'],
|
||||
['type' => 'link', 'label' => 'Account Settings', 'href' => $navAcct.'/account-settings'],
|
||||
['type' => 'link', 'label' => 'Home', 'href' => ladill_home_url()],
|
||||
['type' => 'link', 'label' => 'Profile', 'href' => ladill_account_url('profile')],
|
||||
['type' => 'link', 'label' => 'Account Settings', 'href' => ladill_account_url('account-settings')],
|
||||
['type' => 'link', 'label' => 'Dashboard', 'href' => route('email.dashboard')],
|
||||
['type' => 'link', 'label' => 'Billing', 'href' => ladill_account_url('billing')],
|
||||
['type' => 'logout', 'label' => 'Logout', 'action' => route('logout')],
|
||||
],
|
||||
'avatarUrl' => $navUser?->avatar_url,
|
||||
|
||||
@@ -46,8 +46,11 @@
|
||||
'profileName' => $navUser?->name ?? '',
|
||||
'profileSubtitle' => $navUser?->email ?? '',
|
||||
'profileMenuItems' => [
|
||||
['type' => 'link', 'label' => 'Profile', 'href' => $navAcct.'/profile'],
|
||||
['type' => 'link', 'label' => 'Account Settings', 'href' => $navAcct.'/account-settings'],
|
||||
['type' => 'link', 'label' => 'Home', 'href' => ladill_home_url()],
|
||||
['type' => 'link', 'label' => 'Profile', 'href' => ladill_account_url('profile')],
|
||||
['type' => 'link', 'label' => 'Account Settings', 'href' => ladill_account_url('account-settings')],
|
||||
['type' => 'link', 'label' => 'Dashboard', 'href' => route('hosting.dashboard')],
|
||||
['type' => 'link', 'label' => 'Billing', 'href' => ladill_account_url('billing')],
|
||||
['type' => 'logout', 'label' => 'Logout', 'action' => route('logout')],
|
||||
],
|
||||
'avatarUrl' => $navUser?->avatar_url,
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
@php $u = auth()->user(); $acct = 'https://'.config('app.account_domain'); @endphp
|
||||
@php
|
||||
$u = auth()->user();
|
||||
$acct = ladill_account_url();
|
||||
$home = ladill_home_url();
|
||||
@endphp
|
||||
<header class="flex items-center justify-between h-16 border-b border-slate-200 bg-white px-6">
|
||||
<div class="flex items-center gap-3 flex-1 min-w-0">
|
||||
<button @click="sidebarOpen = !sidebarOpen" class="lg:hidden shrink-0 text-slate-500 hover:text-slate-700">
|
||||
@@ -43,12 +47,12 @@
|
||||
|
||||
{{-- Account switcher (only when the user belongs to more than one account) --}}
|
||||
@if (isset($accessibleAccounts) && $accessibleAccounts->count() > 1)
|
||||
<div x-data="{ open: false }" class="relative hidden lg:block">
|
||||
<div x-data="{ open: false }" @click.outside="open = false" class="relative hidden lg:block">
|
||||
<button @click="open = !open" class="inline-flex items-center gap-1.5 rounded-full border border-slate-200 px-3 py-2 text-sm text-slate-700 hover:bg-slate-50">
|
||||
<span class="max-w-[120px] truncate">{{ $actingAccount->name ?? $actingAccount->email }}</span>
|
||||
<svg class="h-4 w-4 text-slate-400" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="m19 9-7 7-7-7"/></svg>
|
||||
</button>
|
||||
<div x-show="open" x-cloak @click.outside="open = false" class="absolute right-0 z-30 mt-2 w-60 rounded-xl border border-slate-200 bg-white p-1 shadow-lg">
|
||||
<div x-show="open" x-cloak class="absolute right-0 z-30 mt-2 w-60 rounded-xl border border-slate-200 bg-white p-1 shadow-lg">
|
||||
<p class="px-3 py-1.5 text-[10px] font-bold uppercase tracking-widest text-slate-400">Switch account</p>
|
||||
@foreach ($accessibleAccounts as $acctOption)
|
||||
<form method="POST" action="{{ route('account.switch') }}">
|
||||
@@ -65,8 +69,8 @@
|
||||
@endif
|
||||
|
||||
{{-- Profile / avatar menu (desktop; mobile uses bottom nav) --}}
|
||||
<div class="relative hidden lg:block" x-data="{ open: false }">
|
||||
<button type="button" @click="open = !open" class="inline-flex items-center gap-1.5 rounded-full border border-slate-200 p-1 pr-2 text-slate-700 hover:bg-slate-50">
|
||||
<div class="relative hidden lg:block" x-data="{ profileOpen: false }" @click.outside="profileOpen = false">
|
||||
<button type="button" @click="profileOpen = !profileOpen" class="inline-flex items-center gap-1.5 rounded-full border border-slate-200 p-1 pr-2 text-slate-700 hover:bg-slate-50">
|
||||
@if ($u?->avatar_url)
|
||||
<img src="{{ $u->avatar_url }}" alt="" class="h-8 w-8 rounded-full object-cover ring-1 ring-slate-200">
|
||||
@else
|
||||
@@ -74,9 +78,13 @@
|
||||
@endif
|
||||
<svg class="h-4 w-4 text-slate-500" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="m19 9-7 7-7-7"/></svg>
|
||||
</button>
|
||||
<div x-show="open" x-cloak @click.outside="open = false" class="absolute right-0 z-20 mt-2 w-48 rounded-xl border border-slate-200 bg-white p-1 shadow-lg">
|
||||
<div x-show="profileOpen" x-cloak x-transition class="absolute right-0 z-50 mt-2 w-52 rounded-xl border border-slate-200 bg-white p-1 shadow-lg">
|
||||
<a href="{{ $home }}" class="block rounded-lg px-3 py-2 text-sm text-slate-700 hover:bg-slate-100">Home</a>
|
||||
<a href="{{ $acct }}/profile" class="block rounded-lg px-3 py-2 text-sm text-slate-700 hover:bg-slate-100">Profile</a>
|
||||
<a href="{{ $acct }}/account-settings" class="block rounded-lg px-3 py-2 text-sm text-slate-700 hover:bg-slate-100">Account Settings</a>
|
||||
<a href="{{ route('hosting.dashboard') }}" class="block rounded-lg px-3 py-2 text-sm text-slate-700 hover:bg-slate-100">Dashboard</a>
|
||||
<a href="{{ ladill_account_url('billing') }}" class="block rounded-lg px-3 py-2 text-sm text-slate-700 hover:bg-slate-100">Billing</a>
|
||||
<div class="my-1 border-t border-slate-100"></div>
|
||||
<form method="POST" action="{{ route('logout') }}">@csrf
|
||||
<button type="submit" class="w-full rounded-lg px-3 py-2 text-left text-sm text-rose-600 hover:bg-rose-50">Logout</button>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user