Surface Google, Pinterest, Snapchat, and shipping status from the WordPress plugin with deep links to finish setup in WooCommerce. Co-authored-by: Cursor <cursoragent@cursor.com>
47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Support;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
class MobileTopbar
|
|
{
|
|
/** @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.integrations.*' => 'Integrations',
|
|
'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');
|
|
|
|
return [
|
|
'mobileTopbarTitle' => $appName === 'Ladill'
|
|
? 'Ladill'
|
|
: "Ladill {$appName}",
|
|
];
|
|
}
|
|
}
|