diff --git a/docs/agile docs/Living Document.md b/docs/agile docs/Living Document.md index f69c27bb..3edf7141 100644 --- a/docs/agile docs/Living Document.md +++ b/docs/agile docs/Living Document.md @@ -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 @@ -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/) \ No newline at end of file +- Salihefendić, Amir (2007). *Todoist*. Doist, Inc. [https://www.todoist.com](https://www.todoist.com/) diff --git a/eslint.config.mjs b/eslint.config.mjs index 5571e808..171a834f 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -28,6 +28,8 @@ export default [ HTMLFormElement: "readonly", setInterval: "readonly", clearInterval: "readonly", + Notification: 'readonly', + setTimeout: 'readonly', }, }, plugins: { diff --git a/frontend/src/app/dashboard/calendar/page.tsx b/frontend/src/app/dashboard/calendar/page.tsx index c6c25b0b..b2f4880e 100644 --- a/frontend/src/app/dashboard/calendar/page.tsx +++ b/frontend/src/app/dashboard/calendar/page.tsx @@ -64,6 +64,37 @@ export default function Home() { }); const [isDeadline, setIsDeadline] = useState(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); + 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() { @@ -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 @@ -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,