Skip to content

Commit

Permalink
feat(airdrop): not available claim
Browse files Browse the repository at this point in the history
  • Loading branch information
JayJay1024 committed Jan 18, 2022
1 parent 40fa9f1 commit da99229
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/component/ClaimAirdrop/SubComponent/img/Discord.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/component/ClaimAirdrop/SubComponent/img/Medium.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/component/ClaimAirdrop/SubComponent/img/Telegram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/component/ClaimAirdrop/SubComponent/img/Twitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 76 additions & 1 deletion src/component/ClaimAirdrop/SubComponent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import React from 'react';
import clsx from 'clsx';
import { Modal, Spin, Space } from 'antd';

import styles from '../styles.module.scss';
import { Modal, Spin } from 'antd';
import TwitterIcon from './img/Twitter.svg';
import MediumIcon from './img/Medium.svg';
import TelegramIcon from './img/Telegram.svg';
import DiscordIcon from './img/Discord.svg';

export const ComfirmModalTitleWithCRAB = ({ crabQuantity='100' }) => (
<div className={clsx(styles.titleComfirmModalWithCRAB)}>
Expand Down Expand Up @@ -78,3 +83,73 @@ export const LoadingModal = ({
</Modal>
)
};

export const SnapshotDataSection = ({
githubAccount='***',
registrationTime='2021/12/05',
}) => (
<div className={styles.snapshotTimeSection}>
<h5>Snapshot Data</h5>
<div className={clsx(styles.wrapContent)}>
<span>{`Github Account: ${githubAccount}`}</span>
<span>{`Registration Time: : ${registrationTime}`}</span>
</div>
</div>
);

export const DestinationSection = ({
onAddressChange=(address)=>console.log(address),
isValidAddress=true,
isNothingToClaim=false,
isClaimed=false,
comfirmAddress=undefined,
}) => {
if (isNothingToClaim) {
return (
<div className={styles.destinationSection}>
<p>Address has no available claim</p>
</div>
);
}

if (isClaimed) {
return (
<div className={styles.destinationSection}>
<h5>Destination</h5>
<p>Address has already claimed</p>
</div>
);
}

if (comfirmAddress) {
return (
<div className={styles.destinationSection}>
<h5>Destination</h5>
<p>{comfirmAddress}</p>
</div>
);
}

return (
<div className={styles.destinationSection}>
<h5>Destination</h5>
<input onChange={onAddressChange} />
{isValidAddress ? (
<span>Please enter your Crab Smart Address to claim token CRAB, learn more about Crab Smart Address, please refer <a href='#'>here</a>.</span>
) : (
<span>Please enter a valid Crab Smart Address, learn more about Crab Smart Address, please refer <a href='#'>here</a>.</span>
)}
</div>
);
};

export const SocialLinks = () => (
<div>
<Space size='large'>
<a href='#'><img alt='...' src={TwitterIcon} /></a>
<a href='#'><img alt='...' src={MediumIcon} /></a>
<a href='#'><img alt='...' src={TelegramIcon} /></a>
<a href='#'><img alt='...' src={DiscordIcon} /></a>
</Space>
</div>
);
19 changes: 14 additions & 5 deletions src/component/ClaimAirdrop/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ import {
LoadingModal,
ComfirmModal,
ComfirmModalButton,
SnapshotDataSection,
DestinationSection,
SocialLinks,
ComfirmModalTitleWithCRAB,
ComfirmModalTitleForSorry,
ComfirmModalTitleForComfirm,
ComfirmModalTitleForCcongratulation,
} from './SubComponent';
import { Space } from 'antd';

type Props = {
className?: string;
}

const ClaimAirdrop: React.FC<Props> = ({ className }) => {
const [visibleLoadingModal, setVisibleLoadingModal] = useState(true);
const [visibleComfirmModal, setVisibleComfirmModal] = useState(false);
const [visibleLoadingModal, setVisibleLoadingModal] = useState(false);
const [visibleComfirmModal, setVisibleComfirmModal] = useState(true);

const handleClickLoginWithGithub = (e: Event) => {
e.preventDefault();
Expand All @@ -33,10 +37,15 @@ const ClaimAirdrop: React.FC<Props> = ({ className }) => {
</div>
<ComfirmModal
visible={visibleComfirmModal}
title={<ComfirmModalTitleForCcongratulation />}
footer={<ComfirmModalButton onClick={() => setVisibleComfirmModal(false)} disabled={true} />}
title={<ComfirmModalTitleWithCRAB />}
footer={<ComfirmModalButton onClick={() => setVisibleComfirmModal(false)} text='Claim CRAB' disabled={true} />}
onCancel={() => setVisibleComfirmModal(false)}
/>
>
<Space direction='vertical' size='middle' style={{ width: '100%' }}>
<SnapshotDataSection />
<DestinationSection isNothingToClaim={true} />
</Space>
</ComfirmModal>
<LoadingModal
visible={visibleLoadingModal}
onCancel={() => setVisibleLoadingModal(false)}
Expand Down
27 changes: 27 additions & 0 deletions src/component/ClaimAirdrop/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@
.ant-modal-footer {
border-top: none;
border-radius: 0 0 20px 20px;
padding-top: 0;
padding-bottom: 20px;
}
}
}
Expand Down Expand Up @@ -184,3 +186,28 @@
animation: crab-spin 1.2s linear infinite;
}
}

.snapshotTimeSection {
.wrapContent {
padding: 14px 12px;
background-color: #EEEEEE;
border-radius: 10px;
display: flex;
flex-direction: column;

>span {
&:first-child {
margin-bottom: 10px;
}
}
}
}

.destinationSection {
>p {
font-weight: bold;
font-size: small;
margin: 0;
text-align: center;
}
}

0 comments on commit da99229

Please sign in to comment.