From 048ee561b7aaac7a20bf23779ac61d6e43fc9817 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Thu, 12 Dec 2024 09:28:43 -0800 Subject: [PATCH] fix: remove referrals feature flag also add a way to hide the plan page after Stripe checkout to fix an annoying signup flow issue - will need to update Stripe to fully take advantage of this --- src/app/settings/page.tsx | 61 ++++++++++++++++--------------------- src/components/PlanGate.tsx | 4 ++- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/src/app/settings/page.tsx b/src/app/settings/page.tsx index 5f16edf..b07703b 100644 --- a/src/app/settings/page.tsx +++ b/src/app/settings/page.tsx @@ -10,7 +10,6 @@ import { GB, TB, filesize } from '@/lib' import DefaultLoader from '@/components/Loader' import { RefcodeLink, ReferralsList, RefcodeCreator } from '../referrals/page' import { useReferrals } from '@/lib/referrals/hooks' -import { useSearchParams } from 'next/navigation' const Plans: Record<`did:${string}`, { name: string, limit: number }> = { 'did:web:starter.web3.storage': { name: 'Starter', limit: 5 * GB }, @@ -75,43 +74,37 @@ export default function SettingsPage (): JSX.Element { // TODO: need to calculate these from the referral information that gets added during the TBD cronjob const credits = 0 const points = 0 - const params = useSearchParams() - const referralsEnabled = (params.get('referrals') === 'enabled') return ( <>

Settings

- {referralsEnabled && ( - <> -

Rewards

-
-
-

Referred

- {referred} / {MAX_REFERRALS} -
-
-

USD Credits

- {credits} / {MAX_CREDITS} -
-
-

Racha Points

- {points} -
-
-
- - {referralLink ? ( - - ) : ( - )} -
- - )} +

Rewards

+
+
+

Referred

+ {referred} / {MAX_REFERRALS} +
+
+

USD Credits

+ {credits} / {MAX_CREDITS} +
+
+

Racha Points

+ {points} +
+
+
+ + {referralLink ? ( + + ) : ( + )} +

Plan

diff --git a/src/components/PlanGate.tsx b/src/components/PlanGate.tsx index 1af2b5b..669f38f 100644 --- a/src/components/PlanGate.tsx +++ b/src/components/PlanGate.tsx @@ -7,6 +7,7 @@ import { TopLevelLoader } from './Loader'; import { Logo } from '@/brand'; import { usePlan } from '@/hooks'; import { useRecordRefcode, useReferredBy } from '@/lib/referrals/hooks'; +import { useSearchParams } from 'next/navigation'; export function PlanGate ({ children }: { children: ReactNode }): ReactNode { const [{ accounts }] = useW3() @@ -64,7 +65,8 @@ export function PlanGate ({ children }: { children: ReactNode }): ReactNode { } export function MaybePlanGate ({ children }: { children: ReactNode }): ReactNode { - if (process.env.NEXT_PUBLIC_DISABLE_PLAN_GATE == 'true') { + const params = useSearchParams() + if ((process.env.NEXT_PUBLIC_DISABLE_PLAN_GATE == 'true') || (params.get('checkout') === 'true')) { return children } else { return {children}