diff --git a/apps/trading/client-pages/referrals/apply-code-form.tsx b/apps/trading/client-pages/referrals/apply-code-form.tsx index c9065f642..ba4dad242 100644 --- a/apps/trading/client-pages/referrals/apply-code-form.tsx +++ b/apps/trading/client-pages/referrals/apply-code-form.tsx @@ -236,7 +236,9 @@ export const ApplyCodeForm = () => { {t('Apply a referral code')}

- {t('Enter a referral code to get trading discounts.')} + {t( + 'Apply a referral code to access the discount benefits of the current program.' + )}

{

{t( - 'Generate a referral code to share with your friends and start earning commission.' + 'Generate a referral code to share with your friends and access the commission benefits of the current program.' )}

@@ -268,7 +268,7 @@ const CreateCodeDialog = ({ {(status === 'idle' || status === 'loading' || status === 'error') && (

{t( - 'Generate a referral code to share with your friends and start earning commission.' + 'Generate a referral code to share with your friends and access the commission benefits of the current program.' )}

)} diff --git a/apps/trading/client-pages/referrals/hooks/use-referral-program.ts b/apps/trading/client-pages/referrals/hooks/use-referral-program.ts index d501c0161..f0eb2b282 100644 --- a/apps/trading/client-pages/referrals/hooks/use-referral-program.ts +++ b/apps/trading/client-pages/referrals/hooks/use-referral-program.ts @@ -4,12 +4,6 @@ import sortBy from 'lodash/sortBy'; import omit from 'lodash/omit'; import { useReferralProgramQuery } from './__generated__/CurrentReferralProgram'; -const STAKING_TIERS_MAPPING: Record = { - 1: 'Tradestarter', - 2: 'Mid level degen', - 3: 'Reward hoarder', -}; - // eslint-disable-next-line @typescript-eslint/no-unused-vars const MOCK = { data: { @@ -96,7 +90,6 @@ export const useReferralProgram = () => { ).map((t, i) => { return { tier: i + 1, - label: STAKING_TIERS_MAPPING[i + 1], ...t, }; }); diff --git a/apps/trading/client-pages/referrals/landing-banner.tsx b/apps/trading/client-pages/referrals/landing-banner.tsx index f9e3d6e98..34db11113 100644 --- a/apps/trading/client-pages/referrals/landing-banner.tsx +++ b/apps/trading/client-pages/referrals/landing-banner.tsx @@ -15,11 +15,16 @@ export const LandingBanner = () => {

- {t('Earn commission & stake rewards')} + {t('Vega Community Referral Program')}

+

+ {t( + 'Referral programs can be proposed and created via Community governance.' + )} +

{t( - 'Invite friends and earn rewards from the trading fees they pay. Stake those rewards to earn multipliers on future rewards.' + 'Once live, users can generate referral codes to share with their friends and earn commission on their trades, while referred traders can access fee discounts based on the running volume of the group.' )}

diff --git a/apps/trading/client-pages/referrals/referral-statistics.tsx b/apps/trading/client-pages/referrals/referral-statistics.tsx index 5f76f0aef..98c31eaf9 100644 --- a/apps/trading/client-pages/referrals/referral-statistics.tsx +++ b/apps/trading/client-pages/referrals/referral-statistics.tsx @@ -10,7 +10,6 @@ import { import { useVegaWallet } from '@vegaprotocol/wallet'; import { DEFAULT_AGGREGATION_DAYS, useReferral } from './hooks/use-referral'; -import { CreateCodeContainer } from './create-code-form'; import classNames from 'classnames'; import { Table } from './table'; import { @@ -32,7 +31,7 @@ import BigNumber from 'bignumber.js'; import { DocsLinks } from '@vegaprotocol/environment'; import { useT, ns } from '../../lib/use-t'; import { Trans } from 'react-i18next'; -import { ApplyCodeForm } from './apply-code-form'; +import { ApplyCodeForm, ApplyCodeFormContainer } from './apply-code-form'; export const ReferralStatistics = () => { const { pubKey } = useVegaWallet(); @@ -53,7 +52,7 @@ export const ReferralStatistics = () => { if (referee?.code) { return ( <> - ; + {!referee.isEligible && } ); @@ -68,7 +67,7 @@ export const ReferralStatistics = () => { ); } - return ; + return ; }; export const useStats = ({ diff --git a/apps/trading/client-pages/referrals/referrals.tsx b/apps/trading/client-pages/referrals/referrals.tsx index ac06f7257..ea35ee4b5 100644 --- a/apps/trading/client-pages/referrals/referrals.tsx +++ b/apps/trading/client-pages/referrals/referrals.tsx @@ -4,11 +4,10 @@ import { VegaIcon, VegaIconNames, } from '@vegaprotocol/ui-toolkit'; -import { HowItWorksTable } from './how-it-works-table'; import { LandingBanner } from './landing-banner'; import { TiersContainer } from './tiers'; import { TabLink } from './buttons'; -import { Outlet } from 'react-router-dom'; +import { Outlet, useMatch } from 'react-router-dom'; import { Routes } from '../../lib/links'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { useReferral } from './hooks/use-referral'; @@ -21,12 +20,13 @@ import { useT } from '../../lib/use-t'; const Nav = () => { const t = useT(); + const match = useMatch(Routes.REFERRALS_APPLY_CODE); return (
- - {t('I want a code')} + + {t('Apply code')} - {t('I have a code')} + {t('Create code')}
); }; @@ -95,15 +95,13 @@ export const Referrals = () => {

{t('How it works')}

-
- {t('Read the terms')}{' '} - + {t('Read the docs')}
diff --git a/apps/trading/client-pages/referrals/tiers.tsx b/apps/trading/client-pages/referrals/tiers.tsx index 8e765bd2e..4a3338cfb 100644 --- a/apps/trading/client-pages/referrals/tiers.tsx +++ b/apps/trading/client-pages/referrals/tiers.tsx @@ -5,10 +5,11 @@ import classNames from 'classnames'; import { BORDER_COLOR, GRADIENT } from './constants'; import { Tag } from './tag'; import type { ComponentProps, ReactNode } from 'react'; -import { ExternalLink } from '@vegaprotocol/ui-toolkit'; +import { ExternalLink, truncateMiddle } from '@vegaprotocol/ui-toolkit'; import { DApp, DocsLinks, + TOKEN_PROPOSAL, TOKEN_PROPOSALS, useLinks, } from '@vegaprotocol/environment'; @@ -28,12 +29,10 @@ const Loading = ({ variant }: { variant: 'large' | 'inline' }) => ( const StakingTier = ({ tier, - label, referralRewardMultiplier, minimumStakedTokens, }: { tier: number; - label: string; referralRewardMultiplier: string; minimumStakedTokens: string; }) => { @@ -49,30 +48,38 @@ const StakingTier = ({ 'overflow-hidden', 'border rounded-md w-full', 'flex flex-row', + 'bg-white dark:bg-vega-cdark-900', GRADIENT, BORDER_COLOR )} > -
- {tier < 4 && ( - // eslint-disable-next-line @next/next/no-img-element - {`${referralRewardMultiplier}x +
+ {`${referralRewardMultiplier}x multiplier`}
-
- Multiplier {referralRewardMultiplier}x -

{label}

-

- {t('Stake a minimum of {{minimumStakedTokens}} $VEGA tokens', { - minimumStakedTokens, - })} -

+
+
+ Multiplier {referralRewardMultiplier}x +

+ {t('Stake a minimum of {{minimumStakedTokens}} $VEGA tokens', { + minimumStakedTokens, + })} +

+
); @@ -116,47 +123,93 @@ export const TiersContainer = () => { return ( <> - {/* Benefit tiers */} -
-

{t('Referral tiers')}

+

{t('Current Program Details')}

+ {details?.id && ( +

+ + proposal + , + ]} + /> +

+ )} + + {/* Meta */} +
+ {details?.id && ( + + {t('Proposal ID:')}{' '} + + {truncateMiddle(details.id)} + + + )} {ends && ( - + {t('Program ends:')} {ends} )}
-
- {loading || !benefitTiers || benefitTiers.length === 0 ? ( - - ) : ( - ({ - ...bt, - tierElement: ( -
- {bt.tier} -
- ), - }))} - /> - )} -
- {/* Staking tiers */} -
-

{t('Staking multipliers')}

-
-
- {loading || !stakingTiers || stakingTiers.length === 0 ? ( - <> + {/* Container */} +
+ {/* Benefit tiers */} +
+

{t('Benefit tiers')}

+

+ {t( + 'Members of a referral group can access the increasing commission and discount benefits defined in the program based on their combined running volume.' + )} +

+
+
+ {loading || !benefitTiers || benefitTiers.length === 0 ? ( - - - - ) : ( - - )} + ) : ( + ({ + ...bt, + tierElement: ( +
+ {bt.tier} +
+ ), + }))} + /> + )} +
+ + {/* Staking tiers */} +
+

{t('Staking multipliers')}

+

+ {t( + 'Referrers can access the commission multipliers defined in the program by staking VEGA tokens in the amounts shown.' + )} +

+
+
+ {loading || !stakingTiers || stakingTiers.length === 0 ? ( + <> + + + + + ) : ( + + )} +
); @@ -168,17 +221,14 @@ const StakingTiers = ({ data: ReturnType['stakingTiers']; }) => ( <> - {data.map( - ({ tier, label, referralRewardMultiplier, minimumStakedTokens }, i) => ( - - ) - )} + {data.map(({ tier, referralRewardMultiplier, minimumStakedTokens }, i) => ( + + ))} ); @@ -218,6 +268,7 @@ const TiersTable = ({ }, { name: 'epochs', displayName: t('Min. epochs') }, ]} + className="bg-white dark:bg-vega-cdark-900" data={data.map((d) => ({ ...d, className: classNames({