Просмотр исходного кода

Do not show badges when there are no notifications

Shun Miyazawa 2 лет назад
Родитель
Сommit
c56a6dcc5e
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      apps/app/src/components/Sidebar/SidebarNav/PrimaryItems.tsx

+ 4 - 2
apps/app/src/components/Sidebar/SidebarNav/PrimaryItems.tsx

@@ -20,11 +20,13 @@ const useIndicator = (sidebarMode: SidebarMode, isSelected: boolean): string =>
 };
 
 const NotificationIconWithCountBadge = (): JSX.Element => {
-  const { data: inAppNotificationStatus } = useSWRxInAppNotificationStatus();
+  const { data: notificationCount } = useSWRxInAppNotificationStatus();
 
   return (
     <div className="position-relative">
-      <span className="badge rounded-pill bg-primary notification-count-badge">{inAppNotificationStatus}</span>
+      { notificationCount != null && notificationCount > 0 && (
+        <span className="badge rounded-pill bg-primary notification-count-badge">{notificationCount}</span>
+      ) }
       <span className="material-symbols-outlined">notifications</span>
     </div>
   );