From 40981be25290310d38abba64b6de217a6fd1e56f Mon Sep 17 00:00:00 2001 From: isaacclad Date: Sun, 7 Jun 2026 16:30:16 +0000 Subject: [PATCH] Add mobile topbar titles and show Afia on all mobile headers. Route-based subtitle and page titles replace plain app labels in mobile topbars, and the Afia AI button is visible on mobile across topbars and mobile-page-header screens. Co-authored-by: Cursor --- app/Providers/AppServiceProvider.php | 6 +++++ app/Support/MobileTopbar.php | 25 +++++++++++++++++++ config/mobile-topbar.php | 19 ++++++++++++++ .../components/mobile-page-header.blade.php | 4 +++ .../views/partials/afia-button.blade.php | 24 ++++++++++++++++++ .../partials/mobile-topbar-title.blade.php | 10 ++++++++ resources/views/partials/topbar-qr.blade.php | 11 ++------ 7 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 app/Support/MobileTopbar.php create mode 100644 config/mobile-topbar.php create mode 100644 resources/views/partials/afia-button.blade.php create mode 100644 resources/views/partials/mobile-topbar-title.blade.php diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 217ebbb..ac11018 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -6,6 +6,8 @@ use App\Models\QrCode; use App\Policies\QrCodePolicy; use Illuminate\Support\Facades\Gate; use Illuminate\Support\ServiceProvider; +use App\Support\MobileTopbar; +use Illuminate\Support\Facades\View; class AppServiceProvider extends ServiceProvider { @@ -17,5 +19,9 @@ class AppServiceProvider extends ServiceProvider public function boot(): void { Gate::policy(QrCode::class, QrCodePolicy::class); + View::composer(['partials.topbar', 'partials.topbar-qr'], function ($view) { + $view->with(MobileTopbar::resolve()); + }); + } } diff --git a/app/Support/MobileTopbar.php b/app/Support/MobileTopbar.php new file mode 100644 index 0000000..5115afc --- /dev/null +++ b/app/Support/MobileTopbar.php @@ -0,0 +1,25 @@ + $patternTitle) { + if (request()->routeIs($pattern)) { + $title = is_callable($patternTitle) ? $patternTitle() : $patternTitle; + break; + } + } + + return [ + 'mobileTopbarSubtitle' => $subtitle, + 'mobileTopbarTitle' => $title, + ]; + } +} diff --git a/config/mobile-topbar.php b/config/mobile-topbar.php new file mode 100644 index 0000000..94a90dc --- /dev/null +++ b/config/mobile-topbar.php @@ -0,0 +1,19 @@ + 'QR Plus', + 'default_title' => 'Overview', + 'patterns' => [ + 'qr.dashboard' => 'Overview', + 'qr.search' => 'Search', + 'user.qr-codes.index' => 'QR codes', + 'user.qr-codes.create' => 'Create QR code', + 'user.qr-codes.show' => 'QR code', + 'account.wallet' => 'Wallet', + 'account.billing' => 'Billing', + 'account.team*' => 'Team', + 'account.settings' => 'Settings', + 'account.developers*' => 'Developers', + 'notifications.*' => 'Notifications', + ], +]; diff --git a/resources/views/components/mobile-page-header.blade.php b/resources/views/components/mobile-page-header.blade.php index acd3927..dc4aa60 100644 --- a/resources/views/components/mobile-page-header.blade.php +++ b/resources/views/components/mobile-page-header.blade.php @@ -3,6 +3,7 @@ 'subtitle' => null, 'backUrl' => null, 'badge' => null, + 'hideAfia' => false, ])
@@ -22,6 +23,9 @@ @if ($badge) {{ $badge }} @endif + @unless ($hideAfia) + @include('partials.afia-button', ['compact' => true]) + @endunless {{ $actions ?? '' }}
{{ $slot }} diff --git a/resources/views/partials/afia-button.blade.php b/resources/views/partials/afia-button.blade.php new file mode 100644 index 0000000..f8eede3 --- /dev/null +++ b/resources/views/partials/afia-button.blade.php @@ -0,0 +1,24 @@ +@props([ + 'compact' => false, + 'handler' => 'dispatch', +]) + +@auth + +@endauth diff --git a/resources/views/partials/mobile-topbar-title.blade.php b/resources/views/partials/mobile-topbar-title.blade.php new file mode 100644 index 0000000..16dfd59 --- /dev/null +++ b/resources/views/partials/mobile-topbar-title.blade.php @@ -0,0 +1,10 @@ +@php + $subtitle = $mobileTopbarSubtitle ?? null; + $title = $mobileTopbarTitle ?? 'Overview'; +@endphp +
+ @if ($subtitle) +

{{ $subtitle }}

+ @endif +

{{ $title }}

+
diff --git a/resources/views/partials/topbar-qr.blade.php b/resources/views/partials/topbar-qr.blade.php index dad9715..7f31d1c 100644 --- a/resources/views/partials/topbar-qr.blade.php +++ b/resources/views/partials/topbar-qr.blade.php @@ -12,7 +12,7 @@ -

Ladill QR Plus

+ @include('partials.mobile-topbar-title') - @auth - + @include('partials.afia-button', ['compact' => true]) @endauth @include('partials.launcher')