feat: add time tracking to all media types

Implements issue #57 with manual time entry functionality:
- Added timeSpent field (stored in minutes) to all media models
- Supports hours and minutes input in forms
- Displays formatted time on media cards

Database Schema:
- Added timeSpent Int? field to Game, Book, Music, Show, and Manga models
- Stored in minutes for consistency and easy calculation

Shared Types:
- Updated all media type interfaces with timeSpent? field
- Added to CreateDto and main interfaces for all media types

Frontend (Games - template for other types):
- Added hour/minute input fields to Add and Edit forms
- Split input with validation (minutes 0-59)
- Auto-calculates total minutes on change
- Formats display as "Xh Ym", "Xh", or "Ym" as appropriate
- Green highlighted time display on cards with ⏱️ icon
- Populates edit form from existing time data

Implementation Notes:
- Backend services require no changes (DTOs handle automatically)
- Time conversion helpers for display and storage
- Form state properly resets time fields
- Edit mode correctly splits minutes back to hours/minutes

Next Steps:
- Apply same UI pattern to Books, Music, Shows, Manga
- Add time statistics to user profiles
- Consider aggregate time tracking views
This commit is contained in:
2026-02-19 23:51:04 -08:00
committed by Naomi Carrigan
parent f839059dd2
commit fa331df203
7 changed files with 132 additions and 1 deletions
+5
View File
@@ -34,6 +34,7 @@ model Game {
links Link[]
series String?
seriesOrder Int? @db.Int
timeSpent Int? @db.Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comments Comment[]
@@ -62,6 +63,7 @@ model Book {
links Link[]
series String?
seriesOrder Int? @db.Int
timeSpent Int? @db.Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comments Comment[]
@@ -89,6 +91,7 @@ model Music {
coverArt String?
tags String[]
links Link[]
timeSpent Int? @db.Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comments Comment[]
@@ -135,6 +138,7 @@ model Show {
coverImage String?
tags String[]
links Link[]
timeSpent Int? @db.Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comments Comment[]
@@ -168,6 +172,7 @@ model Manga {
coverImage String?
tags String[]
links Link[]
timeSpent Int? @db.Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comments Comment[]