-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
262 additions
and
96 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
60 changes: 6 additions & 54 deletions
60
src/containers/main/Airdrop/AirdropGiftTracker/sections/LoggedOut/LoggedOut.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
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
75 changes: 64 additions & 11 deletions
75
src/containers/phase/Setup/components/AirdropShare/AirdropShare.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 |
---|---|---|
@@ -1,28 +1,81 @@ | ||
/* eslint-disable i18next/no-literal-string */ | ||
import { Gem1, Gem2, Gem3, GemsWrapper, Text, TextWrapper, Title } from '../AirdropLogin/styles'; | ||
import { Wrapper } from './styles'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { GemsWrapper, Text, Title } from '../AirdropLogin/styles'; | ||
import { Avatar, Copied, CopyButton, CopyText, CopyWrapper, Gem1, Gem2, Gem3, TextWrapper, Wrapper } from './styles'; | ||
import { useTranslation, Trans } from 'react-i18next'; | ||
import gemLargeImage from '../../../../main/Airdrop/AirdropGiftTracker/images/gem.png'; | ||
import { REFERRAL_GEMS, useAirdropStore } from '@app/store/useAirdropStore'; | ||
import { useEffect, useState } from 'react'; | ||
import { useAirdropSyncState } from '@app/hooks/airdrop/useAirdropSyncState'; | ||
import { AnimatePresence, m } from 'framer-motion'; | ||
|
||
export default function AirdropShare() { | ||
useAirdropSyncState(); | ||
const airdropUrl = useAirdropStore((state) => state.backendInMemoryConfig?.airdropUrl || ''); | ||
const { t } = useTranslation(['airdrop'], { useSuspense: false }); | ||
const { userDetails, referralQuestPoints } = useAirdropStore(); | ||
|
||
const profileimageurl = userDetails?.user?.profileimageurl; | ||
const gems = (referralQuestPoints?.pointsForClaimingReferral || REFERRAL_GEMS).toLocaleString(); | ||
|
||
const referralCode = userDetails?.user?.referral_code || ''; | ||
|
||
const [copied, setCopied] = useState(false); | ||
|
||
const url = `${airdropUrl}/download/${referralCode}`; | ||
|
||
const handleCopy = () => { | ||
setCopied(true); | ||
navigator.clipboard.writeText(url); | ||
}; | ||
|
||
useEffect(() => { | ||
if (copied) { | ||
const timeout = setTimeout(() => { | ||
setCopied(false); | ||
}, 2000); | ||
return () => { | ||
clearTimeout(timeout); | ||
}; | ||
} | ||
}, [copied]); | ||
|
||
if (!userDetails) return null; | ||
|
||
return ( | ||
<Wrapper> | ||
<Wrapper initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: 10 }}> | ||
<GemsWrapper> | ||
<Gem1 src={gemLargeImage} alt="" /> | ||
<Gem2 src={gemLargeImage} alt="" /> | ||
<Gem3 src={gemLargeImage} alt="" /> | ||
|
||
<Avatar $image={profileimageurl || ''} /> | ||
</GemsWrapper> | ||
|
||
<TextWrapper> | ||
<Title>{t('claimModalTitle')}</Title> | ||
|
||
<Text> | ||
Earn gems while mining to increase your airdrop reward during testnet! Connect your airdrop account | ||
to start earning. | ||
</Text> | ||
<Title> | ||
<Trans | ||
t={t} | ||
i18nKey="setupInviteTitle" | ||
ns="airdrop" | ||
components={{ span: <span /> }} | ||
values={{ gems }} | ||
/> | ||
</Title> | ||
<Text>{t('setupLoginText')}</Text> | ||
</TextWrapper> | ||
|
||
<CopyWrapper onClick={handleCopy} $copied={copied}> | ||
<AnimatePresence> | ||
{copied && ( | ||
<Copied initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}> | ||
<m.span initial={{ y: '100%' }} animate={{ y: 0 }} exit={{ opacity: 0 }}> | ||
{t('linkCopied')} | ||
</m.span> | ||
</Copied> | ||
)} | ||
</AnimatePresence> | ||
<CopyText>{url}</CopyText> | ||
<CopyButton>{t('setupCopyButton')}</CopyButton> | ||
</CopyWrapper> | ||
</Wrapper> | ||
); | ||
} |
Oops, something went wrong.