Evaluate new station sidebar menus tructure.

This commit is contained in:
Buster "Silver Eagle" Neece 2022-02-27 17:41:39 -06:00
parent 5c4f8e3e45
commit a4e6f5a65b
No known key found for this signature in database
GPG Key ID: 9FC8B9E008872109
2 changed files with 164 additions and 124 deletions

View File

@ -44,177 +44,212 @@ return function (App\Event\BuildStationMenu $e) {
'visible' => $station->getHasStarted(),
'permission' => StationPermissions::Broadcasting,
],
'profile' => [
'profile' => [
'label' => __('Profile'),
'icon' => 'image',
'url' => (string)$router->fromHere('stations:profile:index'),
'icon' => 'image',
'url' => (string)$router->fromHere('stations:profile:index'),
],
'public' => [
'label' => __('Public Page'),
'icon' => 'public',
'url' => (string)$router->named('public:index', ['station_id' => $station->getShortName()]),
'public' => [
'label' => __('Public Page'),
'icon' => 'public',
'url' => (string)$router->named('public:index', ['station_id' => $station->getShortName()]),
'external' => true,
'visible' => $station->getEnablePublicPage(),
'visible' => $station->getEnablePublicPage(),
],
'ondemand' => [
'label' => __('On-Demand Media'),
'icon' => 'cloud_download',
'url' => (string)$router->named('public:ondemand', ['station_id' => $station->getShortName()]),
'external' => true,
'visible' => $station->getEnableOnDemand(),
],
'files' => [
'label' => __('Music Files'),
'icon' => 'library_music',
'url' => (string)$router->fromHere('stations:files:index'),
'visible' => $backend->supportsMedia(),
'permission' => StationPermissions::Media,
],
'playlists' => [
'label' => __('Playlists'),
'icon' => 'queue_music',
'url' => (string)$router->fromHere('stations:playlists:index'),
'visible' => $backend->supportsMedia(),
'permission' => StationPermissions::Media,
],
'podcasts' => [
'label' => __('Podcasts'),
'icon' => 'cast',
'url' => (string)$router->fromHere('stations:podcasts:index'),
'permission' => StationPermissions::Podcasts,
],
'streamers' => [
'label' => __('Streamer/DJ Accounts'),
'icon' => 'mic',
'url' => (string)$router->fromHere('stations:streamers:index'),
'visible' => $backend->supportsStreamers(),
'permission' => StationPermissions::Streamers,
],
'web_dj' => [
'label' => __('Web DJ'),
'icon' => 'surround_sound',
'url' => (string)$router->named('public:dj', ['station_id' => $station->getShortName()], [], true)
->withScheme('https'),
'visible' => $station->getEnablePublicPage() && $station->getEnableStreamers(),
'external' => true,
],
'mounts' => [
'label' => __('Mount Points'),
'icon' => 'wifi_tethering',
'url' => (string)$router->fromHere('stations:mounts:index'),
'visible' => $frontend->supportsMounts(),
'permission' => StationPermissions::MountPoints,
],
'remotes' => [
'label' => __('Remote Relays'),
'icon' => 'router',
'url' => (string)$router->fromHere('stations:remotes:index'),
'permission' => StationPermissions::RemoteRelays,
],
'webhooks' => [
'label' => __('Web Hooks'),
'icon' => 'code',
'url' => (string)$router->fromHere('stations:webhooks:index'),
'permission' => StationPermissions::WebHooks,
],
'reports' => [
'label' => __('Reports'),
'icon' => 'assignment',
'permission' => StationPermissions::Reports,
'items' => [
'reports_overview' => [
'label' => __('Statistics Overview'),
'url' => (string)$router->fromHere('stations:reports:overview'),
],
'reports_listeners' => [
'label' => __('Listeners'),
'url' => (string)$router->fromHere('stations:reports:listeners'),
],
'reports_requests' => [
'label' => __('Song Requests'),
'url' => (string)$router->fromHere('stations:reports:requests'),
'visible' => $station->getEnableRequests(),
],
'reports_timeline' => [
'label' => __('Song Playback Timeline'),
'url' => (string)$router->fromHere('stations:reports:timeline'),
],
'reports_performance' => [
'label' => __('Song Listener Impact'),
'url' => (string)$router->fromHere('stations:reports:performance'),
'media' => [
'label' => __('Media'),
'icon' => 'library_music',
'items' => [
'files' => [
'label' => __('Music Files'),
'icon' => 'library_music',
'url' => (string)$router->fromHere('stations:files:index'),
'visible' => $backend->supportsMedia(),
'permission' => StationPermissions::Media,
],
'reports_duplicates' => [
'label' => __('Duplicate Songs'),
'class' => 'text-muted',
'url' => (string)$router->fromHere('stations:files:index') . '#special:duplicates',
'visible' => $backend->supportsMedia(),
],
'reports_unprocessable' => [
'label' => __('Unprocessable Files'),
'class' => 'text-muted',
'url' => (string)$router->fromHere('stations:files:index') . '#special:unprocessable',
'visible' => $backend->supportsMedia(),
],
'reports_unassigned' => [
'label' => __('Unassigned Files'),
'class' => 'text-muted',
'url' => (string)$router->fromHere('stations:files:index') . '#special:unassigned',
'visible' => $backend->supportsMedia(),
],
'ondemand' => [
'label' => __('On-Demand Media'),
'class' => 'text-muted',
'icon' => 'cloud_download',
'url' => (string)$router->named('public:ondemand', ['station_id' => $station->getShortName()]),
'external' => true,
'visible' => $station->getEnableOnDemand(),
],
'sftp_users' => [
'label' => __('SFTP Users'),
'class' => 'text-muted',
'url' => (string)$router->fromHere('stations:sftp_users:index'),
'visible' => App\Service\SftpGo::isSupportedForStation($station),
'permission' => StationPermissions::Media,
],
'playlists' => [
'label' => __('Playlists'),
'icon' => 'queue_music',
'url' => (string)$router->fromHere('stations:playlists:index'),
'visible' => $backend->supportsMedia(),
'permission' => StationPermissions::Media,
],
'automation' => [
'label' => __('Automated Assignment'),
'class' => 'text-muted',
'url' => (string)$router->fromHere('stations:automation:index'),
'visible' => $backend->supportsMedia(),
'permission' => StationPermissions::Automation,
],
],
],
'podcasts' => [
'label' => __('Podcasts'),
'icon' => 'cast',
'url' => (string)$router->fromHere('stations:podcasts:index'),
'permission' => StationPermissions::Podcasts,
],
'live_streaming' => [
'label' => __('Live Streaming'),
'icon' => 'mic',
'items' => [
'streamers' => [
'label' => __('Streamer/DJ Accounts'),
'icon' => 'mic',
'url' => (string)$router->fromHere('stations:streamers:index'),
'visible' => $backend->supportsStreamers(),
'permission' => StationPermissions::Streamers,
],
'web_dj' => [
'label' => __('Web DJ'),
'icon' => 'surround_sound',
'url' => (string)$router->named(
'public:dj',
['station_id' => $station->getShortName()],
[],
true
)
->withScheme('https'),
'visible' => $station->getEnablePublicPage() && $station->getEnableStreamers(),
'external' => true,
],
],
],
'webhooks' => [
'label' => __('Web Hooks'),
'icon' => 'code',
'url' => (string)$router->fromHere('stations:webhooks:index'),
'permission' => StationPermissions::WebHooks,
],
'reports' => [
'label' => __('Reports'),
'icon' => 'assignment',
'permission' => StationPermissions::Reports,
'items' => [
'reports_overview' => [
'label' => __('Statistics Overview'),
'url' => (string)$router->fromHere('stations:reports:overview'),
],
'reports_listeners' => [
'label' => __('Listeners'),
'url' => (string)$router->fromHere('stations:reports:listeners'),
],
'reports_requests' => [
'label' => __('Song Requests'),
'url' => (string)$router->fromHere('stations:reports:requests'),
'visible' => $station->getEnableRequests(),
],
'reports_timeline' => [
'label' => __('Song Playback Timeline'),
'url' => (string)$router->fromHere('stations:reports:timeline'),
],
'reports_performance' => [
'label' => __('Song Listener Impact'),
'url' => (string)$router->fromHere('stations:reports:performance'),
'visible' => $backend->supportsMedia(),
],
'reports_soundexchange' => [
'label' => __('SoundExchange Royalties'),
'url' => (string)$router->fromHere('stations:reports:soundexchange'),
],
],
],
'utilities' => [
'label' => __('Utilities'),
'icon' => 'settings',
'broadcasting' => [
'label' => __('Broadcasting'),
'icon' => 'wifi_tethering',
'items' => [
'sftp_users' => [
'label' => __('SFTP Users'),
'url' => (string)$router->fromHere('stations:sftp_users:index'),
'visible' => App\Service\SftpGo::isSupportedForStation($station),
'permission' => StationPermissions::Media,
'mounts' => [
'label' => __('Mount Points'),
'icon' => 'wifi_tethering',
'url' => (string)$router->fromHere('stations:mounts:index'),
'visible' => $frontend->supportsMounts(),
'permission' => StationPermissions::MountPoints,
],
'automation' => [
'label' => __('Automated Assignment'),
'url' => (string)$router->fromHere('stations:automation:index'),
'visible' => $backend->supportsMedia(),
'permission' => StationPermissions::Automation,
'remotes' => [
'label' => __('Remote Relays'),
'icon' => 'router',
'url' => (string)$router->fromHere('stations:remotes:index'),
'permission' => StationPermissions::RemoteRelays,
],
'ls_config' => [
'label' => __('Edit Liquidsoap Configuration'),
'url' => (string)$router->fromHere('stations:util:ls_config'),
'visible' => $settings->getEnableAdvancedFeatures()
'ls_config' => [
'label' => __('Edit Liquidsoap Configuration'),
'class' => 'text-muted',
'url' => (string)$router->fromHere('stations:util:ls_config'),
'visible' => $settings->getEnableAdvancedFeatures()
&& $backend instanceof App\Radio\Backend\Liquidsoap,
'permission' => StationPermissions::Broadcasting,
],
'logs' => [
'label' => __('Log Viewer'),
'url' => (string)$router->fromHere('stations:logs:index'),
'permission' => StationPermissions::Logs,
],
'queue' => [
'label' => __('Upcoming Song Queue'),
'class' => 'text-muted',
'url' => (string)$router->fromHere('stations:queue:index'),
'permission' => StationPermissions::Broadcasting,
],
'reload' => [
'label' => __('Reload Configuration'),
'class' => 'text-muted api-call',
'url' => (string)$router->fromHere('api:stations:reload'),
'class' => 'api-call',
'confirm' => $willNotDisconnectMessage,
'permission' => StationPermissions::Broadcasting,
'visible' => $reloadSupported,
],
'restart' => [
'label' => __('Restart Broadcasting'),
'class' => 'text-muted api-call',
'url' => (string)$router->fromHere('api:stations:restart'),
'class' => 'api-call',
'confirm' => $willDisconnectMessage,
'permission' => StationPermissions::Broadcasting,
],
],
],
'help' => [
'label' => __('Help'),
'icon' => 'support',
'url' => (string)$router->fromHere('stations:logs:index'),
'permission' => StationPermissions::Logs,
],
]
);
};

View File

@ -46,20 +46,25 @@ $active ??= null;
<?php
foreach ($category['items'] as $item_id => $item): ?>
<li class="nav-item">
<a class="nav-link pl-4 py-2 text-muted <?=($item['class'] ?? '')?>"
href="<?=$item['url']?>"
<a class="nav-link pl-4 py-2 <?= ($item['class'] ?? '') ?>"
href="<?= $item['url'] ?>"
<?php
if ($item['external'] ?? false): ?>target="_blank"<?php
endif; ?>
<?php
if (isset($item['confirm'])): ?>data-confirm-title="<?=$this->e(
if (isset($item['confirm'])): ?>data-confirm-title="<?= $this->e(
$item['confirm']
)?>"<?php
) ?>"<?php
endif; ?>
<?php
if (isset($item['title'])): ?>title="<?=$this->e($item['title'])?>"<?php
if (isset($item['title'])): ?>title="<?= $this->e($item['title']) ?>"<?php
endif; ?>>
<?=$item['label']?>
<?= $item['label'] ?>
<?php
if ($item['external'] ?? false): ?>
<i class="material-icons sm">open_in_new</i>
<?php
endif; ?>
</a>
</li>
<?php endforeach; ?>