From 9a1b42a29ff9c213b4fe9bf7c964d30258e3b213 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Sat, 22 Jun 2024 01:47:20 -0300 Subject: [PATCH 1/2] feat: get totalPlayTimeInSeconds from api --- src/renderer/src/pages/user/user-content.tsx | 5 +---- src/types/index.ts | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/pages/user/user-content.tsx b/src/renderer/src/pages/user/user-content.tsx index 55dcc17f..dd0f05d0 100644 --- a/src/renderer/src/pages/user/user-content.tsx +++ b/src/renderer/src/pages/user/user-content.tsx @@ -51,10 +51,7 @@ export function UserContent({ const { formatDistance, formatDiffInMillis } = useDate(); const formatPlayTime = () => { - const seconds = userProfile.libraryGames.reduce( - (acc, game) => acc + game.playTimeInSeconds, - 0 - ); + const seconds = userProfile.totalPlayTimeInSeconds const minutes = seconds / 60; if (minutes < MAX_MINUTES_TO_SHOW_IN_PLAYTIME) { diff --git a/src/types/index.ts b/src/types/index.ts index c1da0d08..915e4ae7 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -263,6 +263,7 @@ export interface UserProfile { id: string; displayName: string; profileImageUrl: string | null; + totalPlayTimeInSeconds: number; libraryGames: UserGame[]; recentGames: UserGame[]; } From 9da67920b69c2f4cf7fcdfbbeff78074203ce4d1 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Sat, 22 Jun 2024 01:47:55 -0300 Subject: [PATCH 2/2] chore: prettier --- src/renderer/src/pages/user/user-content.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/src/pages/user/user-content.tsx b/src/renderer/src/pages/user/user-content.tsx index dd0f05d0..6f897238 100644 --- a/src/renderer/src/pages/user/user-content.tsx +++ b/src/renderer/src/pages/user/user-content.tsx @@ -51,7 +51,7 @@ export function UserContent({ const { formatDistance, formatDiffInMillis } = useDate(); const formatPlayTime = () => { - const seconds = userProfile.totalPlayTimeInSeconds + const seconds = userProfile.totalPlayTimeInSeconds; const minutes = seconds / 60; if (minutes < MAX_MINUTES_TO_SHOW_IN_PLAYTIME) {