feat(pomodoro): add live Pomodoro timer with Firestore session history#278
Open
aayushprsingh wants to merge 1 commit into
Open
feat(pomodoro): add live Pomodoro timer with Firestore session history#278aayushprsingh wants to merge 1 commit into
aayushprsingh wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a live Pomodoro focus timer to the CodingOwl page, persisting completed sessions to Firestore and surfacing basic focus statistics and session history.
Changes:
- Replaces the placeholder/“coming soon” content with a functional Pomodoro timer UI.
- Introduces a Firestore-backed hook to save and fetch focus session history per user.
- Adds focus stats (total hours, sessions completed, average session length) and a session history list.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+75
to
+93
| useEffect(() => { | ||
| if (running) { | ||
| intervalRef.current = setInterval(() => { | ||
| setSecondsLeft((s) => { | ||
| if (s <= 1) { | ||
| clearInterval(intervalRef.current); | ||
| setRunning(false); | ||
| setCompleted(true); | ||
| onSessionComplete(25); | ||
| return 0; | ||
| } | ||
| return s - 1; | ||
| }); | ||
| }, 1000); | ||
| } else { | ||
| clearInterval(intervalRef.current); | ||
| } | ||
| return () => clearInterval(intervalRef.current); | ||
| }, [running, onSessionComplete]); |
Comment on lines
+79
to
+85
| if (s <= 1) { | ||
| clearInterval(intervalRef.current); | ||
| setRunning(false); | ||
| setCompleted(true); | ||
| onSessionComplete(25); | ||
| return 0; | ||
| } |
Comment on lines
+154
to
+158
| {completed && ( | ||
| <span className="text-xs font-bold text-emerald-600 dark:text-emerald-400 animate-pulse"> | ||
| ✅ Session saved to Firestore! | ||
| </span> | ||
| )} |
Comment on lines
+27
to
+33
| const q = query( | ||
| collection(db, "focusSessions"), | ||
| where("uid", "==", userId), | ||
| orderBy("completedAt", "desc") | ||
| ); | ||
| const snap = await getDocs(q); | ||
| setSessions(snap.docs.map((d) => ({ id: d.id, ...d.data() }))); |
| } | ||
|
|
||
| // --- Pomodoro Timer --- | ||
| const POMODORO_DURATION = 25 * 60; // 25 minutes in seconds |
| clearInterval(intervalRef.current); | ||
| setRunning(false); | ||
| setCompleted(true); | ||
| onSessionComplete(25); |
Comment on lines
+146
to
+151
| <button | ||
| onClick={reset} | ||
| className="p-2 rounded-xl font-bold border border-slate-200 dark:border-slate-800 text-slate-400 hover:text-slate-600 dark:hover:text-slate-300 transition-colors" | ||
| > | ||
| <RotateCcw className="w-4 h-4" /> | ||
| </button> |
da95885 to
c213a42
Compare
Owner
|
Conflict |
…h404#212) - Replace disabled static timer with a live 25-minute Pomodoro countdown - Circular progress ring with animated stroke transition - Start/Pause/Reset controls with state management - On completion: save session to Firestore 'focusSessions' collection (uid, durationMinutes, completedAt serverTimestamp) - usePomodoroHistory hook: reads sessions from Firestore ordered by completedAt desc - Aggregate stats cards: Total Hours Focused, Sessions Completed, Avg Session Length - Session history log (last 10 sessions) with date and duration badges - Graceful degradation when db is null (unconfigured) or user not signed in Closes indresh404#212
c213a42 to
6001a49
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements live Pomodoro Focus Session History with Firestore logging, addressing #212.
Changes
src/pages/CodingOwl.jsxNew: Live Pomodoro Timer
focusSessionscollection:uid— linked to the authenticated Firebase userdurationMinutes— always25(Pomodoro default)completedAt— FirestoreserverTimestamp()New:
usePomodoroHistoryHookcompletedAt desctotalHours,totalSessions,saveSession(),loadingNew: Aggregate Stats Cards
New: Session History Log
Firestore Collection
Testing
focusSessionscollection → confirm documents createdFixes #212