@php /** * Menu resolved server side so permission checks and translations never * reach the browser. Routes are best guess against the legacy layout and * are expected to be adjusted. Route::has() keeps a missing route from * throwing while the migration is in progress. */ /* as telas de aplicativo acendem o menu Apps, mesmo servindo a barra da Rádio embaixo */ $emApps = request()->routeIs('radio.apps.*') || request()->routeIs('radio.app.*'); $r = fn (string $name, ...$args) => Route::has($name) ? route($name, ...$args) : '#'; /* a TV-only site has no radio stream: Web is just the website, with nothing to pick from */ $tvOnly = empty($siteData->stream_port); $areas = [ [ /* No dropdown: the areas only switch context, the pages of each one live in its own context bar */ 'id' => 'general', 'label' => __('general.top_menu_item_general'), 'icon' => 'fa-house', 'active' => ($topHref ?? null) === 'general', 'show' => true, 'link' => $r('dashboard.r'), 'items' => general_subnav_items(), ], [ /* No dropdown: it opens the radio area straight away, like TV */ 'id' => 'radio', 'label' => __('general.header_nav_radio'), 'icon' => 'fa-circle-play', 'active' => ($topHref ?? null) === 'radio' && !$emApps, 'show' => (bool) ($siteData->stream_port ?? false), 'link' => $r('radio.home.r'), 'items' => [], ], [ 'id' => 'web', 'label' => $tvOnly ? __('general.header_web_site_title') : __('general.header_nav_web'), 'icon' => 'fa-globe-americas', 'active' => ($topHref ?? null) === 'site', 'show' => ($siteData->status ?? null) !== '4', 'link' => $tvOnly ? $r('site.home.r') : null, 'items' => $tvOnly ? [] : [ ['label' => __('general.header_web_site_title'), 'icon' => 'fa-globe-americas', 'desc' => __('general.header_web_site_desc'), 'route' => 'site.home.r'], ['label' => __('general.header_web_startpage_title'), 'icon' => 'fa-link', 'desc' => __('general.header_web_startpage_desc'), 'route' => 'site.pagelink.r'], ['label' => __('general.header_web_players_title'), 'icon' => 'fa-play', 'desc' => __('general.header_web_players_desc'), 'route' => 'radio.widgets.r'], ['label' => __('general.page_emails_h1'), 'icon' => 'fa-envelope-open', 'desc' => __('general.header_area_web_domains_desc'), 'route' => 'emails.r'], ], ], [ 'id' => 'apps', 'label' => __('general.perm_apps'), 'icon' => 'fa-mobile-screen', 'active' => $emApps, 'show' => ! $tvOnly, 'items' => [ ['label' => __('general.header_area_apps_home'), 'icon' => 'fa-mobile-screen', 'desc' => __('general.header_area_apps_home_desc'), 'route' => 'radio.apps.r.android', 'match' => ['radio.apps.r.android', 'radio.app']], ['label' => __('general.header_area_apps_webapp'), 'icon' => 'fa-globe-americas', 'desc' => __('general.header_area_apps_webapp_desc'), 'route' => 'radio.apps.r.webapp'], ], ], [ 'id' => 'interat', 'label' => __('site.menu_item_5'), 'icon' => 'fa-comments', 'active' => ($topHref ?? null) === 'interat', 'show' => ($siteData->status ?? null) !== '4', 'wide' => true, 'items' => [ ...($tvOnly ? [] : [['label' => __('site.menu_item_5_sub_1'), 'icon' => 'fa-video', 'desc' => __('general.header_area_interat_camera_desc'), 'route' => 'site.camera.r']]), ['label' => __('site.menu_item_5_sub_2'), 'icon' => 'fa-comments', 'desc' => __('general.header_area_interat_chat_desc'), 'route' => 'site.chat.r'], ['label' => __('site.menu_item_5_sub_3'), 'icon' => 'fa-music', 'desc' => __('general.header_area_interat_requests_desc'), 'route' => 'site.music-requests.r'], ['label' => __('site.menu_item_5_sub_4'), 'icon' => 'fa-envelope', 'desc' => __('general.header_area_interat_messages_desc'), 'route' => 'site.messages.r'], ['label' => __('site.menu_item_5_sub_5'), 'icon' => 'fa-comment-dots', 'desc' => __('general.header_area_interat_comments_desc'), 'route' => 'site.comments.r'], ['label' => __('site.menu_item_5_sub_6'), 'icon' => 'fa-square-poll-vertical', 'desc' => __('general.header_area_interat_polls_desc'), 'route' => 'site.polls.r'], ['label' => __('site.menu_item_5_sub_7'), 'icon' => 'fa-gift', 'desc' => __('general.header_area_interat_promos_desc'), 'route' => 'site.promotions.r'], ['label' => __('site.menu_item_5_sub_8'), 'icon' => 'fa-clipboard-list', 'desc' => __('general.header_area_interat_forms_desc'), 'route' => 'site.forms.r'], ], ], ]; /* o item aceso e o da pagina em que estou: mesma regra da barra de contexto */ foreach ($areas as $iArea => $area) { foreach ($area['items'] as $iItem => $item) { if (! isset($item['route'])) { continue; } $areas[$iArea]['items'][$iItem]['url'] = $r($item['route']); $areas[$iArea]['items'][$iItem]['active'] = menu_ativo($item['route'], $item['match'] ?? null); } } $areas = array_values(array_filter($areas, fn ($a) => $a['show'])); $temTv = ($siteData->stream_tv ?? null) === '1' && ! empty($siteData->stream_tv_name); /** * A site without its own domain runs on a platform subdomain. In that case * the alternative slot is all it has, so we offer the upsell instead of * showing an empty "main domain" row. */ $dominiosPlataforma = ['.minhawebradio.com', '.webradioonline.net']; $semDominioProprio = false; foreach ($dominiosPlataforma as $sufixo) { if (str_contains($siteData->domain ?? '', $sufixo)) { $semDominioProprio = true; break; } } /** * Resolved here instead of trusting every controller to pass $serverData: * the pages that did not were silently dropping the alternative domain. */ $headerServer = $serverData ?? site_server(); $subdominioHeader = ! empty($siteData->subdomain) && ! empty($headerServer->name) ? $siteData->subdomain . '.' . $headerServer->name : null; /** * The site owner is whoever owns sites.user_id. Owners reach the panel from * the client area and have no session of their own to drop, so logout is * only offered to invited administrators. */ $ehDono = (int) ($siteData->user_id ?? 0) === (int) $userLogged->id; /* the TV opens as this person, so the button follows the same rule as the way back from it */ $canOpenTv = $temTv && can_open_tv($siteData, $userLogged->id, session('serverID')); @endphp @yield('title') · {{ __('general.header_page_title_suffix') }} @hasSection('head') @yield('head') @endif
@includeWhen(($topHref ?? null) === 'site', 'includes.subnav-site') @includeWhen(($topHref ?? null) === 'general', 'includes.subnav-general') {{-- a área de aplicativos não tem barra de contexto própria, e não empresta a da rádio --}} @includeWhen(($topHref ?? null) === 'radio' && !$emApps, 'includes.subnav-radio') @php /** * The drawer repeats what the header already resolved instead of computing * its own menu, so mobile can never show a different set of links. */ $drawerSubnav = ($topHref ?? null) === 'site' ? site_subnav_groups() : []; @endphp