From 83122bb864758c678e51903369bad6f94189ba9f Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Wed, 12 Jun 2024 23:02:39 -0300 Subject: [PATCH] feat: structure profile content and update response --- src/main/events/profile/get-user-profile.ts | 4 +- .../src/pages/profile/profile-content.tsx | 75 ++++++++++++++++--- .../src/pages/profile/profile.css.tsx | 29 ++++++- src/types/index.ts | 2 +- 4 files changed, 96 insertions(+), 14 deletions(-) diff --git a/src/main/events/profile/get-user-profile.ts b/src/main/events/profile/get-user-profile.ts index 18e9f692..1ba64d54 100644 --- a/src/main/events/profile/get-user-profile.ts +++ b/src/main/events/profile/get-user-profile.ts @@ -3,7 +3,7 @@ import { userProfileSchema } from "../helpers/validators"; import { logger } from "@main/services"; import { HydraApi } from "@main/services/hydra-api"; import { steamGamesWorker } from "@main/workers"; -import { LibraryGame, SteamGame, UserProfile } from "@types"; +import { UserProfile } from "@types"; const getUserProfile = async ( _event: Electron.IpcMainInvokeEvent, @@ -32,7 +32,7 @@ const getUserProfile = async ( }) ); - return { ...profile, game: libraryGames, recentGames }; + return { ...profile, libraryGames, recentGames }; } catch (err) { logger.error(`getUserProfile: ${username}`, err); return null; diff --git a/src/renderer/src/pages/profile/profile-content.tsx b/src/renderer/src/pages/profile/profile-content.tsx index 78dd7206..9fa8b1a9 100644 --- a/src/renderer/src/pages/profile/profile-content.tsx +++ b/src/renderer/src/pages/profile/profile-content.tsx @@ -1,6 +1,7 @@ import { UserProfile } from "@types"; import { useTranslation } from "react-i18next"; import * as styles from "./profile.css"; +import { SPACING_UNIT, vars } from "@renderer/theme.css"; export interface ProfileContentProps { userProfile: UserProfile; @@ -12,7 +13,7 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => { console.log(userProfile.recentGames); return ( <> -
+
{

Jogando ABC

-

Feed

- {userProfile.recentGames.map((game) => { - return

{game.title}

; - })} -

Games

- {userProfile.game.map((game) => { - return

{game.title}

; - })} +
+
+
+

Feed

+ +
+

+ {userProfile.recentGames.length} +

+
+
+ {userProfile.recentGames.map((game) => { + return

{game.title}

; + })} +
+
+ +
+
+

Games

+
+

+ {userProfile.libraryGames.length} +

+
+
+ {userProfile.libraryGames.map((game) => { + return

{game.title}

; + })} +
+
+
); }; diff --git a/src/renderer/src/pages/profile/profile.css.tsx b/src/renderer/src/pages/profile/profile.css.tsx index a25e0a9b..e5577439 100644 --- a/src/renderer/src/pages/profile/profile.css.tsx +++ b/src/renderer/src/pages/profile/profile.css.tsx @@ -6,14 +6,14 @@ export const wrapper = style({ width: "100%", display: "flex", flexDirection: "column", + gap: `${SPACING_UNIT * 2}px`, }); -export const profileHeader = style({ +export const profileContentBox = style({ display: "flex", gap: `${SPACING_UNIT + SPACING_UNIT / 2}px`, alignItems: "center", padding: `${SPACING_UNIT * 2}px ${SPACING_UNIT * 2}px`, - color: vars.color.muted, borderRadius: "4px", border: `solid 1px ${vars.color.border}`, width: "100%", @@ -39,3 +39,28 @@ export const profileInformation = style({ export const profileHeaderSkeleton = style({ height: "200px", }); + +export const profileContent = style({ + display: "flex", + flexDirection: "row", + gap: `${SPACING_UNIT * 4}px`, +}); + +export const contentSidebar = style({ + width: "100%", + height: "100%", + "@media": { + "(min-width: 768px)": { + width: "100%", + maxWidth: "200px", + }, + "(min-width: 1024px)": { + maxWidth: "300px", + width: "100%", + }, + "(min-width: 1280px)": { + width: "100%", + maxWidth: "400px", + }, + }, +}); diff --git a/src/types/index.ts b/src/types/index.ts index e983019f..be2691e4 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -236,7 +236,7 @@ export interface RealDebridUser { export interface UserProfile { username: string; - game: Partial[]; + libraryGames: Partial[]; recentGames: Partial[]; }