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
4 changes: 2 additions & 2 deletions docs/agile docs/Living Document.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ Our app is different because it automatically creates a schedule to complete tas

**Data Models: Diagram** [https://dbdiagram.io/d/StressLess-67cb5f29263d6cf9a0a32612](https://dbdiagram.io/d/StressLess-67cb5f29263d6cf9a0a32612)

![image.png](Living%20Document%200cfda53982fb40e0bb52a6b3a1228e37/image%201.png)
![StressLessDB](https://github.com/user-attachments/assets/4084ee8d-2f37-490d-8dfd-41ea1dfae0e5)

## 5.2 Software Architecture

Expand Down Expand Up @@ -596,4 +596,4 @@ Answers: manual input(must be a valid time of day && after the start of the wor

- Cirillo, Francesco. (2019). *Pomofocus.* MicraSol LLP. **[https://pomofocus.io](https://pomofocus.io/)
- Google. (2025). *Google Calendar*. Google. [https://workspace.google.com/intl/en-US/products/calendar/](https://workspace.google.com/intl/en-US/products/calendar/)
- Salihefendić, Amir (2007). *Todoist*. Doist, Inc. [https://www.todoist.com](https://www.todoist.com/)
- Salihefendić, Amir (2007). *Todoist*. Doist, Inc. [https://www.todoist.com](https://www.todoist.com/)
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export default [
HTMLFormElement: "readonly",
setInterval: "readonly",
clearInterval: "readonly",
Notification: 'readonly',
setTimeout: 'readonly',
},
},
plugins: {
Expand Down
35 changes: 35 additions & 0 deletions frontend/src/app/dashboard/calendar/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,37 @@ export default function Home() {
});
const [isDeadline, setIsDeadline] = useState<boolean>(false);

useEffect(() => {
if (!('Notification' in window)) return;

Notification.requestPermission().then((permission) => {
if (permission === 'granted') {
const now = new Date();
console.log(allEvents);
allEvents.forEach((event) => {
console.log(event.start_time);
const eventTime = new Date(event.start_time);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added permissions to enable notifications

const delay = eventTime.getTime() - now.getTime();
console.log(
'Event:',
event.title,
'Time:',
event.start_time,
'Delay:',
delay
);
if (delay > 0) {
setTimeout(() => {
new Notification(`Event Reminder: ${event.title}`, {
body: `Starts at ${eventTime.toLocaleTimeString()}`,
});
}, delay);
}
});
}
});
}, [allEvents]);

// Fetching data from backend
useEffect(() => {
async function fetchSchedule() {
Expand Down Expand Up @@ -91,6 +122,9 @@ export default function Home() {
id: deadline.id,
title: deadline.title,
start: deadline.due_time ? new Date(deadline.due_time) : undefined,
start_time: deadline.due_time
? new Date(deadline.due_time)
: undefined,
description: deadline.description,
user_id: deadline.user_id,
// Optional: You could add more fields here if FullCalendar needs
Expand All @@ -103,6 +137,7 @@ export default function Home() {
id: event.id,
title: event.title,
start: event.start_time ? new Date(event.start_time) : undefined,
start_time: event.start_time ? new Date(event.start_time) : undefined,
end: event.end_time ? new Date(event.end_time) : undefined,
description: event.description,
user_id: event.user_id,
Expand Down