Add mobile topbar titles and show Afia on all mobile headers.
Deploy Ladill Hosting / deploy (push) Successful in 26s
Deploy Ladill Hosting / deploy (push) Successful in 26s
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 <cursoragent@cursor.com>
This commit is contained in:
@@ -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());
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
class MobileTopbar
|
||||
{
|
||||
public static function resolve(): array
|
||||
{
|
||||
$config = config('mobile-topbar', []);
|
||||
$subtitle = $config['app_name'] ?? 'Ladill';
|
||||
$title = $config['default_title'] ?? 'Overview';
|
||||
|
||||
foreach ($config['patterns'] ?? [] as $pattern => $patternTitle) {
|
||||
if (request()->routeIs($pattern)) {
|
||||
$title = is_callable($patternTitle) ? $patternTitle() : $patternTitle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'mobileTopbarSubtitle' => $subtitle,
|
||||
'mobileTopbarTitle' => $title,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user