Click Tracker is an Electron-based desktop application built with React that helps users monitor their productivity by tracking time duration, mouse clicks, and keyboard activity across different projects and tasks. The app uses system-level hooks (uiohook-napi) to capture user activity and stores data in a local SQLite database.
Current Tech Stack:
- Frontend: React 19.2.4 with React Hooks
- Backend: Electron 40.3.0 with Node.js
- Database: SQLite3 (stored in %APPDATA%/click-tracker/)
- Activity Tracking: uiohook-napi 1.5.4
- Build: Webpack 5.105.1
Current State:
- Basic project creation and selection ✅
- Task start/stop with timer ✅
- Real-time click and keyboard tracking ✅
- Database persistence ✅
- Multi-process architecture with centralized uIOhook management ✅
Current Status: ✅ Implemented
Requirements:
- User can click "+ New Project" button in the sidebar
- Modal/form appears with input field for project name and optional description
- Project is saved to SQLite database with timestamp
- New project appears in the project list immediately
- Project is automatically selected after creation
Current Status: ❌ Not Implemented
Requirements:
- Add a delete/trash icon button next to each project in the sidebar list
- Show confirmation dialog before deletion: "Are you sure you want to delete '[Project Name]'? All tasks and activity data will be permanently removed."
- Provide two options: "Cancel" and "Delete Permanently" (red button)
- On confirmation:
- Delete project record from
projectstable - Delete all associated tasks from
taskstable (CASCADE) - Delete all associated activity events from
activity_eventstable (CASCADE) - Remove project from UI immediately
- If deleted project was selected, show welcome screen
- Delete project record from
- Display toast notification: "Project '[Name]' and all associated data deleted successfully"
Database Implementation:
-- Add CASCADE to foreign keys in database.js
-- Tasks deletion will auto-cascade to activity_events
DELETE FROM projects WHERE id = ?;Current Status: 🔶 Partial (can select, but no explicit activation state)
Requirements:
- Add visual "Active" indicator badge on selected project (green dot or "Active" label)
- Only one project can be active at a time
- When no project is selected/active:
- Task management area shows: "Please select a project to manage tasks"
- All task buttons are disabled/grayed out
- "+ New Task" button is disabled
- When project is activated (selected):
- Task management area becomes fully interactive
- User can add, delete, start, and stop tasks
- Task history is visible
- Store active project ID in app state and persist to localStorage for session recovery
Current Status: ✅ Implemented (via input + "Start Task")
Enhancement Requirements:
- Add separate "+ New Task" button that creates task WITHOUT auto-starting
- Task appears in task list with status: "Not Started"
- User must manually click "Start" button to begin tracking
- Allow pre-creating multiple tasks before starting work
Current Status: ❌ Not Implemented
Requirements:
- Add delete icon (trash/X) button in each task row (visible on hover)
- Cannot delete task while it's actively running (show tooltip: "Stop task before deleting")
- Show confirmation dialog: "Delete task '[Task Name]'? All recorded activity data will be removed."
- On confirmation:
- Delete task from
taskstable - Delete all associated activity events (CASCADE)
- Remove from UI immediately
- Show toast notification: "Task deleted successfully"
- Delete task from
Current Status: 🔶 Partial (only available for active task)
Requirements:
Each task row should display these buttons based on task state:
A. Start Button (
- Visible when: Task is not running
- Action:
- Start timer (00:00:00)
- Initialize tracking counters (clicks: 0, keys: 0)
- Start uIOhook listeners globally
- Record start time to database
- Button changes to "Stop" button
- Other tasks' start buttons become disabled (only one task can run at a time)
- Task row gets highlighted border (e.g., blue glow)
- Display: Green circular button with white play icon
B. Stop Button (⏹️ Stop Icon)
- Visible when: Task is currently running
- Action:
- Stop timer and freeze display
- Stop tracking (remove listeners)
- Calculate total duration
- Save final stats to database:
duration_seconds,end_time - Button changes back to "Start" button
- Remove highlighted border from task row
- Re-enable other tasks' start buttons
- Update task totals display
- Display: Red circular button with white stop icon
C. View Details/Log Button (📊 Chart/List Icon)
- Visible: Always (for all tasks, even not started)
- Action:
- Open modal/expandable panel showing detailed activity log
- Display session breakdown (see Section 2.4)
- Show graphs/charts if applicable
- Display: Blue/gray icon button
D. Delete Button (🗑️ Trash Icon)
- Visible: On hover over task row
- Action: Trigger task deletion flow (see 2.2)
- State: Disabled while task is running
- Display: Gray icon that turns red on hover
Current Status: ❌ Not Implemented
Requirements:
When user clicks "View Details" button on a task, show a modal or expandable panel with:
Session History Table:
| Session # | Start Time | End Time | Duration | Clicks | Keystrokes |
|---|---|---|---|---|---|
| 1 | 2026-02-11 09:15:23 | 2026-02-11 10:45:12 | 1h 29m 49s | 1,247 | 8,543 |
| 2 | 2026-02-11 14:30:05 | 2026-02-11 15:00:22 | 30m 17s | 423 | 2,891 |
| Total | - | - | 2h 0m 6s | 1,670 | 11,434 |
Additional Information:
- Average clicks per minute
- Average keystrokes per minute
- Most productive time range
- Activity timeline visualization (optional)
- Export button to CSV/Excel
Database Query:
- Group activity events by task session (start/stop pairs)
- Aggregate clicks and keystrokes per session
- Calculate time differences
Current Status: 🔶 Shows task name and duration only
Enhanced Requirements:
Each task in the task list should display:
Layout:
[Task Name] [Duration] [Clicks] [Keystrokes] [▶️] [📊] [🗑️]
────────────────────────────────────────────────────────────────────────────────
Design Mockups 2h 34m 1,234 5,678 ▶️ 📊 🗑️
Write Documentation 45m 12s 423 2,891 ▶️ 📊 🗑️
Code Review 00:15:34 89 456 ⏹️ 📊 🗑️ ← (Active/Running)
Visual States:
- Not Running: Default background, all stats visible, Start button enabled
- Running (Active): Blue glow border, stats updating in real-time, Stop button visible
- Hover: Slight highlight, delete button appears
- Completed: Checkmark icon, final stats locked
Current Status: ✅ Timer updates, clicks/keys update
Enhancement:
- Add smooth counter animations when numbers increment
- Consider throttling updates to every 1 second for performance
- Show activity indicator (pulsing dot) when tracking is active
Requirements:
- Add project statistics preview (total tasks, total time)
- Show "Active" badge on currently selected project
- Add context menu (right-click) with options:
- Rename Project
- Delete Project
- Export Project Data
- Duplicate Project
- Display project creation date on hover
Requirements:
- No projects: "Get started by creating your first project" with large "+ Create Project" button
- No tasks in project: "No tasks yet. Add a task to start tracking your productivity."
- No activity logged: "Start a task to begin tracking your activity"
Requirements:
- Toast notifications for all actions (create, delete, start, stop)
- Confirmation dialogs for destructive actions (delete)
- Loading states during database operations
- Success/error visual feedback
Requirements:
- Prevent data loss if app crashes during active tracking
- Auto-save progress every 30 seconds when task is running
- On app restart, check for incomplete tasks and offer to:
- Resume tracking
- Save and finalize (estimate end time)
- Discard session
Current Tables: projects, tasks, activity_events
Proposed Enhancements:
-- Add sessions table for better tracking
CREATE TABLE IF NOT EXISTS task_sessions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
task_id INTEGER NOT NULL,
start_time DATETIME NOT NULL,
end_time DATETIME,
duration_seconds INTEGER,
total_clicks INTEGER DEFAULT 0,
total_keystrokes INTEGER DEFAULT 0,
status TEXT DEFAULT 'active', -- active, completed, interrupted
FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE
);
-- Add soft delete for projects
ALTER TABLE projects ADD COLUMN deleted_at DATETIME NULL;
ALTER TABLE projects ADD COLUMN is_archived BOOLEAN DEFAULT 0;- ✅ Fix uIOhook singleton management (COMPLETED)
- Add task delete functionality
- Add project delete functionality
- Implement task state management (can't start multiple tasks)
- Add confirmation dialogs
- Implement activity log/details modal
- Add session tracking to database
- Enhance task row UI with all buttons
- Add real-time stats updates
- Implement toast notifications
- Add export to CSV/Excel functionality
- Add charts and visualizations
- Implement project statistics dashboard
- Add keyboard shortcuts (Ctrl+N for new project, Space to start/stop)
- Add settings panel (theme, shortcuts, auto-save interval)
- Open App → Dashboard loads with project list
- Create Project → "Website Redesign" project created
- Select Project → Project becomes active, task area enabled
- Add Tasks → Create 3 tasks: "Research", "Design", "Development"
- Start Task → Click play on "Research", timer starts, activity tracked
- Work → User works normally, clicks/keys counted automatically
- Stop Task → Click stop, stats saved and displayed
- View Details → Click log icon to see detailed breakdown
- Switch Tasks → Start "Design" task, previous task remains stopped
- End Session → Close app, all data persisted
- Keyboard navigation support (Tab, Enter, Escape)
- Screen reader support (ARIA labels)
- Minimum touch target size: 44x44px for all buttons
- Color contrast ratio: WCAG AA compliant
- Focus indicators on all interactive elements
- Tooltips on hover for all icon buttons
- Database queries optimized with indexes
- Debounce activity event writes (batch inserts every 5 seconds)
- Virtual scrolling for long task lists (100+ tasks)
- Lazy loading of activity log data
- Memory-efficient event listener management
- Maximum 3% CPU usage during idle tracking
Files to Modify:
src/components/ProjectList.js- Add delete button, active statesrc/components/TaskTracker.js- Enhance with all buttons and statessrc/services/database.js- Add delete methods, session trackingsrc/main.js- Add IPC handlers for new functionalitysrc/styles/*.css- Update for new UI elements
Testing Checklist:
- Can create and delete projects
- Can create and delete tasks
- Only one task runs at a time
- All data persists correctly
- No data loss on app crash
- Activity tracking accurate
- UI responsive and smooth
- Confirmation dialogs work
- Toast notifications appear
- Activity log displays correctly
Known Limitations:
- System-wide tracking captures ALL activity (not app-specific)
- Requires elevated permissions on some systems
- Cannot track activity in virtual machines reliably
- May need to whitelist in antivirus software