Add mobile bottom nav and hide header avatar on small screens.
Deploy Ladill Frontdesk / deploy (push) Successful in 29s
Deploy Ladill Frontdesk / deploy (push) Successful in 29s
Frontdesk now matches the Ladill mobile pattern: app name in the header, Home/Search/Notifications/Profile in the bottom bar with a profile sheet. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -48,5 +48,9 @@ class AppServiceProvider extends ServiceProvider
|
||||
|
||||
$view->with('isPro', $isPro);
|
||||
});
|
||||
|
||||
View::composer(['partials.topbar'], function ($view) {
|
||||
$view->with(\App\Support\MobileTopbar::resolve());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
class MobileTopbar
|
||||
{
|
||||
public static function resolve(): array
|
||||
{
|
||||
$appName = config('mobile-topbar.app_name', 'Ladill');
|
||||
|
||||
$title = $appName === 'Ladill'
|
||||
? 'Ladill'
|
||||
: "Ladill {$appName}";
|
||||
|
||||
return [
|
||||
'mobileTopbarTitle' => $title,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,14 @@ namespace App\Support;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/**
|
||||
* Standard signed-in profile links for Ladill product apps (identical across
|
||||
* the suite). Points at the account/home portals, not app-local routes.
|
||||
*
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
class UserProfileMenu
|
||||
{
|
||||
/**
|
||||
* Standard signed-in profile links for Ladill product apps.
|
||||
* Not used by Ladill Mail (mail.ladill.com) — that app keeps a mailbox-specific menu.
|
||||
*
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public static function items(?Authenticatable $user = null): array
|
||||
{
|
||||
$user ??= auth()->user();
|
||||
@@ -43,8 +43,6 @@ class UserProfileMenu
|
||||
];
|
||||
}
|
||||
|
||||
// Wallet balance peek — sits directly after Billing (only when this
|
||||
// app exposes a balance endpoint).
|
||||
if (Route::has((string) config('billing.wallet_balance_route', 'wallet.balance'))) {
|
||||
$items[] = ['type' => 'wallet'];
|
||||
}
|
||||
@@ -79,10 +77,13 @@ class UserProfileMenu
|
||||
return ladill_home_url($path);
|
||||
}
|
||||
|
||||
$platform = (string) config('app.platform_domain', parse_url((string) config('app.url', ''), PHP_URL_HOST) ?: '');
|
||||
$domain = $platform !== '' ? 'home.'.$platform : (string) config('app.account_domain');
|
||||
$domain = config('app.home_domain');
|
||||
if (! $domain) {
|
||||
$platform = (string) config('app.platform_domain', parse_url((string) config('app.url', ''), PHP_URL_HOST) ?: '');
|
||||
$domain = $platform !== '' ? 'home.'.$platform : (string) config('app.account_domain');
|
||||
}
|
||||
|
||||
return self::absoluteUrl($domain, $path);
|
||||
return self::absoluteUrl((string) $domain, $path);
|
||||
}
|
||||
|
||||
if (function_exists('ladill_account_url')) {
|
||||
@@ -92,7 +93,11 @@ class UserProfileMenu
|
||||
return self::absoluteUrl((string) config('app.account_domain'), $path);
|
||||
}
|
||||
|
||||
/** @param array{label?: string, path?: string, host?: string} $link */
|
||||
/**
|
||||
* Hide a menu link when the signed-in user is already on that destination.
|
||||
*
|
||||
* @param array{label?: string, path?: string, host?: string} $link
|
||||
*/
|
||||
private static function isCurrentMenuLink(array $link, string $href): bool
|
||||
{
|
||||
if (app()->runningInConsole() && ! app()->runningUnitTests()) {
|
||||
@@ -140,7 +145,11 @@ class UserProfileMenu
|
||||
{
|
||||
$base = 'https://'.trim($domain, '/');
|
||||
|
||||
return $path === '' ? $base : $base.'/'.ltrim($path, '/');
|
||||
if ($path === '') {
|
||||
return $base;
|
||||
}
|
||||
|
||||
return $base.'/'.ltrim($path, '/');
|
||||
}
|
||||
|
||||
private static function userIsAdmin(Authenticatable $user): bool
|
||||
|
||||
Reference in New Issue
Block a user