-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update enter program view * Add invitation form * Add invitation links view * Add rewards invitation alias route * Add invitations stub * Update program auth * Update rewards image * Update colors * Update invitations flow * Fix review comments
- Loading branch information
Showing
39 changed files
with
622 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/pages/Rewards/pages/EventId/components/InvitationLinks.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { CircularProgress, Stack, Typography, useTheme } from '@mui/material' | ||
import { useEffect, useMemo } from 'react' | ||
|
||
import { PointsEvent } from '@/api/modules/points' | ||
import { NoDataView } from '@/common' | ||
import { rewardsStore, useRewardsState } from '@/store' | ||
|
||
import ReferralLink from './ReferralLink' | ||
|
||
interface Props { | ||
event: PointsEvent | ||
} | ||
|
||
const MAX_REFERRAL_CODES = 5 | ||
|
||
export default function InvitationLinks({ event }: Props) { | ||
const { balance } = useRewardsState() | ||
const { palette } = useTheme() | ||
|
||
const referralCodes = useMemo(() => { | ||
return balance?.referral_codes ?? [] | ||
}, [balance]) | ||
|
||
useEffect(() => { | ||
rewardsStore.loadBalance() | ||
}, []) | ||
|
||
return balance ? ( | ||
referralCodes.length ? ( | ||
<Stack spacing={5}> | ||
<Stack spacing={2}> | ||
<Typography variant='subtitle3'> | ||
Invited {MAX_REFERRAL_CODES - referralCodes.length}/{MAX_REFERRAL_CODES} | ||
</Typography> | ||
<Typography variant='body3' color={palette.text.secondary}> | ||
STUB: Invite friends and earn RMO | ||
</Typography> | ||
</Stack> | ||
<Stack spacing={2}> | ||
{new Array(MAX_REFERRAL_CODES).fill(null).map((_, index) => ( | ||
<ReferralLink | ||
key={index} | ||
index={index} | ||
reward={Math.floor(event.meta.static.reward / MAX_REFERRAL_CODES)} | ||
code={referralCodes[index]} | ||
isUsed={index >= referralCodes.length} | ||
/> | ||
))} | ||
</Stack> | ||
</Stack> | ||
) : ( | ||
<NoDataView title='No invitation links' /> | ||
) | ||
) : ( | ||
<Stack alignItems='center' p={20}> | ||
<CircularProgress color='secondary' /> | ||
</Stack> | ||
) | ||
} |
Oops, something went wrong.