diff --git a/src/main/events/helpers/validators.ts b/src/main/events/helpers/validators.ts index f1407ef6..ccbfb877 100644 --- a/src/main/events/helpers/validators.ts +++ b/src/main/events/helpers/validators.ts @@ -15,16 +15,16 @@ export const downloadSourceSchema = z.object({ const gamesArray = z.array( z.object({ - id: z.number(), + id: z.string().length(8), objectId: z.string().max(255), - playTimeInMilliseconds: z.number().int(), + playTimeInSeconds: z.number().int(), shop: z.enum(["steam", "epic"]), lastTimePlayed: z.coerce.date().nullable(), }) ); export const userProfileSchema = z.object({ - username: z.string(), + displayName: z.string(), libraryGames: gamesArray, recentGames: gamesArray, }); diff --git a/src/main/events/profile/get-user-profile.ts b/src/main/events/profile/get-user-profile.ts index 0e16b03b..d8d16782 100644 --- a/src/main/events/profile/get-user-profile.ts +++ b/src/main/events/profile/get-user-profile.ts @@ -12,7 +12,7 @@ const getUserProfile = async ( username: string ): Promise => { try { - const response = await HydraApi.get(`/profile/${username}`); + const response = await HydraApi.get(`/user/${username}`); const profile = userProfileSchema.parse(response.data); const recentGames = await Promise.all( diff --git a/src/renderer/src/components/sidebar/sidebar.tsx b/src/renderer/src/components/sidebar/sidebar.tsx index ae364002..b81c84b8 100644 --- a/src/renderer/src/components/sidebar/sidebar.tsx +++ b/src/renderer/src/components/sidebar/sidebar.tsx @@ -144,7 +144,7 @@ export function Sidebar() { }; const handleClickProfile = () => { - navigate("/profile/zamitto"); + navigate("/profile/pmbk5ezJ"); }; return ( diff --git a/src/renderer/src/pages/profile/profile-content.tsx b/src/renderer/src/pages/profile/profile-content.tsx index 1907a3b8..d9d62256 100644 --- a/src/renderer/src/pages/profile/profile-content.tsx +++ b/src/renderer/src/pages/profile/profile-content.tsx @@ -12,13 +12,13 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => { <>
{userProfile.username
-

{userProfile.username}

+

{userProfile.displayName}

@@ -51,14 +51,18 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => { > {userProfile.recentGames.map((game) => { return ( -
+
{"Icon -

{game.title}

+
+

{game.title}

+

há 3 horas

+
); })} @@ -92,14 +96,18 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => { > {userProfile.libraryGames.map((game) => { return ( -
+
{"Icon -

{game.title}

+
+

{game.title}

+

Jogou por 10 horas

+
); })} diff --git a/src/renderer/src/pages/profile/profile.css.tsx b/src/renderer/src/pages/profile/profile.css.tsx index 91b18803..a6aa04e8 100644 --- a/src/renderer/src/pages/profile/profile.css.tsx +++ b/src/renderer/src/pages/profile/profile.css.tsx @@ -36,10 +36,6 @@ export const profileInformation = style({ alignItems: "flex-start", }); -export const profileHeaderSkeleton = style({ - height: "200px", -}); - export const profileContent = style({ display: "flex", flexDirection: "row", @@ -70,3 +66,37 @@ export const contentSidebar = style({ }, }, }); + +export const gameIcon = style({ + width: "48px", + height: "48px", + borderRadius: "50%", + display: "flex", + justifyContent: "center", + alignItems: "center", + position: "relative", +}); + +export const feedItem = style({ + display: "flex", + flexDirection: "row", + gap: `${SPACING_UNIT}px`, + width: "100%", +}); + +export const gameListItem = style({ + display: "flex", + flexDirection: "row", + gap: `${SPACING_UNIT}px`, + width: "100%", +}); + +export const gameInformation = style({ + display: "flex", + flexDirection: "column", + alignItems: "flex-start", +}); + +export const profileHeaderSkeleton = style({ + height: "200px", +}); diff --git a/src/renderer/src/pages/profile/profile.tsx b/src/renderer/src/pages/profile/profile.tsx index c12226b9..06efbbfc 100644 --- a/src/renderer/src/pages/profile/profile.tsx +++ b/src/renderer/src/pages/profile/profile.tsx @@ -18,7 +18,7 @@ export const Profile = () => { useEffect(() => { window.electron.getUserProfile(username!).then((userProfile) => { if (userProfile) { - dispatch(setHeaderTitle(userProfile.username)); + dispatch(setHeaderTitle(userProfile.displayName)); setUserProfile(userProfile); } }); diff --git a/src/types/index.ts b/src/types/index.ts index d5b431ab..88b5c426 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -243,7 +243,7 @@ export interface RealDebridUser { } export interface UserProfile { - username: string; + displayName: string; libraryGames: ProfileGame[]; recentGames: ProfileGame[]; }