feat: pomodoro counter + long break logic (Day 4)#27
Conversation
react-easy-crop uses blob: URLs to render the selected image. The existing img-src CSP blocked blob: causing a blank crop preview. Also ensure the react-easy-crop CSS import is present for correct image positioning. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Install vitest, @testing-library/react, @testing-library/jest-dom, jsdom
- 42 tests across 3 suites:
- lib/timer: computeTimeLeft, isTimerExpired, formatTime, createTimerState,
sessionToTimerState, computeProgress (29 tests)
- hooks/useTimer: start, pause, reset, setMode, skipAndStart, onExpire,
timeLeft floor, applyState (9 tests)
- lib/writeQueue: serialization order, error recovery, last-write wins (4 tests)
- Add `npm test` step to CI workflow (runs before typecheck + build)
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Init focusCount from session.pomos_done so cycle persists on refresh - Persist pomos_done to DB on every focus completion (both auto-break and manual skip paths) and reset to 0 on settings change - Fetch today's pomodoro count from pomodoro_logs on mount; show as "#N today" badge for authenticated users (optimistic +1 on completion) - Simplify round label to "N pomodoros completed" — consistent across all timer modes (focus / short break / long break) - Long break logic unchanged: triggers after settings.rounds completions Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 28 minutes and 36 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR establishes a comprehensive testing infrastructure using Vitest, adds test suites for the Changes
Sequence DiagramsequenceDiagram
participant SessionProvider
participant Supabase Query
participant Supabase DB
participant UI
SessionProvider->>SessionProvider: Initialize focusCountRef from session.pomos_done
SessionProvider->>Supabase Query: Fetch completed pomodoros since today start
Supabase Query->>Supabase DB: Query pomodoro_logs with completed_at >= start-of-today
Supabase DB-->>Supabase Query: Return count
Supabase Query-->>SessionProvider: Set todayCount state
SessionProvider->>UI: Render "#<todayCount> today" badge
rect rgba(100, 150, 200, 0.5)
Note over SessionProvider,Supabase DB: On focus completion or skip
SessionProvider->>SessionProvider: Increment todayCount
SessionProvider->>Supabase DB: Update sessions.pomos_done
Supabase DB-->>SessionProvider: Confirmation
SessionProvider->>UI: Update completion count label
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Use enqueueSessionUpdate (serialized write queue from main) instead of direct supabase calls in handleExpire and handleSkip, while keeping pomos_done persistence from this branch. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Changing durations/rounds is unrelated to completed pomodoro count. Removed pomos_done: 0 from handleApplySettings DB update and the in-memory focusCount reset. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Add three-tab layout to session screen: - Timer tab: existing timer UI (unchanged) - Tasks tab: placeholder for Day 7 - Stats tab: full stats dashboard with today's pomodoro count, focus minutes, sessions, duration; weekly bar chart; lifetime mastery grid (total pomodoros, focus hours, streaks); activity heatmap; profile card with avatar, name, bio Stats data fetched client-side from pomodoro_logs + profiles. Guests see a sign-in prompt on the Stats tab. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Summary
focusCountnow inits fromsession.pomos_done(DB-backed) instead of always starting at 0pomos_donewritten to DB on every focus completion (auto-break and manual skip paths) and reset to 0 on settings change#N todaybadge — fetches today's count frompomodoro_logson mount; increments optimistically on each completion (auth users only)settings.roundscompletionsTest plan
pomos_doneincrements in DB, label updates,#N todayincrementspomos_doneresets to 0 in DB and UI#N todaybadge hidden, rest works normally🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests
Chores