From d3a379d5bcc104ab653424fc6fcafa70f883b088 Mon Sep 17 00:00:00 2001 From: isaacclad Date: Sun, 7 Jun 2026 16:30:31 +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 | 22 ++++++++++++++++ .../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.blade.php | 11 ++------ 7 files changed, 93 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 1e63fa5..2d51fab 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -6,6 +6,8 @@ use App\Models\HostingAccount; use App\Policies\HostingAccountPolicy; 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(HostingAccount::class, HostingAccountPolicy::class); + View::composer(['partials.topbar'], 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..a8d7501 --- /dev/null +++ b/config/mobile-topbar.php @@ -0,0 +1,22 @@ + 'Hosting', + 'default_title' => 'Dashboard', + 'patterns' => [ + 'hosting.dashboard' => 'Dashboard', + 'hosting.index' => 'Dashboard', + 'hosting.search' => 'Search', + 'hosting.single-domain' => 'Single Domain', + 'hosting.multi-domain' => 'Multi Domain', + 'hosting.wordpress' => 'WordPress', + 'hosting.accounts.*' => 'Accounts', + 'hosting.orders.*' => 'Orders', + 'hosting.panel.*' => 'Control panel', + 'account.wallet' => 'Wallet', + 'account.billing' => 'Billing', + 'account.team*' => 'Team', + 'account.settings' => 'Settings', + '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.blade.php b/resources/views/partials/topbar.blade.php index c73cfe0..4225528 100644 --- a/resources/views/partials/topbar.blade.php +++ b/resources/views/partials/topbar.blade.php @@ -4,6 +4,7 @@ + @include('partials.mobile-topbar-title') {{-- Search hosting accounts, domains, orders --}} - - {{-- Afia (AI) — opens the in-app assistant. Matches the platform AI button. --}} - + @include('partials.afia-button', ['compact' => true]) @else Sign in @endauth