From 01d456f46c81f207b59dea1fad9bfce850a3f9dc Mon Sep 17 00:00:00 2001 From: BFlat Date: Fri, 18 Nov 2022 16:00:23 +0700 Subject: [PATCH] profile upgrade plan button --- .../src/v2/view/NewVocodesContainer.tsx | 7 +++- .../view/profile/profile_view/ProfileFc.tsx | 39 ++++++++++++++++--- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/packages/fakeyou/src/v2/view/NewVocodesContainer.tsx b/packages/fakeyou/src/v2/view/NewVocodesContainer.tsx index 6b5150b81b..fc5459b8f9 100644 --- a/packages/fakeyou/src/v2/view/NewVocodesContainer.tsx +++ b/packages/fakeyou/src/v2/view/NewVocodesContainer.tsx @@ -172,7 +172,12 @@ class NewVocodesContainer extends React.Component { - + diff --git a/packages/fakeyou/src/v2/view/profile/profile_view/ProfileFc.tsx b/packages/fakeyou/src/v2/view/profile/profile_view/ProfileFc.tsx index a54dd6bc35..a85b16f32f 100644 --- a/packages/fakeyou/src/v2/view/profile/profile_view/ProfileFc.tsx +++ b/packages/fakeyou/src/v2/view/profile/profile_view/ProfileFc.tsx @@ -7,6 +7,7 @@ import { ProfileTtsModelListFc } from "./Profile_TtsModelListFc"; import { ProfileW2lInferenceResultsListFc } from "./Profile_W2lInferenceResultListFc"; import { ProfileW2lTemplateListFc } from "./Profile_W2lTemplateListFc"; import { SessionWrapper } from "@storyteller/components/src/session/SessionWrapper"; +import { SessionSubscriptionsWrapper } from "@storyteller/components/src/session/SessionSubscriptionsWrapper"; import { useParams } from "react-router-dom"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { @@ -24,6 +25,7 @@ import { faVideo, faGlobe, faDollarSign, + faStar, } from "@fortawesome/free-solid-svg-icons"; import { @@ -43,6 +45,7 @@ import { motion } from "framer-motion"; interface Props { sessionWrapper: SessionWrapper; + sessionSubscriptionsWrapper: SessionSubscriptionsWrapper; } // function copyToClipboard(username: string): any { @@ -97,10 +100,29 @@ function ProfileFc(props: Props) { let banUserButton = undefined; + let upgradeButton = undefined; + + if (props.sessionWrapper.isLoggedIn()) { + if (props.sessionWrapper.userTokenMatches(userData.user_token)) { + if (!props.sessionSubscriptionsWrapper.hasPaidFeatures()) { + const upgradeLinkUrl = FrontendUrlConfig.pricingPage(); + + upgradeButton = ( + <> + + + Upgrade + + + ); + } + } + } + if (props.sessionWrapper.canBanUsers()) { const currentlyBanned = userData.maybe_moderator_fields?.is_banned; const banLinkUrl = FrontendUrlConfig.userProfileBanPage(userData.username); - const buttonLabel = currentlyBanned ? "Unban User" : "Ban User"; + const buttonLabel = currentlyBanned ? "Unban" : "Ban"; const banButtonCss = currentlyBanned ? "btn btn-secondary" : "btn btn-destructive"; @@ -141,6 +163,7 @@ function ProfileFc(props: Props) { profileButtonsMobile = (
+ {upgradeButton} {editProfileButton} {banUserButton}
@@ -298,18 +321,22 @@ function ProfileFc(props: Props) { email_hash={userEmailHash} />
-

- {userData.display_name} -

-
+
+

+ {userData.display_name} +

+
+ +
{banUserButton} + {upgradeButton} {editProfileButton}
{profileJoinDate}