Scope Frontdesk team members and add mailbox invite picker.
Deploy Ladill Frontdesk / deploy (push) Successful in 38s
Deploy Ladill Frontdesk / deploy (push) Successful in 38s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,17 +2,59 @@
|
||||
// Shared Ladill app launcher — IDENTICAL across every app/service.
|
||||
// Driven by config/ladill_launcher.php (fully-extracted apps only) + icons
|
||||
// from public/images/launcher-icons/. Omits the current app (matched by
|
||||
// APP_URL host). To replicate elsewhere, copy this file + the config +
|
||||
// the launcher-icons folder verbatim.
|
||||
// APP_URL host). Scoped team members only see apps they can access; the
|
||||
// launcher is hidden entirely when they only have one app (or none).
|
||||
$sidebar = (bool) ($sidebar ?? false);
|
||||
$selfHost = parse_url((string) config('app.url'), PHP_URL_HOST);
|
||||
$allowedSlugs = \App\Support\StaffUx::allowedAppSlugs(auth()->user());
|
||||
$launcherApps = array_values(array_filter(
|
||||
config('ladill_launcher.apps', []),
|
||||
fn (array $app) => parse_url($app['url'], PHP_URL_HOST) !== $selfHost
|
||||
function (array $app) use ($selfHost, $allowedSlugs) {
|
||||
if (parse_url($app['url'], PHP_URL_HOST) === $selfHost) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($allowedSlugs === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$host = (string) parse_url($app['url'], PHP_URL_HOST);
|
||||
$root = (string) config('app.platform_domain', 'ladill.com');
|
||||
$suffix = '.'.$root;
|
||||
if (! str_ends_with($host, $suffix)) {
|
||||
return false;
|
||||
}
|
||||
$sub = substr($host, 0, -strlen($suffix));
|
||||
|
||||
foreach ($allowedSlugs as $slug) {
|
||||
if ($slug === $sub || str_starts_with($sub, $slug)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Launcher URLs may use marketing hostnames — match by known slug keys.
|
||||
$slug = match (true) {
|
||||
str_starts_with($host, 'care.') => 'care',
|
||||
str_starts_with($host, 'meet.') => 'meet',
|
||||
str_starts_with($host, 'queue.') => 'queue',
|
||||
str_starts_with($host, 'frontdesk.') => 'frontdesk',
|
||||
str_starts_with($host, 'mail.') => 'mail',
|
||||
str_starts_with($host, 'email.') => 'email',
|
||||
default => explode('.', $host)[0] ?? null,
|
||||
};
|
||||
|
||||
return $slug && in_array($slug, $allowedSlugs, true);
|
||||
}
|
||||
));
|
||||
|
||||
// Single-app staff: no launcher (they already are in their only app).
|
||||
if ($allowedSlugs !== null && count($allowedSlugs) <= 1) {
|
||||
$launcherApps = [];
|
||||
}
|
||||
|
||||
$launcherOverflows = count($launcherApps) > 15;
|
||||
@endphp
|
||||
@if (! empty($launcherApps))
|
||||
@if (! empty($launcherApps) && \App\Support\StaffUx::showProductHub(auth()->user()))
|
||||
<div class="relative" x-data="{
|
||||
appsOpen: false,
|
||||
showScrollMore: {{ $launcherOverflows ? 'true' : 'false' }},
|
||||
|
||||
Reference in New Issue
Block a user