Skip to content

Feature: Time tracking per task + time dashboard #77

Description

@manucompiles

What we're building

Toggl-style time tracking tied to each task. A per-task play/stop control logs work intervals; a floating bar shows the running timer with live elapsed time; a timeline dashboard (/time) renders those intervals as project-colored blocks on a vertical hour axis, with a day/week toggle, date navigation, and click-to-add/click-to-edit. Projects gain a color for block coloring.

Scope

  • Backend: TimeEntry table (start/stop intervals), Project.Color column, TimeEntriesController (7 endpoints), migration
  • Frontend: TimeTrackingContext (1s-tick, single running timer), TrackingBar (persistent bottom bar + quick-start), TimerControl (per-task row), TimelineView (/time page), ProjectColorPicker, ColorPickerButton, LabelColorButton
  • MCP: 7 time tools (start/stop/active/log/edit/delete/summary) + 5 habit/comment tools + project color on create/rename = 29 tools total

Plan

docs/plans/P77-time-tracking.md

Outcome

What was built:

  • TimeEntry DB table (start/stop intervals; EndedAt null = running); Project.Color nullable hex column; EF Core migration applied
  • TimeEntriesController: start (auto-stops prior), stop (idempotent), active (204 when idle), manual log, edit bounds, delete, range list (overlap filter, 366-day cap, future-end guard)
  • ProjectsController: create/rename accept optional color (#RRGGBB validated)
  • TimeTrackingContext: React context holding active entry + 1s nowMs tick (only while running); rehydrates on mount; quickStart (create Inbox task + startTimer in one step)
  • TrackingBar: always-visible bottom bar - idle = quick-start composer with inline error; running = title + H:MM:SS + stop
  • TimerControl: hover-reveal per-task play/stop on list rows, TaskCard, BoardCard, detail page
  • TimelineView: hour grid with day/week toggle, project-colored blocks, now-line, snap-to-5min/exact, Inbox color picker, add/edit/delete popover, per-task totals
  • ColorPickerButton + LabelColorButton: reusable swatch-button popovers replacing legacy ColorPicker.tsx
  • MCP time tools: start_timer, stop_timer, get_active_timer, log_time, edit_time_entry, delete_time_entry, get_time_summary
  • MCP habit/comment tools: get_habits, undo_habit_checkin, get_habit_checkins, list_task_comments, delete_task_comment
  • MCP project tools: create_project + rename_project accept color param

Verified:

  • Backend tests: 285 pass (up from 270); auto-stop-on-start, single-running invariant, end<=start 400, edit/delete, project color validation
  • Frontend tests: 155 pass (up from 143); lib/time math (daySegment/split/totals), formatDuration/formatClock
  • Browser smoke: start timer -> bar; start 2nd -> 1st auto-stops; /time week+day views; add popover; stop clears bar; 0 console errors
  • Code review R1-R14 all applied (UTC range fix, midnight clamp, stable useCallback, localStorage hex validation, partial-failure re-throw, future-date guard, range cap, MCP race/overflow/boundary fixes)

Issues raised during this work:
none

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions