Skip to content

Commit bd2769d

Browse files
committed
Merge remote-tracking branch 'origin/dev' into fix-notification
2 parents cdd6a0e + ee7d51f commit bd2769d

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

Diff for: src/components/cards/Notification.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const NotificationPopup: React.FC<INotificationPop> = ({
2121
(state) => state.notifications,
2222
);
2323

24+
const recentNotifications = [...notifications].reverse().slice(0, 5);
2425
return (
2526
<Menu
2627
open={Boolean(anchorEl)}
@@ -67,7 +68,7 @@ export const NotificationPopup: React.FC<INotificationPop> = ({
6768
}}
6869
>
6970
{notifications.length > 0 ? (
70-
notifications.slice(0, 5).map((notification, index) => (
71+
recentNotifications.map((notification, index) => (
7172
<>
7273
<Link
7374
to={
@@ -82,7 +83,7 @@ export const NotificationPopup: React.FC<INotificationPop> = ({
8283
{notification.isRead ? (
8384
<FaEnvelopeOpenText className=" min-h-[30px] min-w-[30px] " />
8485
) : (
85-
<FaEnvelope className=" text-[30px]" />
86+
<FaEnvelope className=" text-[30px] min-w-[30px]" />
8687
)}
8788
<p className={` text-[13px] `}>{notification.message}</p>
8889
</Link>

Diff for: src/components/common/user-notifications/UserNotifcations.tsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import { useAppSelector } from "../../../redux/hooks";
77
import { getCurrentUser } from "../../../utils/currentuser";
88

99
const UserNotifications = () => {
10-
const { notifications } = useAppSelector((state) => state.notifications);
10+
const { notifications, currentUser } = useAppSelector(
11+
(state) => state.notifications,
12+
);
1113

1214
const formatDate = (dateString: Date) => {
1315
const date = new Date(dateString);
@@ -60,11 +62,17 @@ const UserNotifications = () => {
6062
}
6163

6264
return (
63-
<div className="mt-24 mb-4">
65+
<div
66+
className={` ${currentUser && currentUser.roleId === 2 && "mt-24"} mb-4`}
67+
>
6468
<div>
6569
{sortedNotifications.map((notification, index) => (
6670
<Link
67-
to={`/dashboard/notifications/${notification.id}`}
71+
to={
72+
currentUser && currentUser.roleId === 2
73+
? `/dashboard/notifications/${notification.id}`
74+
: `/notifications/${notification.id}`
75+
}
6876
key={index}
6977
className={`flex sm:flex-row flex-col justify-between items-center mb-[3px] p-4 rounded-md gap-4 ${notification.isRead ? "bg-[#FFFFFF]" : "bg-[#E1ECF4]"}`}
7078
>

Diff for: src/components/common/user-notifications/UserNotificationDetail.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import { readNotification } from "../../../redux/reducers/notificationSlice";
77

88
const UserNotificationDetail = () => {
99
const { id } = useParams<{ id: string }>();
10-
const { notifications } = useAppSelector((state) => state.notifications);
10+
const { notifications, currentUser } = useAppSelector(
11+
(state) => state.notifications,
12+
);
1113

1214
const dispatch = useAppDispatch();
1315

@@ -50,7 +52,9 @@ const UserNotificationDetail = () => {
5052
}, []);
5153

5254
return (
53-
<div className="mt-24 mb-4">
55+
<div
56+
className={` ${currentUser && currentUser.roleId === 2 && "mt-24"} mb-4`}
57+
>
5458
<div className="flex flex-col gap-4 p-4 rounded-md bg-[#FFFFFF] min-h-[80vh]">
5559
<p>
5660
When :

0 commit comments

Comments
 (0)