refactor: added notification icon in learning header

This commit is contained in:
SundasNoreen
2023-05-26 15:23:02 +05:00
parent 8ed18f3d69
commit 86939a2559
6 changed files with 100 additions and 30 deletions

View File

@@ -30,7 +30,6 @@ const NotificationRowItem = ({ notification }) => {
commentLiked: { icon: ThumbUpOutline, class: 'text-primary-500' },
edited: { icon: EditOutline, class: 'text-primary-500' },
};
return iconMap[type] || null;
};
@@ -38,7 +37,7 @@ const NotificationRowItem = ({ notification }) => {
const contentMessage = {
post: messages.notificationPostedContent,
help: messages.notificationHelpedContent,
respond: authenticatedUser.username !== notification.author
respond: (authenticatedUser && authenticatedUser.username) !== notification.author
? messages.notificationResponseOnOtherPostLabel : null,
comment: notification.targetUser
? messages.notificationCommentedOnLabel : messages.notificationCommentedOnYourPostLabel,
@@ -72,7 +71,7 @@ const NotificationRowItem = ({ notification }) => {
<>
{notification?.targetUser}
<span className="text-gray-500">
{authenticatedUser.username !== notification.author
{(authenticatedUser && authenticatedUser.username) !== notification.author
? intl.formatMessage(messages.notificationResponseOnOtherPostLabel)
: intl.formatMessage(messages.notificationResponseOnYourPostLabel)}
</span>

View File

@@ -132,6 +132,72 @@ export async function getNotifications(notificationType, notificationCount) {
time: '1684253736371',
author: 'testuser',
},
{
type: 'answer',
respondingUser: 'SCM_Lead',
notificationContent: 'Quiz in section 3 - Please explain the F-Significance value',
targetUser: '',
courseName: 'Supply Chain Analytics',
URL: '',
status: 'unread',
time: '1685096268835',
author: 'testuser',
},
{
type: 'endorsed',
respondingUser: '',
notificationContent: 'Quiz in section 3 - Please explain the F-Significance value',
targetUser: '',
courseName: 'Supply Chain Analytics',
URL: '',
status: 'unread',
time: '1685096268835',
author: 'testuser',
},
{
type: 'reported',
respondingUser: 'MITx Learners',
notificationContent: '“Here are the exam answers. Question 1 - CSA stands for Compliance Safety Ac...”',
targetUser: '',
courseName: 'Supply Chain Analytics',
URL: '',
status: 'unread',
time: '1685096268835',
author: '',
},
{
type: 'postLiked',
respondingUser: 'SCM_Lead',
notificationContent: 'Retaking the course',
targetUser: '',
courseName: 'Supply Chain Analytics',
URL: '',
status: 'unread',
time: '1685096268835',
author: '',
},
{
type: 'commentLiked',
respondingUser: 'MITx_Expert ',
notificationContent: 'Final exam answers',
targetUser: '',
courseName: 'Supply Chain Analytics',
URL: '',
status: 'unread',
time: '1685096268835',
author: '',
},
{
type: 'edited',
respondingUser: 'MITx_Expert ',
notificationContent: 'Question 1',
targetUser: '',
courseName: 'Supply Chain Analytics',
URL: '',
status: 'unread',
time: '1685096268835',
author: '',
},
];
const { today, earlier } = parseNotificationList(notificationData);