Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}
}
Expand All @@ -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()
);
}
}
Expand All @@ -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()
);
}
}
Expand All @@ -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());
}
}

Expand All @@ -112,27 +112,27 @@ 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()
);
}
}

//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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
30 changes: 20 additions & 10 deletions frontend/react-app/src/css/Notifications.css
Original file line number Diff line number Diff line change
@@ -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 { */
Expand All @@ -28,10 +30,6 @@
text-align: left !important;
}

#notifContainer tbody td {
background-color: white;
}

#notifContainer input {
border: none;
}
Expand All @@ -43,9 +41,11 @@
.subHeader {
text-align: left !important;
padding-left: 10px;
color: white;
background-color: #52799d;
}

.delete {
.delete{

}

Expand All @@ -67,4 +67,14 @@
border: none;
background-color: black;

}


.notifBox {
width: 75%;

}

.column-box {
width: 120%;
}
96 changes: 17 additions & 79 deletions frontend/react-app/src/pages/Notifications.jsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -84,6 +85,7 @@ const Notifications = () => {
// reusable section component
const NotificationSection = ({ title, items }) => (
items.length > 0 && (

<>
<tr>
<td colSpan="4" className="subHeader">{title}</td>
Expand All @@ -96,6 +98,7 @@ const Notifications = () => {
deleteNotification={deleteNotification}
/>
))}

</>
)
);
Expand All @@ -107,87 +110,22 @@ const Notifications = () => {
<Header/>
<div className='pageBody'>
<div id="notifContainer">
<table>
<thead>
<tr>
<td colSpan="4">Notifications</td>
</tr>
</thead>
<tbody>
<NotificationSection title="Unread" items={memoizedUnReadNotifications} />
<NotificationSection title="Read" items={memoizedReadNotifications} />
</tbody>
</table>
</div>
<div className="column-box">
<h2>My Notifications</h2>
<div className="section-divider"></div>
<div className ="notifBox">
<table>
<tbody>
<NotificationSection title="Unread" items={memoizedUnReadNotifications} />
<NotificationSection title="Read" items={memoizedReadNotifications} />
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
);
};

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 (
// <div id="notifContainer">
// <table>
// <thead>
// <tr>
// <td colSpan="4">Notifications</td>
// </tr>
// </thead>
// <tbody>
// {notifications.some(notif => !notif.read) && (
// <>
// <tr>
// <td colSpan="4" className="subHeader">Unread</td>
// </tr>
// {notifications.filter(notif => !notif.read).map(notif => (
// <Notification key={notif.id} notif={notif} toggleRead={toggleRead} deleteNotification={deleteNotification} />
// ))}
// </>
// )}

// {notifications.some(notif => notif.read) && (
// <>
// <tr>
// <td colSpan="4" className="subHeader">Read</td>
// </tr>
// {notifications.filter(notif => notif.read).map(notif => (
// <Notification key={notif.id} notif={notif} toggleRead={toggleRead} deleteNotification={deleteNotification} />
// ))}
// </>
// )}
// </tbody>
// </table>
// </div>
// )
// }

// export default Notifications;
export default Notifications;