trackWork 0.2.0

A terminal-based time tracking application for managing work sessions
# TimeTrack

A powerful console-based time tracking application built with Rust featuring a beautiful terminal UI.

## Features

- **Terminal UI**: Clean, intuitive interface built with ratatui
- **Time Entry Management**: Create, edit, delete, and reorder time entries
- **Navigation**: Easy keyboard-driven navigation
- **Daily Views**: View and track entries by date
- **Running Timers**: Start entries without an end time and stop them later
- **Duration Tracking**: Automatic calculation and display of time durations
- **Persistent Storage**: SQLite database for reliable data storage
- **Date Navigation**: Browse entries across different days

## Installation

### Build from source

```bash
cargo build --release
```

The binary will be available at `target/release/timetrack`

### Run

```bash
cargo run --release
```

## Usage

### Keyboard Shortcuts

#### Normal Mode
- `n` - Create new time entry
- `e` - Edit selected entry
- `d` - Delete selected entry
- `s` - Stop running entry (set end time to now)
- `↑/↓` - Navigate between entries
- `Ctrl+↑/↓` - Reorder entries (move up/down)
- `←/→` - Change date (previous/next day)
- `q` - Quit application

#### Edit/Create Mode
- Type to enter data in the current field
- `Tab` - Move to next field (Description → Start Time → End Time)
- `Enter` - Save entry
- `Esc` - Cancel and return to normal mode
- `Backspace` - Delete character

### Time Format

Enter times in 24-hour format: `HH:MM` (e.g., `09:30`, `14:45`)

Leave the end time empty to create a running timer.

### Data Storage

The application stores all data in `~/.timetrack.db` (SQLite database).

## Project Structure

```
src/
├── main.rs       # Application entry point and event loop
├── app.rs        # Core application logic and state management
├── db.rs         # Database operations and SQLite interface
├── models.rs     # Data models (TimeEntry)
└── ui.rs         # Terminal UI rendering (separated from business logic)
```

### Architecture

The application follows a clean separation of concerns:

- **UI Layer** (`ui.rs`): Handles all rendering and display logic
- **App Layer** (`app.rs`): Manages application state and user interactions
- **Data Layer** (`db.rs`, `models.rs`): Database operations and data structures

This separation makes the codebase maintainable and testable.

## Example Workflow

1. Launch the application
2. Press `n` to create a new entry
3. Enter description (e.g., "Client meeting")
4. Tab to start time, enter `09:00`
5. Tab to end time, leave empty for running timer (or enter `10:30`)
6. Press Enter to save
7. Use `↑/↓` to select entries
8. Press `s` to stop a running timer
9. Use `Ctrl+↑/↓` to reorder entries
10. Use `←/→` to view different days

## Dependencies

- `ratatui` - Terminal UI framework
- `crossterm` - Cross-platform terminal manipulation
- `rusqlite` - SQLite database interface
- `chrono` - Date and time handling
- `anyhow` - Error handling
- `dirs` - Home directory detection

## License

MIT