Reorganize Woo Manager mobile header and store switcher placement.
Deploy Ladill Woo Manager / deploy (push) Successful in 1m7s
Deploy Ladill Woo Manager / deploy (push) Successful in 1m7s
Desktop store switcher now sits after search; mobile shows route-based page titles, bottom nav, and store switching inside the profile sheet. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Providers;
|
||||
|
||||
use App\Services\Woo\SubscriptionService;
|
||||
use App\Support\CurrentWooStore;
|
||||
use App\Support\MobileTopbar;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
@@ -16,7 +17,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
View::composer(['partials.sidebar', 'partials.topbar'], function ($view) {
|
||||
View::composer(['partials.sidebar', 'partials.topbar', 'partials.mobile-bottom-nav', 'partials.store-switcher-menu'], function ($view) {
|
||||
$account = ladill_account() ?? auth()->user();
|
||||
$svc = app(SubscriptionService::class);
|
||||
$stores = app(CurrentWooStore::class);
|
||||
@@ -27,5 +28,9 @@ class AppServiceProvider extends ServiceProvider
|
||||
$view->with('wooActiveStores', $account ? $stores->activeStores($account) : collect());
|
||||
$view->with('currentWooStore', $account ? $stores->resolve($account) : null);
|
||||
});
|
||||
|
||||
View::composer(['partials.topbar'], function ($view) {
|
||||
$view->with(MobileTopbar::resolve());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,18 +2,44 @@
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MobileTopbar
|
||||
{
|
||||
public static function resolve(): array
|
||||
/** @var array<string, string> */
|
||||
private const ROUTE_TITLES = [
|
||||
'woo.dashboard' => 'Overview',
|
||||
'woo.orders.*' => 'Orders',
|
||||
'woo.products.create' => 'New product',
|
||||
'woo.products.edit' => 'Edit product',
|
||||
'woo.products.*' => 'Products',
|
||||
'woo.categories.create' => 'New category',
|
||||
'woo.categories.edit' => 'Edit category',
|
||||
'woo.categories.*' => 'Categories',
|
||||
'woo.stores.*' => 'Stores',
|
||||
'woo.settings' => 'Settings',
|
||||
'woo.pro.*' => 'Plans',
|
||||
'notifications.*' => 'Notifications',
|
||||
];
|
||||
|
||||
public static function resolve(?Request $request = null): array
|
||||
{
|
||||
$request ??= request();
|
||||
|
||||
if ($request) {
|
||||
foreach (self::ROUTE_TITLES as $pattern => $title) {
|
||||
if ($request->routeIs($pattern)) {
|
||||
return ['mobileTopbarTitle' => $title];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$appName = config('mobile-topbar.app_name', 'Ladill');
|
||||
|
||||
$title = $appName === 'Ladill'
|
||||
? 'Ladill'
|
||||
: "Ladill {$appName}";
|
||||
|
||||
return [
|
||||
'mobileTopbarTitle' => $title,
|
||||
'mobileTopbarTitle' => $appName === 'Ladill'
|
||||
? 'Ladill'
|
||||
: "Ladill {$appName}",
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user