Skip to content

Commit

Permalink
Merge pull request #62 from TrustlessComputer/feat/airdrop-naka
Browse files Browse the repository at this point in the history
Feat/airdrop naka
  • Loading branch information
271212 authored Jan 19, 2024
2 parents 9883215 + 8089af7 commit 8bd3f31
Show file tree
Hide file tree
Showing 11 changed files with 356 additions and 19 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"redux-deep-persist": "^1.0.7",
"redux-persist": "^6.0.0",
"resolve-url-loader": "^5.0.0",
"sanitize-html": "^2.11.0",
"sass": "^1.69.5",
"sats-connect": "^1.1.2",
"sharp": "^0.33.1",
Expand All @@ -86,6 +87,7 @@
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react-slick": "^0.23.10",
"@types/sanitize-html": "^2.9.5",
"@types/uuid": "^9.0.7",
"encoding": "^0.1.13",
"eslint": "^8",
Expand Down
8 changes: 8 additions & 0 deletions src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ export {
NATIVE_ETH_ADDRESS,
METAMASK_DOWNLOAD_PAGE
};

export const ALLOWED_ATTRIBUTES = {
'*': ['style'],
span: ['class'],
a: ['href', 'target'],
img: ['src', 'width', 'height'],
iframe: ['src', 'width', 'height'],
};
4 changes: 4 additions & 0 deletions src/modules/Whitelist/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import CountUp from 'react-countup';
// import FAQContent from './FAQContent';
import { Tab, TabList, TabPanel, TabPanels, Tabs } from '@chakra-ui/react';
import StepsEco from './stepsEco';
import StepsAirdrop from '@/modules/Whitelist/stepAirdrop';

const CONTAINER_ID = 'WHITE_LIST_CONTAINER_ID';

