diff --git a/frontend/public/sounds/alert.mp3 b/frontend/public/sounds/alert.mp3 new file mode 100644 index 0000000..d9dbf34 Binary files /dev/null and b/frontend/public/sounds/alert.mp3 differ diff --git a/frontend/src/Components/DashBoard/PomodoroTimer.jsx b/frontend/src/Components/DashBoard/PomodoroTimer.jsx index dfa07cc..ad3c8fe 100644 --- a/frontend/src/Components/DashBoard/PomodoroTimer.jsx +++ b/frontend/src/Components/DashBoard/PomodoroTimer.jsx @@ -1,4 +1,4 @@ -import { useContext } from "react"; +import { useContext, useEffect } from "react"; import Navbar from "../Navbar/Navbar"; import ThemeContext from "../ui/theme-provider.jsx"; import { useTimer } from "../../context/TimerContext.jsx"; @@ -79,10 +79,24 @@ export default function PomodoroTimer() { const minutes = Math.floor(timeLeft / 60); const seconds = timeLeft % 60; + useEffect(() => { + // Check if the timer is at 0:00. We rely on the context to switch phases. + // We only play the sound if the timer hits zero while running. + if (timeLeft === 0) { + const audio = document.getElementById('timer-end-sound'); + if (audio) { + audio.play().catch(error => { + // Log error if browser blocks auto-play + console.error("Audio playback blocked:", error); + }); + } + } + }, [timeLeft]); // only re-runs when timeLeft changes + return (
-
+

{isWork ? "Focus Time 💻" : "Break Time ☕"}

@@ -122,6 +136,8 @@ export default function PomodoroTimer() { Session {sessions + 1} {isWork ? "(Work)" : "(Break)"}

+
+ ); } diff --git a/frontend/src/Components/Features.jsx b/frontend/src/Components/Features.jsx index 4846db2..22bf607 100644 --- a/frontend/src/Components/Features.jsx +++ b/frontend/src/Components/Features.jsx @@ -1,4 +1,5 @@ // src/Components/FeaturesSectionDemo.jsx +import { Link } from 'react-router-dom'; // <-- ADD THIS LINE import { cn } from "@/lib/utils"; import { Activity, @@ -72,14 +73,22 @@ const Feature = ({ icon, index, }) => { + const isPomodoro = title === "Live Pomodoro Timer"; + + // Use 'Link' component if it's Pomodoro, otherwise use a regular 'div' + const Component = isPomodoro ? Link : 'div'; + return ( -
{/* Absolute positioned overlay for a subtle highlight effect */} @@ -97,6 +106,6 @@ const Feature = ({

{description}

-
+ ); }; \ No newline at end of file diff --git a/frontend/src/context/TimerContext.jsx b/frontend/src/context/TimerContext.jsx index 79e2d26..26ed98f 100644 --- a/frontend/src/context/TimerContext.jsx +++ b/frontend/src/context/TimerContext.jsx @@ -70,8 +70,9 @@ export function TimerProvider({ children }) { setIsWork(prev => !prev); setTimeLeft(nextTime); - setEndTimestamp(Date.now() + nextTime * 1000); - setIsRunning(true); + + setEndTimestamp(null);//stopped auto-restart + setIsRunning(false);//stopped the timer loop if ("Notification" in window && Notification.permission === "granted") { new Notification(