diff --git a/backend/task-manager/src/main/java/com/example/task_manager/service/NotificationService.java b/backend/task-manager/src/main/java/com/example/task_manager/service/NotificationService.java index 50ced310..52d0fbde 100644 --- a/backend/task-manager/src/main/java/com/example/task_manager/service/NotificationService.java +++ b/backend/task-manager/src/main/java/com/example/task_manager/service/NotificationService.java @@ -52,7 +52,7 @@ public void notifyTaskTitleChange(Task updatedTask, String oldTitle) { teamMember, updatedTask, NotificationType.TASK_TITLE_EDITED, - "Task Update: The title of a task was changed from \"" + oldTitle + "\" to \"" + updatedTask.getTitle() + "\"" + "Task Update: The title of a task was changed from \"" + oldTitle + "\" to \"" + updatedTask.getTitle() + "\" on " + LocalDate.now() ); } } @@ -67,7 +67,7 @@ public void notifyTaskDescriptionChange(Task updatedTask, String oldDescription) teamMember, updatedTask, NotificationType.TASK_DESCRIPTION_EDITED, - "Task Update: The description of a task was changed from \"" + oldDescription + "\" to \"" + updatedTask.getDescription() + "\"" + "Task Update: The description of a task was changed from \"" + oldDescription + "\" to \"" + updatedTask.getDescription() + "\" on " + LocalDate.now() ); } } @@ -82,7 +82,7 @@ public void notifyTaskLockChange(Task updatedTask, boolean oldLockStatus) { teamMember, updatedTask, NotificationType.TASK_LOCK_STATUS_CHANGED, - "Task Update: The lock status of a task was changed from \"" + oldLockStatus + "\" to \"" + updatedTask.isLocked() + "\"" + "Task Update: The lock status of a task was changed from \"" + oldLockStatus + "\" to \"" + updatedTask.isLocked() + "\" on " + LocalDate.now() ); } } @@ -98,7 +98,7 @@ public void notifyTaskDueDateChange(Task updatedTask, LocalDate oldDueDate) { updatedTask, NotificationType.TASK_DUE_DATE_EDITED, "Task Update: The due date of a task was changed from \"" + oldDueDate + "\" to \"" + updatedTask.getDueDate() - + "\""); + + "\" on " + LocalDate.now()); } } @@ -112,7 +112,7 @@ public void notifyTaskStatusChange(Task updatedTask, String oldStatus) { teamMember, updatedTask, NotificationType.TASK_STATUS_EDITED, - "Task Update: The status of a task was changed from \"" + oldStatus + "\" to \"" + updatedTask.getStatus() + "\"" + "Task Update: The status of a task was changed from \"" + oldStatus + "\" to \"" + updatedTask.getStatus() + "\" on " + LocalDate.now() ); } } @@ -120,19 +120,19 @@ public void notifyTaskStatusChange(Task updatedTask, String oldStatus) { //notify member when task is assigned public void notifyTaskAssignment(TeamMember teamMember, Task task) { createNotification(teamMember, task, NotificationType.TASK_ASSIGNED, - "You have been assigned to a task: \"" + task.getTitle()); + "You have been assigned to a task: \"" + task.getTitle() + "\" on " + LocalDate.now()); } //notify member when task is unassigned public void notifyTaskUnassignment(TeamMember teamMember, Task task) { createNotification(teamMember, task, NotificationType.TASK_UNASSIGNED, - "You have been unassigned from a task: \"" + task.getTitle()); + "You have been unassigned from a task: \"" + task.getTitle() + "\" on " + LocalDate.now()); } //notify member when they are added to a team public void notifyTeamAssignment(TeamMember teamMember, Team team) { createNotification(teamMember, null, NotificationType.TEAM_ASSIGNED, - "You have been assigned to a team: \"" + team.getTeamName()); + "You have been assigned to a team: \"" + team.getTeamName() + "\" on " + LocalDate.now()); } //notify member when they are removed from a team diff --git a/backend/task-manager/src/main/java/com/example/task_manager/service/TeamMemberService.java b/backend/task-manager/src/main/java/com/example/task_manager/service/TeamMemberService.java index 59df3130..061f6703 100644 --- a/backend/task-manager/src/main/java/com/example/task_manager/service/TeamMemberService.java +++ b/backend/task-manager/src/main/java/com/example/task_manager/service/TeamMemberService.java @@ -146,14 +146,16 @@ public TaskDTO editTask(int taskId, TaskDTO taskDTO) { String oldStatus = task.getStatus(); LocalDate oldDueDate = task.getDueDate(); - if (taskDTO.getTitle() != null && !taskDTO.getTitle().isEmpty()) { + if ((taskDTO.getTitle() != null && !taskDTO.getTitle().isEmpty()) && + (!taskDTO.getTitle().equals(oldTitle))) { task.setTitle(taskDTO.getTitle()); //call notif method notifService.notifyTaskTitleChange(task, oldTitle); } - if (taskDTO.getDescription() != null && !taskDTO.getDescription().isEmpty()) { + if (taskDTO.getDescription() != null && !taskDTO.getDescription().isEmpty()&& + (!taskDTO.getDescription().equals(oldDescription))) { task.setDescription(taskDTO.getDescription()); //call notif method @@ -174,7 +176,7 @@ public TaskDTO editTask(int taskId, TaskDTO taskDTO) { notifService.notifyTaskStatusChange(task, oldStatus); } - if (taskDTO.getDueDate() != null) { + if (taskDTO.getDueDate() != null && !taskDTO.getDueDate().equals(oldDueDate)) { task.setDueDate(taskDTO.getDueDate()); //call notif method diff --git a/frontend/react-app/src/css/Notifications.css b/frontend/react-app/src/css/Notifications.css index 384dbd40..bc244fc1 100644 --- a/frontend/react-app/src/css/Notifications.css +++ b/frontend/react-app/src/css/Notifications.css @@ -1,19 +1,21 @@ #notifContainer { - background-color: white; - width: 600px; + background-color: white;; + width: 75%; height: 500px; - margin: auto; + margin: left; + padding: 2%; font-family: Arial, Helvetica, sans-serif; } #notifContainer table { - width: 100%; + width: 130%; } + #notifContainer thead td { width: 100%; color: white; - background-color: #254E58; + background-color: #52799d; } /* #notifContainer tbody td { */ @@ -28,10 +30,6 @@ text-align: left !important; } -#notifContainer tbody td { - background-color: white; -} - #notifContainer input { border: none; } @@ -43,9 +41,11 @@ .subHeader { text-align: left !important; padding-left: 10px; + color: white; + background-color: #52799d; } -.delete { +.delete{ } @@ -67,4 +67,14 @@ border: none; background-color: black; +} + + +.notifBox { + width: 75%; + +} + +.column-box { + width: 120%; } \ No newline at end of file diff --git a/frontend/react-app/src/pages/Notifications.jsx b/frontend/react-app/src/pages/Notifications.jsx index 1963b0e4..ebe2c5ed 100644 --- a/frontend/react-app/src/pages/Notifications.jsx +++ b/frontend/react-app/src/pages/Notifications.jsx @@ -1,3 +1,4 @@ +import TaskList from "../components/TaskList"; import React, { useEffect, useMemo, useState } from 'react'; import '../css/Notifications.css'; import Notification from "../components/Notification"; @@ -84,6 +85,7 @@ const Notifications = () => { // reusable section component const NotificationSection = ({ title, items }) => ( items.length > 0 && ( + <> {title} @@ -96,6 +98,7 @@ const Notifications = () => { deleteNotification={deleteNotification} /> ))} + ) ); @@ -107,87 +110,22 @@ const Notifications = () => {
- - - - - - - - - - -
Notifications
-
+
+

My Notifications

+
+
+ + + + + +
+
+
+
); }; -export default Notifications; - - -//before refactoring - - -// import React from 'react'; -// import {useEffect, useState} from 'react'; -// import '../css/Notifications.css'; -// import Notification from "../components/Notification"; - -// const Notifications = () => { -// const [notifications, setNotifications] = useState([ -// {id: 1, team: "Team 2", message: 'Bob edited your task "Create wireframe"', read: false}, -// { id: 2, team: "Team 1", message: 'Mary completed your task "Code things"', read: false }, -// { id: 3, team: "Team 1", message: 'Adam assigned you to "Code more"', read: true } -// ]); - -// //mark as read or unread -// const toggleRead = (id) => { -// setNotifications(notifications.map(notif => -// notif.id === id ? { ...notif, read: !notif.read } : notif -// )); -// }; - -// //delete any notification -// const deleteNotification = (id) => { -// setNotifications(notifications.filter(notif => notif.id !== id)); -// }; - -// return ( -//
-// -// -// -// -// -// -// -// {notifications.some(notif => !notif.read) && ( -// <> -// -// -// -// {notifications.filter(notif => !notif.read).map(notif => ( -// -// ))} -// -// )} - -// {notifications.some(notif => notif.read) && ( -// <> -// -// -// -// {notifications.filter(notif => notif.read).map(notif => ( -// -// ))} -// -// )} -// -//
Notifications
Unread
Read
-//
-// ) -// } - -// export default Notifications; \ No newline at end of file +export default Notifications; \ No newline at end of file