Skip to content

Commit

Permalink
feat(frontend): ability to toggle notification icons in the sidebar menu
Browse files Browse the repository at this point in the history
  • Loading branch information
allynt committed Jul 9, 2023
1 parent 1b090fd commit 23d8b7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions src/layout/SidebarContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import SimpleBar from 'simplebar-react';

import { SIGNIN_REDIRECT } from 'config';
import { newItemsCountAlertSelector } from 'store/alerts.slice';
import { configSelector } from 'store/common.slice';
import {
dataLayerNewItemsCountSelector,
dataLayerIsNewAlertSelector,
Expand All @@ -28,6 +29,7 @@ import {
// import { withRouter } from 'react-router-dom'

const SidebarContent = props => {
const config = useSelector(configSelector);
const newAlertsCount = useSelector(newItemsCountAlertSelector);
const newEventsCount = useSelector(newEventCountSelector);
const isNewNotification = useSelector(isNewNotificationSelector);
Expand Down Expand Up @@ -135,11 +137,12 @@ const SidebarContent = props => {
<Link to="/dashboard">
<i className="bx bxs-home"></i>
<span className="text-capitalize">{props.t('Dashboard')}</span>
{getDashboardNotificationCount() > 0 && (
<span className="new-info-indicator float-end">
{getDashboardNotificationCount()}
</span>
)}
{config?.display_menu_notifications &&
getDashboardNotificationCount() > 0 && (
<span className="new-info-indicator float-end">
{getDashboardNotificationCount()}
</span>
)}
</Link>
</li>
<li>
Expand All @@ -148,7 +151,7 @@ const SidebarContent = props => {
<span className="text-capitalize">
{props.t('fire-alerts')}
</span>
{newAlertsCount > 0 && (
{config?.display_menu_notifications && newAlertsCount > 0 && (
<span className="new-info-indicator float-end">
{newAlertsCount}
</span>
Expand All @@ -159,7 +162,7 @@ const SidebarContent = props => {
<Link to="/event-alerts">
<i className="bx bxs-hot"></i>
<span className="text-capitalize">{props.t('Events')}</span>
{newEventsCount > 0 && (
{config?.display_menu_notifications && newEventsCount > 0 && (
<span className="new-info-indicator float-end">
{newEventsCount}
</span>
Expand All @@ -172,7 +175,9 @@ const SidebarContent = props => {
<span className="text-capitalize">
{props.t('Data Layers')}
</span>
{isNewMapRequestAlert && !isMapRequestPageActive ? (
{config?.display_menu_notifications &&
isNewMapRequestAlert &&
!isMapRequestPageActive ? (
<span className="new-info-indicator float-end">
{newMapRequestCount}
</span>
Expand Down Expand Up @@ -201,7 +206,7 @@ const SidebarContent = props => {
<span className="text-capitalize">
{props.t('Recommendations')}
</span>
{isNewNotification && (
{config?.display_menu_notifications && isNewNotification && (
<span className="new-info-indicator float-end">
{newNotificationsCount}
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboard/Components/Notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const NotificationsBar = ({
<p className="align-self-baseline alert-title">
{t('Area of Interest')} : {nameOfAOI}
</p>
{config?.display_dashboard_notificatios ? (
{config?.display_dashboard_notifications ? (
<>
<Row xs={1} sm={2} md={3} lg={5}>
<NotificationCard
Expand Down

0 comments on commit 23d8b7a

Please sign in to comment.