Skip to content

Commit 048ee56

Browse files
committed
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
1 parent 0253b05 commit 048ee56

File tree

2 files changed

+30
-35
lines changed

2 files changed

+30
-35
lines changed

src/app/settings/page.tsx

+27-34
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { GB, TB, filesize } from '@/lib'
1010
import DefaultLoader from '@/components/Loader'
1111
import { RefcodeLink, ReferralsList, RefcodeCreator } from '../referrals/page'
1212
import { useReferrals } from '@/lib/referrals/hooks'
13-
import { useSearchParams } from 'next/navigation'
1413

1514
const Plans: Record<`did:${string}`, { name: string, limit: number }> = {
1615
'did:web:starter.web3.storage': { name: 'Starter', limit: 5 * GB },
@@ -75,43 +74,37 @@ export default function SettingsPage (): JSX.Element {
7574
// TODO: need to calculate these from the referral information that gets added during the TBD cronjob
7675
const credits = 0
7776
const points = 0
78-
const params = useSearchParams()
79-
const referralsEnabled = (params.get('referrals') === 'enabled')
8077
return (
8178
<>
8279
<SettingsNav />
8380
<H1>Settings</H1>
84-
{referralsEnabled && (
85-
<>
86-
<H2>Rewards</H2>
87-
<div className='flex flex-row space-x-2 justify-between max-w-4xl mb-4'>
88-
<div className='border border-hot-red rounded-2xl bg-white p-5 flex-grow'>
89-
<H3>Referred</H3>
90-
<span className='text-4xl'>{referred}</span> / {MAX_REFERRALS}
91-
</div>
92-
<div className='border border-hot-red rounded-2xl bg-white p-5 flex-grow'>
93-
<H3>USD Credits</H3>
94-
<span className='text-4xl'>{credits}</span> / {MAX_CREDITS}
95-
</div>
96-
<div className='border border-hot-red rounded-2xl bg-white p-5 flex-grow'>
97-
<H3>Racha Points</H3>
98-
<span className='text-4xl'>{points}</span>
99-
</div>
100-
</div>
101-
<div className='border border-hot-red rounded-2xl bg-white p-5 max-w-4xl mb-4'>
102-
<ReferralsList />
103-
{referralLink ? (
104-
<RefcodeLink referralLink={referralLink} />
105-
) : (
106-
<RefcodeCreator
107-
accountEmail={accountEmail}
108-
urlQueryEmail={urlQueryEmail}
109-
createRefcode={createRefcode}
110-
mutateRefcode={mutateRefcode}
111-
setReferrerEmail={setReferrerEmail} />)}
112-
</div>
113-
</>
114-
)}
81+
<H2>Rewards</H2>
82+
<div className='flex flex-row space-x-2 justify-between max-w-4xl mb-4'>
83+
<div className='border border-hot-red rounded-2xl bg-white p-5 flex-grow'>
84+
<H3>Referred</H3>
85+
<span className='text-4xl'>{referred}</span> / {MAX_REFERRALS}
86+
</div>
87+
<div className='border border-hot-red rounded-2xl bg-white p-5 flex-grow'>
88+
<H3>USD Credits</H3>
89+
<span className='text-4xl'>{credits}</span> / {MAX_CREDITS}
90+
</div>
91+
<div className='border border-hot-red rounded-2xl bg-white p-5 flex-grow'>
92+
<H3>Racha Points</H3>
93+
<span className='text-4xl'>{points}</span>
94+
</div>
95+
</div>
96+
<div className='border border-hot-red rounded-2xl bg-white p-5 max-w-4xl mb-4'>
97+
<ReferralsList />
98+
{referralLink ? (
99+
<RefcodeLink referralLink={referralLink} />
100+
) : (
101+
<RefcodeCreator
102+
accountEmail={accountEmail}
103+
urlQueryEmail={urlQueryEmail}
104+
createRefcode={createRefcode}
105+
mutateRefcode={mutateRefcode}
106+
setReferrerEmail={setReferrerEmail} />)}
107+
</div>
115108
<div className='border border-hot-red rounded-2xl bg-white p-5 max-w-4xl'>
116109
<H2>Plan</H2>
117110
<p className='font-epilogue mb-4'>

src/components/PlanGate.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { TopLevelLoader } from './Loader';
77
import { Logo } from '@/brand';
88
import { usePlan } from '@/hooks';
99
import { useRecordRefcode, useReferredBy } from '@/lib/referrals/hooks';
10+
import { useSearchParams } from 'next/navigation';
1011

1112
export function PlanGate ({ children }: { children: ReactNode }): ReactNode {
1213
const [{ accounts }] = useW3()
@@ -64,7 +65,8 @@ export function PlanGate ({ children }: { children: ReactNode }): ReactNode {
6465
}
6566

6667
export function MaybePlanGate ({ children }: { children: ReactNode }): ReactNode {
67-
if (process.env.NEXT_PUBLIC_DISABLE_PLAN_GATE == 'true') {
68+
const params = useSearchParams()
69+
if ((process.env.NEXT_PUBLIC_DISABLE_PLAN_GATE == 'true') || (params.get('checkout') === 'true')) {
6870
return children
6971
} else {
7072
return <PlanGate>{children}</PlanGate>

0 commit comments

Comments
 (0)