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
+2
View File
@@ -29,6 +29,7 @@ interface Book {
links: Array<Link>;
series?: string;
seriesOrder?: number;
timeSpent?: number;
createdAt: Date;
updatedAt: Date;
}
@@ -47,6 +48,7 @@ interface CreateBookDto {
links?: Array<Link>;
series?: string;
seriesOrder?: number;
timeSpent?: number;
}
interface UpdateBookDto extends Partial<CreateBookDto> {
+2
View File
@@ -29,6 +29,7 @@ interface Game {
links: Array<Link>;
series?: string;
seriesOrder?: number;
timeSpent?: number;
createdAt: Date;
updatedAt: Date;
}
@@ -46,6 +47,7 @@ interface CreateGameDto {
links?: Array<Link>;
series?: string;
seriesOrder?: number;
timeSpent?: number;
}
interface UpdateGameDto extends Partial<CreateGameDto> {
+2
View File
@@ -27,6 +27,7 @@ interface Manga {
coverImage?: string;
tags: Array<string>;
links: Array<Link>;
timeSpent?: number;
createdAt: Date;
updatedAt: Date;
}
@@ -42,6 +43,7 @@ interface CreateMangaDto {
coverImage?: string;
tags?: Array<string>;
links?: Array<Link>;
timeSpent?: number;
}
interface UpdateMangaDto extends Partial<CreateMangaDto> {
+2
View File
@@ -34,6 +34,7 @@ interface Music {
coverArt?: string;
tags: Array<string>;
links: Array<Link>;
timeSpent?: number;
createdAt: Date;
updatedAt: Date;
}
@@ -50,6 +51,7 @@ interface CreateMusicDto {
coverArt?: string;
tags?: Array<string>;
links?: Array<Link>;
timeSpent?: number;
}
interface UpdateMusicDto extends Partial<CreateMusicDto> {
+2
View File
@@ -34,6 +34,7 @@ interface Show {
coverImage?: string;
tags: Array<string>;
links: Array<Link>;
timeSpent?: number;
createdAt: Date;
updatedAt: Date;
}
@@ -49,6 +50,7 @@ interface CreateShowDto {
coverImage?: string;
tags?: Array<string>;
links?: Array<Link>;
timeSpent?: number;
}
interface UpdateShowDto extends Partial<CreateShowDto> {