From aeaeb1f08609cc73efd916e5b71578031984d7d2 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Fri, 14 Jun 2024 22:09:41 -0300 Subject: [PATCH] show games library in a grid --- .../src/pages/profile/profile-content.tsx | 28 ++++++++----------- .../src/pages/profile/profile.css.tsx | 11 ++++---- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/renderer/src/pages/profile/profile-content.tsx b/src/renderer/src/pages/profile/profile-content.tsx index ef7b053c..fe319b63 100644 --- a/src/renderer/src/pages/profile/profile-content.tsx +++ b/src/renderer/src/pages/profile/profile-content.tsx @@ -9,12 +9,12 @@ import { useDate } from "@renderer/hooks"; import { useNavigate } from "react-router-dom"; import { buildGameDetailsPath } from "@renderer/helpers"; import { PersonIcon } from "@primer/octicons-react"; + +const MAX_MINUTES_TO_SHOW_IN_PLAYTIME = 120; export interface ProfileContentProps { userProfile: UserProfile; } -const MAX_MINUTES_TO_SHOW_IN_PLAYTIME = 120; - export const ProfileContent = ({ userProfile }: ProfileContentProps) => { const { t, i18n } = useTranslation("user_profile"); @@ -28,8 +28,11 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => { const { formatDistance } = useDate(); - const formatPlayTime = (game: ProfileGame) => { - const seconds = game.playTimeInSeconds; + const formatPlayTime = () => { + const seconds = userProfile.libraryGames.reduce( + (acc, game) => acc + game.playTimeInSeconds, + 0 + ); const minutes = seconds / 60; if (minutes < MAX_MINUTES_TO_SHOW_IN_PLAYTIME) { @@ -123,6 +126,7 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => { }} >