feat: profile active subscription

This commit is contained in:
Zamitto 2024-10-16 01:08:10 -03:00
parent fe681c3af9
commit 5c4ddd9b7a
2 changed files with 41 additions and 36 deletions

View File

@ -17,6 +17,7 @@ import { RecentGamesBox } from "./recent-games-box";
import { UserGame } from "@types"; import { UserGame } from "@types";
import { import {
buildGameAchievementPath, buildGameAchievementPath,
buildGameDetailsPath,
formatDownloadProgress, formatDownloadProgress,
} from "@renderer/helpers"; } from "@renderer/helpers";
import { MAX_MINUTES_TO_SHOW_IN_PLAYTIME } from "@renderer/constants"; import { MAX_MINUTES_TO_SHOW_IN_PLAYTIME } from "@renderer/constants";
@ -45,11 +46,12 @@ export function ProfileContent() {
}, [userProfile]); }, [userProfile]);
const buildUserGameDetailsPath = (game: UserGame) => { const buildUserGameDetailsPath = (game: UserGame) => {
// TODO: check if user has hydra cloud if (!userProfile?.hasActiveSubscription) {
// buildGameDetailsPath({ return buildGameDetailsPath({
// ...game, ...game,
// objectId: game.objectId, objectId: game.objectId,
// }); });
}
const userParams = userProfile const userParams = userProfile
? { ? {
@ -172,53 +174,55 @@ export function ProfileContent() {
{formatPlayTime(game.playTimeInSeconds)} {formatPlayTime(game.playTimeInSeconds)}
</small> </small>
<div {userProfile.hasActiveSubscription && (
style={{
color: "white",
width: "100%",
display: "flex",
flexDirection: "column",
}}
>
<div <div
style={{ style={{
color: "white",
width: "100%",
display: "flex", display: "flex",
justifyContent: "space-between", flexDirection: "column",
marginBottom: 8,
color: vars.color.muted,
}} }}
> >
<div <div
style={{ style={{
display: "flex", display: "flex",
alignItems: "center", justifyContent: "space-between",
gap: 8, marginBottom: 8,
color: vars.color.muted,
}} }}
> >
<TrophyIcon size={13} /> <div
style={{
display: "flex",
alignItems: "center",
gap: 8,
}}
>
<TrophyIcon size={13} />
<span>
{game.unlockedAchievementCount} /{" "}
{game.achievementCount}
</span>
</div>
<span> <span>
{game.unlockedAchievementCount} /{" "} {formatDownloadProgress(
{game.achievementCount} game.unlockedAchievementCount /
game.achievementCount
)}
</span> </span>
</div> </div>
<span> <progress
{formatDownloadProgress( max={1}
value={
game.unlockedAchievementCount / game.unlockedAchievementCount /
game.achievementCount game.achievementCount
)} }
</span> className={styles.achievementsProgressBar}
/>
</div> </div>
)}
<progress
max={1}
value={
game.unlockedAchievementCount /
game.achievementCount
}
className={styles.achievementsProgressBar}
/>
</div>
</div> </div>
<img <img

View File

@ -261,6 +261,7 @@ export interface UserProfile {
relation: UserRelation | null; relation: UserRelation | null;
currentGame: UserProfileCurrentGame | null; currentGame: UserProfileCurrentGame | null;
bio: string; bio: string;
hasActiveSubscription: boolean;
} }
export interface UpdateProfileRequest { export interface UpdateProfileRequest {