Merge pull request #627 from hydralauncher/feat/get-total-playtime-from-api

feat: get total playtime from api
This commit is contained in:
Zamitto 2024-06-22 02:01:17 -03:00 committed by GitHub
commit fbcacd7c39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 4 deletions

View file

@ -51,10 +51,7 @@ export function UserContent({
const { formatDistance, formatDiffInMillis } = useDate(); const { formatDistance, formatDiffInMillis } = useDate();
const formatPlayTime = () => { const formatPlayTime = () => {
const seconds = userProfile.libraryGames.reduce( const seconds = userProfile.totalPlayTimeInSeconds;
(acc, game) => acc + game.playTimeInSeconds,
0
);
const minutes = seconds / 60; const minutes = seconds / 60;
if (minutes < MAX_MINUTES_TO_SHOW_IN_PLAYTIME) { if (minutes < MAX_MINUTES_TO_SHOW_IN_PLAYTIME) {

View file

@ -263,6 +263,7 @@ export interface UserProfile {
id: string; id: string;
displayName: string; displayName: string;
profileImageUrl: string | null; profileImageUrl: string | null;
totalPlayTimeInSeconds: number;
libraryGames: UserGame[]; libraryGames: UserGame[];
recentGames: UserGame[]; recentGames: UserGame[];
} }