mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-20 07:16:17 +08:00
Add premium status to profile page
This commit is contained in:
parent
ee174495b1
commit
5b8f3da305
|
@ -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) {
|
||||
|
|
|
@ -368,6 +368,10 @@
|
|||
color: var(--error-color);
|
||||
}
|
||||
}
|
||||
.badges {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.badge {
|
||||
width: max-content;
|
||||
font-size: 0.7em;
|
||||
|
|
|
@ -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)",
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue