{{-- Shared admin navigation. The dashboard below it is an overview, not a directory of links. --}}
@php
$nhAdminGroups = \App\Support\AdminHub::visibleGroups(Auth::user());
$nhAdminRoute = Route::currentRouteName();
$nhAdminLookup = str_starts_with($nhAdminRoute, 'admin.limit.') ? 'admin.server.index' : $nhAdminRoute;
$nhAdminPages = collect($nhAdminGroups)->flatMap(fn ($item) => $item['pages']);
$nhAdminActive = $nhAdminPages->firstWhere('route', $nhAdminLookup)
?? $nhAdminPages->sortByDesc(fn ($item) => strlen($item['route']))->first(fn ($item) =>
str_ends_with($item['route'], '.index') && str_starts_with($nhAdminLookup, substr($item['route'], 0, -6).'.'));
@endphp
@push('scripts')
@endpush