From 9cb3c4fa2124d5e9124b50834276f537622b1f90 Mon Sep 17 00:00:00 2001 From: 0xmegalodon Date: Mon, 29 Jan 2024 17:09:32 +0700 Subject: [PATCH 1/4] update css --- src/modules/PublicSale/leaderBoardVisual/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/PublicSale/leaderBoardVisual/index.tsx b/src/modules/PublicSale/leaderBoardVisual/index.tsx index 57bb66217..3808af547 100644 --- a/src/modules/PublicSale/leaderBoardVisual/index.tsx +++ b/src/modules/PublicSale/leaderBoardVisual/index.tsx @@ -111,7 +111,7 @@ const LeaderBoardVisual = (props: IProps) => { }); if(newRes?.length > 0) { - latestContributors.current = newRes.concat(latestContributors.current); + latestContributors.current = [...newRes].concat(latestContributors.current); animatedLatestContributors.current = newRes; dispatch(setAnimatedLatestContributors(newRes)); } From b747aadf598b131f8ec7f9f4b1a8f0dc9c2cfb57 Mon Sep 17 00:00:00 2001 From: wilfred Date: Mon, 29 Jan 2024 17:30:00 +0700 Subject: [PATCH 2/4] update --- .../PublicSale/AuthForBuy/btnCreateGuest.tsx | 11 +++-- src/modules/PublicSale/AuthForBuy/index.tsx | 47 +++++++++++++------ .../PublicSale/AuthForBuy/styles.module.scss | 17 +++++++ .../depositModal/deposit.content.tsx | 4 +- .../depositModal/styles.module.scss | 9 +++- 5 files changed, 68 insertions(+), 20 deletions(-) diff --git a/src/modules/PublicSale/AuthForBuy/btnCreateGuest.tsx b/src/modules/PublicSale/AuthForBuy/btnCreateGuest.tsx index 3c67744ae..720155ee6 100644 --- a/src/modules/PublicSale/AuthForBuy/btnCreateGuest.tsx +++ b/src/modules/PublicSale/AuthForBuy/btnCreateGuest.tsx @@ -8,6 +8,7 @@ import { generateTOkenWithSecretCode } from '@/services/public-sale'; import AuthenStorage from '@/utils/storage/authen.storage'; import { setGuestSecretCode } from '@/stores/states/user/reducer'; import { useDispatch } from 'react-redux'; +import cs from 'classnames'; const BtnCreateGuest = () => { const dispatch = useDispatch(); @@ -47,14 +48,18 @@ const BtnCreateGuest = () => { = ({ children }) => { alignItems={'center'} gap={'16px'} > - - - - + */} diff --git a/src/modules/PublicSale/AuthForBuy/styles.module.scss b/src/modules/PublicSale/AuthForBuy/styles.module.scss index 22d908732..0e9d88f41 100644 --- a/src/modules/PublicSale/AuthForBuy/styles.module.scss +++ b/src/modules/PublicSale/AuthForBuy/styles.module.scss @@ -79,9 +79,26 @@ fill: #fff; } } + .iconBlack { + color: #000000; + path { + fill: #000000; + } + } } } .btnImport { background: #fa4e0e !important; } + +.link { + font-size: 14px; + opacity: 0.7; + text-decoration: underline; + cursor: pointer; + &:hover { + color: white; + opacity: 1; + } +} \ No newline at end of file diff --git a/src/modules/PublicSale/depositModal/deposit.content.tsx b/src/modules/PublicSale/depositModal/deposit.content.tsx index 599a21c0b..cf582ad53 100644 --- a/src/modules/PublicSale/depositModal/deposit.content.tsx +++ b/src/modules/PublicSale/depositModal/deposit.content.tsx @@ -116,7 +116,9 @@ const DepositContent: React.FC = ({ amount_usd, onHide }) => { {secretCode && ( <> - Your secret key. Backup now + + Use this code to claim. copy now + { diff --git a/src/modules/PublicSale/depositModal/styles.module.scss b/src/modules/PublicSale/depositModal/styles.module.scss index 478487574..5a4e7c7d8 100644 --- a/src/modules/PublicSale/depositModal/styles.module.scss +++ b/src/modules/PublicSale/depositModal/styles.module.scss @@ -215,9 +215,16 @@ align-items: center; justify-content: center; gap: 34px; + .titleCopy { + font-size: 16px; + font-weight: 400; + line-height: 26px; + letter-spacing: 0em; + text-align: left; + } .backupNow { align-items: center; - gap: 50px; + gap: 40px; background: linear-gradient( 0deg, rgba(250, 78, 14, 0.4), From 7701059f8511b39081ca8b7f1c833530827e2c98 Mon Sep 17 00:00:00 2001 From: 0xmegalodon Date: Mon, 29 Jan 2024 17:36:18 +0700 Subject: [PATCH 3/4] update css --- src/modules/PublicSale/leaderBoard/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/PublicSale/leaderBoard/index.tsx b/src/modules/PublicSale/leaderBoard/index.tsx index 5a4ba43df..fce261159 100644 --- a/src/modules/PublicSale/leaderBoard/index.tsx +++ b/src/modules/PublicSale/leaderBoard/index.tsx @@ -342,7 +342,7 @@ const LeaderBoard = (props: IProps) => { letterSpacing: '-0.5px', }, render(data: ILeaderBoardPoint) { - return ( + return data?.need_active && ( Date: Mon, 29 Jan 2024 17:38:25 +0700 Subject: [PATCH 4/4] check banned ip --- .../depositModal/deposit.content.tsx | 41 ++++++++++++++----- src/services/public-sale.ts | 6 +++ 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/modules/PublicSale/depositModal/deposit.content.tsx b/src/modules/PublicSale/depositModal/deposit.content.tsx index cf582ad53..a4ec79a42 100644 --- a/src/modules/PublicSale/depositModal/deposit.content.tsx +++ b/src/modules/PublicSale/depositModal/deposit.content.tsx @@ -1,11 +1,12 @@ import AppLoading from '@/components/AppLoading'; import SvgInset from '@/components/SvgInset'; import { PublicSaleWalletTokenDeposit } from '@/interfaces/vc'; -import { getPublicsaleWalletInfo } from '@/services/public-sale'; +import { getLocation, getPublicsaleWalletInfo } from '@/services/public-sale'; import { useAppSelector } from '@/stores/hooks'; import { commonSelector } from '@/stores/states/common/selector'; import { userSelector } from '@/stores/states/user/selector'; import { formatCurrency } from '@/utils/format'; +import AuthenStorage from '@/utils/storage/authen.storage'; import { compareString } from '@/utils/string'; import { Box, @@ -26,32 +27,31 @@ import { import BigNumber from 'bignumber.js'; import copy from 'copy-to-clipboard'; import React, { useEffect, useMemo, useState } from 'react'; +import { isMobile } from 'react-device-detect'; +import { GoogleReCaptchaProvider } from 'react-google-recaptcha-v3'; import toast from 'react-hot-toast'; import QRCode from 'react-qr-code'; import { useSelector } from 'react-redux'; +import ImportOrCreate from '../AuthForBuy/importOrCreate'; +import DepositCheck from './deposit.check'; import DepositContentItem, { DepositContentItem2, } from './deposit.content.item'; import s from './styles.module.scss'; -import { isMobile } from 'react-device-detect'; -import AuthenStorage from '@/utils/storage/authen.storage'; -import BaseModal from '@/components/BaseModal'; -import AuthForBuy from '../AuthForBuy'; -import BuyAsGuest from '../AuthForBuy/buyAsGuest'; -import ImportOrCreate from '../AuthForBuy/importOrCreate'; -import { GoogleReCaptchaProvider } from 'react-google-recaptcha-v3'; -import DepositCheck from './deposit.check'; -import { FormikProvider } from 'formik'; interface IDepositContent { amount_usd?: string; onHide?: any; } +const COUNTRY_BANNED: any[] = ['US']; + const DepositContent: React.FC = ({ amount_usd, onHide }) => { const { onClose, onOpen, isOpen } = useDisclosure(); const user = useAppSelector(userSelector); const [loading, setLoading] = useState(true); + const [checkingLocation, setCheckingLocation] = useState(true); + const [isBanned, setIsBanned] = useState(false); const [tokens, setTokens] = useState([]); const [selectToken, setSelectToken] = useState< PublicSaleWalletTokenDeposit | undefined @@ -63,10 +63,25 @@ const DepositContent: React.FC = ({ amount_usd, onHide }) => { const coinPrices = useSelector(commonSelector).coinPrices; + useEffect(() => { + checkLocation(); + }, []); + useEffect(() => { getTokens(); }, [user]); + const checkLocation = async () => { + try { + const rs = await getLocation(); + const country_code = rs?.data?.country_code; + setIsBanned(COUNTRY_BANNED.includes(country_code)); + } catch (error) { + } finally { + setCheckingLocation(false); + } + }; + const getTokens = async () => { try { const rs = await getPublicsaleWalletInfo(); @@ -103,7 +118,7 @@ const DepositContent: React.FC = ({ amount_usd, onHide }) => { return '0'; }, [coinPrices, amount_usd, selectToken]); - if (loading) { + if (loading || checkingLocation) { return (
@@ -111,6 +126,10 @@ const DepositContent: React.FC = ({ amount_usd, onHide }) => { ); } + if (isBanned) { + return
Not Available in Your Region
+ } + return ( {secretCode && ( diff --git a/src/services/public-sale.ts b/src/services/public-sale.ts index d66057d4c..de706fc4b 100644 --- a/src/services/public-sale.ts +++ b/src/services/public-sale.ts @@ -7,6 +7,7 @@ import { import createAxiosInstance from '@/services/http-client'; import { PERP_API_URL } from '@/config'; import { ILeaderBoardPoint } from '@/interfaces/leader-board-point'; +import axios from 'axios'; const apiClient = createAxiosInstance({ baseURL: `${PERP_API_URL}/api`, @@ -75,6 +76,11 @@ export const saleManualCheck = async (recaptcha: string): Promise => { return res; }; +export const getLocation = async (): Promise => { + const res = (await axios.get(`https://geolocation-db.com/json/`)) as unknown as any; + return res; +}; + export interface IPublicSalePrograme { id: number; title: string;