trackWork 0.6.0

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

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

**⚠️ Early Development Status**: This project is in very early stages of development. Many features are experimental and may not work reliably. Expect bugs, incomplete functionality, and breaking changes. Use at your own risk!

## 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
- **Timeline Visualization**: Vertical bar chart with fixed time resolution (1, 2, 5, or 10 minutes per row)
- **JIRA Integration**: Link entries to JIRA issues and open them directly
- **Weekly Statistics**: Aggregated time tracking by issue or description
- **Clipboard Integration**: Copy durations and work logs
- **Persistent Storage**: SQLite database for reliable data storage
- **Date Navigation**: Browse entries across different days
- **What's New Screen**: Shows new features on version updates

## Installation

### Build from source

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

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

### Run

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

## Usage

### Keyboard Shortcuts

#### Normal Mode
- `n` - Create new time entry
- `e` - Edit selected entry
- `d` - Delete selected entry (requires confirmation)
- `Shift+D` - Force delete selected entry (no confirmation)
- `s` - Stop running entry (or restart stopped entry)
- `Shift+S` - Open settings
- `c` - Copy selected entry duration to clipboard
- `l` - Open JIRA issue in browser and copy duration
- `Shift+L` - Toggle logged status for entry
- `o` - Open worklog
- `↑/↓` - Navigate between entries
- `Ctrl+↑/↓` or `Shift+↑/↓` - Reorder entries (move up/down)
- `←/→` - Change date (previous/next day)
- `Esc` - Clear status messages
- `q` - Quit application

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

#### Create Mode
- Type to enter data in the current field
- `Tab` - Move to next field (Description → Start Time → End Time → Issue Key)
- `↑/↓` - Navigate suggestion list (for descriptions/issue keys)
- `Enter` - Save entry
- `Esc` - Cancel and return to normal mode
- `Backspace` - Delete character

#### Confirm Delete Mode
- `y` - Confirm deletion
- `n` or `Esc` - Cancel deletion

#### What's New Screen
- `Enter` or `Esc` - Close and return to dashboard

### 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. Tab to issue key field, optionally enter JIRA issue (e.g., "PROJ-123")
7. Press Enter to save
8. Use `↑/↓` to select entries
9. Press `s` to stop a running timer
10. Press `l` to open JIRA issue and copy duration
11. Press `c` to copy duration to clipboard
12. Use `Ctrl+↑/↓` to reorder entries
13. Use `←/→` to view different days
14. Press `Shift+S` to configure settings (JIRA URL, colors)

## 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