Skip to content

Commit

Permalink
Merge pull request #873 from AI4Bharat/notification
Browse files Browse the repository at this point in the history
Notification
  • Loading branch information
ishvindersethi22 authored Dec 22, 2023
2 parents e50979d + df07179 commit 8ab8247
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ui/pages/component/common/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ const Header = () => {
/>
);
};
const unseenNotifications = Notification?.filter(notification =>notification?.seen_json && !notification.seen_json[loggedInUserData.id]);
const unseenNotifications = Notification?.length>0 && Notification?.filter(notification =>notification?.seen_json && !notification.seen_json[loggedInUserData.id]);


const renderTabs = () => {
Expand Down Expand Up @@ -851,7 +851,7 @@ const Header = () => {
<Grid item xs={3} sm={3} md={2}>
<Tooltip title="Notifications">
<IconButton onClick={handleOpenNotification}>
<Badge badgeContent={unseenNotifications?.length > 0 ? unseenNotifications?.length : null} color="primary">
<Badge badgeContent={Notification?.length} color="primary">
<NotificationsIcon color="primary.dark" fontSize="large" />
</Badge>

Expand Down Expand Up @@ -1018,7 +1018,7 @@ const Header = () => {
>
<Stack direction="row" style={{ justifyContent: "space-between", padding: "0 10px 0 10px" }} >
<Typography variant="h4">Notifications</Typography>
{Notification && Notification?.length > 0 && unseenNotifications && unseenNotifications?.length>0? <IconButton aria-label="More" onClick={handleMoreHorizonClick}>
{Notification && Notification?.length > 0 ? <IconButton aria-label="More" onClick={handleMoreHorizonClick}>
<MoreHorizIcon />
</IconButton>:null}
</Stack>
Expand Down Expand Up @@ -1051,9 +1051,9 @@ const Header = () => {
</div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: "space-between" }}>
<Typography style={{ justifyContent: "flex-start", width: '100%' }} variant="body2">{notification?.title?.split('-')[1]}</Typography>
{unseenNotifications?.length>0?<IconButton aria-label="More" onClick={(event) => handleTitleMouseEnter(event, notification?.id)}>
<IconButton aria-label="More" onClick={(event) => handleTitleMouseEnter(event, notification?.id)}>
<MoreHorizIcon />
</IconButton>:null}
</IconButton>
</div>
<Typography variant="caption" color="action">{`Sent on: ${format(new Date(notification?.created_at), 'MMM d, yyyy')}`}</Typography>
</div>
Expand Down

0 comments on commit 8ab8247

Please sign in to comment.