Add premium status to profile page

This commit is contained in:
Christian Fehmer 2023-12-14 17:11:58 +01:00
parent ee174495b1
commit 5b8f3da305
No known key found for this signature in database
GPG key ID: 7294582286D5F1F4
4 changed files with 14 additions and 3 deletions

View file

@ -708,6 +708,8 @@ export async function getProfile(
lbOptOut,
} = user;
const isPremium = await UserDAL.checkIfUserIsPremium(user.uid, user);
const validTimePbs = _.pick(personalBests?.time, "15", "30", "60", "120");
const validWordsPbs = _.pick(personalBests?.words, "10", "25", "50", "100");
@ -734,6 +736,7 @@ export async function getProfile(
streak: streak?.length ?? 0,
maxStreak: streak?.maxLength ?? 0,
lbOptOut,
isPremium,
};
if (banned) {

View file

@ -368,6 +368,10 @@
color: var(--error-color);
}
}
.badges {
display: flex;
gap: 0.5rem;
}
.badge {
width: max-content;
font-size: 0.7em;

View file

@ -116,8 +116,8 @@ const badges: Record<number, MonkeyTypes.UserBadge> = {
name: "Prime Ape",
description: "Paying for a monthly subscription",
icon: "fa-dollar-sign",
color: "var(--text-color)",
background: "var(--sub-color)",
color: "var(--bg-color)",
background: "var(--main-color)",
},
};

View file

@ -56,9 +56,13 @@ export async function update(
let mainHtml = "";
let restHtml = "";
if (profile.isPremium) {
mainHtml = getHTMLById(15);
}
for (const badge of profile.inventory.badges) {
if (badge.selected === true) {
mainHtml = getHTMLById(badge.id);
mainHtml += getHTMLById(badge.id);
} else {
restHtml += getHTMLById(badge.id, true);
}