Expand Down Expand Up @@ -82,6 +83,9 @@ const Whitelist = () => {
<TabPanel>
<StepsEco />
</TabPanel>
<TabPanel>
<StepsAirdrop />
</TabPanel>
</TabPanels>
</Tabs>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Whitelist/leaderBoard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const LeaderBoard = () => {

const labelConfig = {
color: 'rgba(1, 1, 0, 0.7)',
fontSize: '12px',
fontSize: '11px',
letterSpacing: '-0.5px',
borderBottom: '1px solid #FFFFFF33',
textTransform: 'uppercase',
Expand Down
21 changes: 11 additions & 10 deletions src/modules/Whitelist/leaderBoard/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
text-transform: uppercase;

@include w-max(768px) {
font-size: 20px;
font-size: 20px;
}
}

.indicator {
background-color: #FFFFFF;
background-color: #ffffff;
width: 58px;
height: 2px;
opacity: 0.7;
Expand Down Expand Up @@ -91,9 +91,11 @@ table {
}
}
}
thead, tbody {
thead,
tbody {
tr {
th, td{
th,
td {
padding-right: 20px !important;
&:nth-child(1) {
width: 60px !important;
Expand Down Expand Up @@ -180,7 +182,6 @@ table {
}
}


.container {
overflow: hidden;
width: 100%;
Expand All @@ -204,7 +205,7 @@ table {

.banner {
background: #000;
color: #FFF;
color: #fff;
font-size: 16px;
font-style: normal;
font-weight: 600;
Expand All @@ -229,7 +230,7 @@ table {
}

.tooltipIcon {
width: 18px;
width: 14px;
cursor: pointer;
opacity: 0.7;
}
Expand Down Expand Up @@ -273,7 +274,7 @@ table {
-webkit-text-fill-color: transparent;

&.boost_30 {
background: linear-gradient(90deg, #007659 0%, #35CCA6 100%);
background: linear-gradient(90deg, #007659 0%, #35cca6 100%);
text-align: center;
font-size: 16px;
font-style: normal;
Expand All @@ -284,7 +285,7 @@ table {
}

&.boost_20 {
background: linear-gradient(90deg, #FFD73B 0%, #A05700 100%);
background: linear-gradient(90deg, #ffd73b 0%, #a05700 100%);
text-align: center;
font-size: 16px;
font-style: normal;
Expand All @@ -295,7 +296,7 @@ table {
}

&.isActiveRow {
background: linear-gradient(90deg, #FFFFFF 0%, #35CCA6 100%);
background: linear-gradient(90deg, #ffffff 0%, #35cca6 100%);
text-align: center;
font-size: 16px;
font-style: normal;
Expand Down
118 changes: 118 additions & 0 deletions src/modules/Whitelist/stepAirdrop/Step/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import { CDN_URL_ICONS } from '@/config';
import { Button, Flex } from '@chakra-ui/react';
import cs from 'classnames';
import cx from 'clsx';
import Image from 'next/image';
import React, { useMemo } from 'react';
import s from './styles.module.scss';
import { ALLOWED_ATTRIBUTES } from '@/constants/constants';
import sanitizeHtml from 'sanitize-html';

export interface IItemCommunity {
title: string;
desc: string | React.ReactNode;
actionText: string;
actionHandle: any;
actionTextSecondary?: string;
actionHandleSecondary?: any;
isActive?: boolean;
isDone?: boolean;
image: string;
right: {
title: string;
desc: string;
};
}

export default function ItemCommunity({
index,
content,
isLoading,
}: {
index: number;
content: IItemCommunity;
isLoading?: boolean;
}) {
const { isActive, image } = content;

const isRunning = useMemo(() => {
return isActive;
}, [isActive, index]);

return (
<>
<div className={cx(s.itemCommunity, isRunning ? '' : s.isDone)}>
<Image
className={s.itemCommunity__logo}
width={48}
height={48}
src={`${CDN_URL_ICONS}/${image}`}
alt="ic-section"
/>
<Flex direction="column" gap="8px" flex={1}>
<Flex justifyContent="space-between" gap="16px">
<Flex direction="column" w="100%">
<div className={s.itemCommunity__title}>{content?.title}</div>
{!!content?.desc && (
<div
className={s.itemCommunity__desc}
dangerouslySetInnerHTML={{
__html: sanitizeHtml(content?.desc as string, {
allowedAttributes: ALLOWED_ATTRIBUTES,
}),
}}
/>
)}
{!!content?.actionText && (
<Flex direction="column" w="100%" mt="8px">
<Flex gap="8px" flexDirection="column" w="100%">
<Button
className={s.itemCommunity__btnCTA}
onClick={() => {
if (content?.actionHandle && isRunning && !isLoading) {
content?.actionHandle();
}
}}
isLoading={isLoading}
>
{content?.actionText}
</Button>
{!!content.actionHandleSecondary && (
<Button
className={cs(
s.itemCommunity__btnCTA,
s.itemCommunity__btnSecondary,
)}
onClick={() => {
if (
content?.actionHandleSecondary &&
isRunning &&
!isLoading
) {
content?.actionHandleSecondary();
}
}}
>
{content?.actionTextSecondary}
</Button>
)}
</Flex>
</Flex>
)}
</Flex>
<Flex direction="column">
<div className={s.itemCommunity__point}>
{content?.right.title}
</div>
{!!content?.desc && (
<div className={s.itemCommunity__pointNote}>
{content?.right.desc}
</div>
)}
</Flex>
</Flex>
</Flex>
</div>
</>
);
}
86 changes: 86 additions & 0 deletions src/modules/Whitelist/stepAirdrop/Step/styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
.itemCommunity {
flex-direction: row;
width: 100%;
display: flex;
padding: 16px;
align-items: flex-start;
gap: 24px;
align-self: stretch;
border: 1px solid rgba(255, 126, 33, 0.3);
background: rgba(255, 126, 33, 0.06);

&.isDone {
opacity: 40%;
}

&__title {
color: #000;
font-size: 18px;
font-style: normal;
font-weight: 400;
line-height: 26px;
}
&__desc {
color: #000;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 26px;
opacity: 0.7;
span {
font-weight: 700;
}
}
&__point {
color: #000;
text-align: right;
font-size: 18px;
font-style: normal;
font-weight: 400;
line-height: 26px;
white-space: pre;
}
&__pointNote {
color: #000;
text-align: right;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 26px;
opacity: 0.7;
white-space: pre;
}
&__btnCTA {
display: flex;
width: 100% !important;
max-width: 350px !important;
height: 48px !important;
padding: 16px 40px !important;
justify-content: center !important;
align-items: center !important;
gap: 8px !important;
background: #fa4e0e !important;
border-radius: 0 !important;
font-weight: 500 !important;
color: #ffffff !important;
}

&__btnSecondary {
background: white !important;
color: black !important;
}
&__btnCTA:hover {
opacity: 0.8;
}

&__logo {
@include is-mobile {
display: none;
}
}
}

.modalContent {
border-radius: 0px !important;
min-width: unset !important;
}
Loading

0 comments on commit 8bd3f31

Please sign in to comment.