Skip to content

Conversation

@Bahaaio
Copy link
Owner

@Bahaaio Bahaaio commented Jan 25, 2026

Summary

  • Add SQLite database for session persistence
  • Add pomo stats command with productivity visualizations
  • Track work/break sessions automatically when timer completes

Features

  • Duration ratio — total work vs break time bar
  • Weekly bar chart — daily work hours for past 7 days
  • 4-month heatmap — GitHub-style activity grid (requires Nerd Font)
  • Streak tracking — current and best consecutive work days

Screenshots
stats

Technical Changes

  • db/ — SQLite connection, repository pattern, session models
  • ui/stats/ — Bubble Tea view with modular components
  • ui/colors/ — expanded purple gradient palette for heatmap
  • cmd/stats.go — new stats subcommand

Closes #4

- add SQLite database initialization
- create sessions table with minimal schema
- add 'pomo stats' subcommand to display session statistics
- show all-time totals (sessions, work time, break time)
- display last 7 days of work sessions
- basic text-based view with quit keybinding
- add BarChart component with dynamic Y-axis scaling
- display last 7 days of work sessions as vertical bars
- use millisecond-precision scale calculation to prevent rounding errors
- add formatDuration helper for clean time labels (hours, minutes, seconds)
- integrate bar chart into stats view with alt-screen mode
- add component showing all-time work/break duration ratio
- replace text stats with ratio component
- add WorkSessionFG color constant matching timer purple
- apply color to work session bars in bar chart
- color work portion of duration ratio bar
- fix typos
- add palette constants
- convert semantic constants to use palette references
- fix typo WorkSessionFG to WorkSessionFg
- add BreakSessionFg for future break visualization
- add GetSessionType() helper to convert TaskType to SessionType
- initialize SessionRepo in timer Model constructor
- save completed sessions to database in recordSession()
- skip recording sessions shorter than 1 second
- log errors on session save failure
- add heatmap component with GitHub-style activity grid
- expand color palette with purple gradient for intensity levels
- refactor db.Init to db.Connect, returning errors instead of nil
- extract migration logic into separate migrate() function
- replace panics with error message view in stats
- add doc comments to repository and color utility functions
- rename GetMonthlyStats to GetLastMonthsStats with configurable months
- rename numberOfDays to daysInWeek in bar_chart for clarity
- add streak calculation with current and best consecutive work days

Closes #4
- log warning instead of crashing when db connection fails
- add nil check before recording sessions
- show warning in session summary when db unavailable
@Bahaaio Bahaaio self-assigned this Jan 25, 2026
@Bahaaio Bahaaio merged commit 1c1c618 into main Jan 25, 2026
2 checks passed
@Bahaaio Bahaaio mentioned this pull request Jan 25, 2026
@Bahaaio Bahaaio deleted the stats branch January 25, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement streaks?

2 participants