From 4ba2e86cf5e381442af172000e3d18930c262553 Mon Sep 17 00:00:00 2001 From: isaacclad Date: Tue, 23 Jun 2026 18:16:40 +0000 Subject: [PATCH] Standardize desktop topbar widgets to match CRM layout. Co-authored-by: Cursor --- .../topbar-account-switcher.blade.php | 24 +++++++++ .../partials/topbar-desktop-widgets.blade.php | 44 +++++++++++++++ resources/views/partials/topbar.blade.php | 54 +++---------------- 3 files changed, 74 insertions(+), 48 deletions(-) create mode 100644 resources/views/partials/topbar-account-switcher.blade.php create mode 100644 resources/views/partials/topbar-desktop-widgets.blade.php diff --git a/resources/views/partials/topbar-account-switcher.blade.php b/resources/views/partials/topbar-account-switcher.blade.php new file mode 100644 index 0000000..dfcaf02 --- /dev/null +++ b/resources/views/partials/topbar-account-switcher.blade.php @@ -0,0 +1,24 @@ +{{-- Account switcher (desktop) — only when the user belongs to more than one account. --}} +@if (isset($accessibleAccounts) && $accessibleAccounts->count() > 1) + +@endif diff --git a/resources/views/partials/topbar-desktop-widgets.blade.php b/resources/views/partials/topbar-desktop-widgets.blade.php new file mode 100644 index 0000000..bb1eca5 --- /dev/null +++ b/resources/views/partials/topbar-desktop-widgets.blade.php @@ -0,0 +1,44 @@ +{{-- + Standard desktop top-right widgets (CRM / Invoice layout): + Afia → notifications → launcher → divider → avatar dropdown. +--}} +@php + $topbarUser = $user ?? auth()->user(); + $initials = collect(explode(' ', trim((string) $topbarUser?->name))) + ->filter()->take(2)->map(fn ($p) => strtoupper(substr($p, 0, 1)))->implode(''); + $avatarUrl = $topbarUser && method_exists($topbarUser, 'avatarUrl') + ? $topbarUser->avatarUrl() + : ($topbarUser?->avatar_url ?? null); + $showUserHeader = $showUser ?? true; +@endphp + +@includeIf('partials.afia-button', ['compact' => true]) + +@includeIf('partials.notification-dropdown') + +@include('partials.launcher') + +@includeIf('partials.topbar-widgets-mid') + + + +
+ + +
+ @include('partials.user-profile-menu', [ + 'items' => \App\Support\UserProfileMenu::items($topbarUser), + 'user' => $topbarUser, + 'showUser' => $showUserHeader, + ]) +
+
diff --git a/resources/views/partials/topbar.blade.php b/resources/views/partials/topbar.blade.php index c54b526..867afe8 100644 --- a/resources/views/partials/topbar.blade.php +++ b/resources/views/partials/topbar.blade.php @@ -39,57 +39,15 @@ -
+
@auth - @include('partials.notification-dropdown') - - - - {{-- Account switcher (only when the user belongs to more than one account) --}} - @if (isset($accessibleAccounts) && $accessibleAccounts->count() > 1) - - @endif - - {{-- Profile / avatar menu (desktop; mobile uses bottom nav) --}} - - @include('partials.afia-button', ['compact' => true]) + @includeIf('partials.topbar-account-switcher') + @includeIf('partials.topbar-widgets-prepend') + @include('partials.topbar-desktop-widgets', ['user' => $user ?? $u ?? auth()->user(), 'showUser' => true]) + @includeIf('partials.topbar-widgets-append') @else Sign in + @include('partials.launcher') @endauth - - @include('partials.launcher')