feat(library): implement playtime tracking on the frontend

This commit is contained in:
Aden Lindsay
2025-09-05 14:19:44 +09:30
committed by DecDuck
parent e798d258dc
commit 262c8505b7
7 changed files with 428 additions and 2 deletions

View File

@ -94,3 +94,37 @@ export type Settings = {
maxDownloadThreads: number;
forceOffline: boolean;
};
export type GamePlaytimeStats = {
gameId: string;
totalPlaytimeSeconds: number;
sessionCount: number;
firstPlayed: string;
lastPlayed: string;
averageSessionLength: number;
currentSessionDuration?: number;
};
export type PlaytimeSession = {
gameId: string;
startTime: string;
sessionId: string;
};
export type PlaytimeUpdateEvent = {
gameId: string;
stats: GamePlaytimeStats;
isActive: boolean;
};
export type PlaytimeSessionStartEvent = {
gameId: string;
startTime: string;
};
export type PlaytimeSessionEndEvent = {
gameId: string;
sessionDurationSeconds: number;
totalPlaytimeSeconds: number;
sessionCount: number;
};