chg: [notifications] Slightly improved UI
parent
a77e29fa38
commit
e67c711935
|
@ -10,6 +10,7 @@ $severity = [
|
||||||
'danger' => 2,
|
'danger' => 2,
|
||||||
];
|
];
|
||||||
$maxSeverity = -1;
|
$maxSeverity = -1;
|
||||||
|
$hasNotification = !empty($notifications);
|
||||||
$notificationVariants = Hash::extract($notifications, '{n}.variant');
|
$notificationVariants = Hash::extract($notifications, '{n}.variant');
|
||||||
foreach ($notificationVariants as $notifVariant) {
|
foreach ($notificationVariants as $notifVariant) {
|
||||||
$maxSeverity = max($maxSeverity, $severity[$notifVariant] ?? 0);
|
$maxSeverity = max($maxSeverity, $severity[$notifVariant] ?? 0);
|
||||||
|
@ -20,21 +21,22 @@ $variant = array_flip($severity)[$maxSeverity];
|
||||||
<a class="nav-link px-2 text-decoration-none profile-button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#" data-bs-offset="10,20">
|
<a class="nav-link px-2 text-decoration-none profile-button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#" data-bs-offset="10,20">
|
||||||
<span class="position-relative">
|
<span class="position-relative">
|
||||||
<i class="<?= $this->FontAwesome->getClass('bell') ?> fa-lg"></i>
|
<i class="<?= $this->FontAwesome->getClass('bell') ?> fa-lg"></i>
|
||||||
<?=
|
<?php
|
||||||
$this->Bootstrap->notificationBubble([
|
if ($hasNotification) {
|
||||||
'class' => empty($notifications) ? 'd-none' : '',
|
echo $this->Bootstrap->notificationBubble([
|
||||||
'variant' => $variant,
|
'variant' => $variant,
|
||||||
])
|
]);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu dropdown-menu-end" style="min-width: 320px; max-width: 25vw">
|
<div class="dropdown-menu dropdown-menu-end" style="min-width: 320px; max-width: 25vw; max-height: 50vh; overflow-y: auto;">
|
||||||
<h6 class="dropdown-header d-flex justify-content-between">
|
<h6 class="dropdown-header d-flex justify-content-between">
|
||||||
<span><?= __n('{0} Notification', '{0} Notifications', count($notifications), count($notifications)) ?></span>
|
<span><?= __n('{0} Notification', '{0} Notifications', count($notifications), count($notifications)) ?></span>
|
||||||
</h6>
|
</h6>
|
||||||
<?php if (empty($notifications)) : ?>
|
<?php if (empty($notifications)) : ?>
|
||||||
<span class="dropdown-item-text text-nowrap user-select-none text-center">
|
<span class="dropdown-item-text text-nowrap user-select-none text-center fs-7">
|
||||||
<?= __('- No notification -') ?>
|
<?= __('You don\'t have notifications at the moment') ?>
|
||||||
<span>
|
<span>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<?php foreach ($notifications as $notification) : ?>
|
<?php foreach ($notifications as $notification) : ?>
|
||||||
|
|
Loading…
Reference in New Issue