feat(admin): add tooltip for not authorized routes

This commit is contained in:
Yassine Doghri 2024-01-09 16:12:15 +00:00
parent 0bd7ddea58
commit f7f9bafc3e
2 changed files with 9 additions and 4 deletions

View File

@ -12,6 +12,7 @@ return [
'toggle_sidebar' => 'Toggle sidebar',
'go_to_website' => 'Go to website',
'go_to_admin' => 'Go to admin',
'not-authorized' => 'Not authorized',
'dashboard' => 'Dashboard',
'admin' => 'Home',
'podcasts' => 'Podcasts',

View File

@ -38,13 +38,17 @@
}
?>
<li class="inline-flex">
<a class="relative w-full py-3 pl-14 pr-2 text-sm hover:opacity-100 before:absolute before:opacity-0 before:w-5 before:h-5 hover:bg-navigation-active focus:ring-inset focus:ring-accent<?= $isActive
<?php if ($isAllowed): ?>
<a class="relative w-full py-3 pl-14 pr-2 text-sm hover:opacity-100 before:content-chevronRightIcon before:absolute before:-ml-5 before:opacity-0 before:w-5 before:h-5 hover:bg-navigation-active focus:ring-inset focus:ring-accent<?= $isActive
? ' before:opacity-100 font-semibold inline-flex items-center'
: ' hover:before:opacity-60 focus:before:opacity-60' ?><?= $isAllowed
? ' before:content-chevronRightIcon before:-ml-5'
: ' before:content-prohibitedIcon before:-ml-6 before:opacity-60 pointer-events-none' ?>" href="<?= route_to($item, $podcastId ?? null, $episodeId ?? null) ?>"><?= lang(
: ' hover:before:opacity-60 focus:before:opacity-60' ?>" href="<?= route_to($item, $podcastId ?? null, $episodeId ?? null) ?>"><?= lang(
$langKey . '.' . $item,
) ?></a>
<?php else: ?>
<span data-tooltip="right" title="<?= lang('Navigation.not-authorized') ?>" class="relative w-full py-3 pr-2 text-sm cursor-not-allowed before:inset-y-0 before:my-auto pl-14 hover:opacity-100 before:absolute before:content-prohibitedIcon before:-ml-5 before:opacity-60 before:w-4 before:h-4 hover:bg-navigation-active focus:ring-inset focus:ring-accent"><?= lang(
$langKey . '.' . $item,
) ?></span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>