From 239d1ac354fa9b0b19c4ca4f5253b0f9a50f5ba0 Mon Sep 17 00:00:00 2001 From: alimaktabi Date: Wed, 7 Feb 2024 10:06:22 +0330 Subject: [PATCH 1/7] fixed update fetch data after login --- context/gasTapProvider.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/context/gasTapProvider.tsx b/context/gasTapProvider.tsx index 4c65766d..fbf4e2cd 100644 --- a/context/gasTapProvider.tsx +++ b/context/gasTapProvider.tsx @@ -309,8 +309,7 @@ export const GasTapProvider: FC< }, []); useEffect(() => { - if (!userToken || chainList.length) return; - updateChainList(); + if (!userToken) return; updateActiveClaimHistory(); updateOneTimeClaimedList(); updateFuelChampionList(); From 5b440c0dc1376e4786a244eed30da2e3e682179e Mon Sep 17 00:00:00 2001 From: Abbas Nosrati <96720246+abbasnosrati@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:25:18 +0330 Subject: [PATCH 2/7] Feature provider nextjs (#49) * create constant file * set chain name * refactor to use token requirement * refactor to use token requirement * remove extra file * add gastap donation api * add user donation type * fixed image address * remove comments * remove dead code * add donation card component * search component * update getUserDistributions api address * remove comment * fixed style * add filters * disable nft section * change crete token tap distribution type content * snake case tokenAddress * fixed text-[10px] to text-2xl * change text-[14px] to text-sm * change text-[14px] to text-sm * change text-[14px] to text-sm * fixed text-[] to tailwind class * move method prop outside of component * remove and add use client * remove log * set token tap constraint api * add token tap detail and verification route * fixed type * use form data to send data * set userTokenDistribution * fixed style * get user distribution from api * create detail and verification page * get constraint from token tap api * fixed type * fixed return * delete extra file * fixed typo * edit new style * fixed set max number of entry * edit style * refactor requirement functionality * fixed build error * fixed bug * remove logs * remove log * fixed uploaded file type * remove dead code * create distribution function * fixed bug * check allowance after approve * remove logs * create erc20 token distribution helper * remove approve state use token distribution helper --- app/contribution-hub/ChainList.tsx | 9 +- .../ConstraintDetailsModal.tsx | 223 +++++++-- app/contribution-hub/CsvFileInput.tsx | 14 +- app/contribution-hub/DisplaySteps.tsx | 2 +- app/contribution-hub/SelectMethodInput.tsx | 79 +++- app/contribution-hub/content.module.scss | 4 +- .../gas-tap/components/Content.tsx | 438 +++++++++++++----- .../components/ProvideGasFeeContent.tsx | 6 +- app/contribution-hub/gas-tap/create/page.tsx | 2 - app/contribution-hub/gas-tap/layout.tsx | 6 - app/contribution-hub/pagination.tsx | 2 +- .../prize-tap/components/CardTimer.tsx | 10 +- .../prize-tap/components/Content.tsx | 32 +- .../components/CreateRaffleModal/index.tsx | 80 ---- .../OfferPrizeForm/ContactInformation.tsx | 6 +- .../components/DepositContent.tsx | 4 +- .../components/DisplaySelectedTokenOrNft.tsx | 4 +- .../ShowPreviewModal/FormYouFilled.tsx | 12 +- .../RaffleCardTimerSubmitContribution.tsx | 2 +- .../ShowPreviewModal/RenderInitialBody.tsx | 6 +- .../ShowPreviewModal/RenderSocialMedia.tsx | 2 +- .../OfferPrizeForm/DepositPrize/index.tsx | 2 +- .../InformationVerification.tsx | 4 +- .../OfferPrizeForm/NewAddedConstraint.tsx | 2 +- .../components/AddNftIdListModal.tsx | 24 +- .../components/SelectChainDropDown.tsx | 6 +- .../PrizeInfo/components/SelectTokenOrNft.tsx | 57 ++- .../OfferPrizeForm/PrizeInfo/index.tsx | 8 +- .../components/ConstraintListModal.tsx | 2 +- .../OfferPrizeForm/Requirements/index.tsx | 4 +- .../components/ManualDuration.tsx | 2 +- .../components/PeopleLimitation.tsx | 4 +- .../components/StartDateComp.tsx | 6 +- .../components/OfferPrizeForm/index.tsx | 2 +- .../prize-tap/components/SearchInput.tsx | 1 - .../prize-tap/components/content.module.scss | 4 +- app/contribution-hub/styles.scss | 2 +- .../components/CardTimerTokenTap.tsx | 10 +- .../token-tap/components/Content.tsx | 306 ++++++++++-- .../components/DepositContent.tsx | 6 +- .../components/DisplaySelectedTokenOrNft.tsx | 4 +- .../ShowPreviewModal/FormYouFilled.tsx | 22 +- .../ShowPreviewModal/RenderInitialBody.tsx | 15 +- .../ShowPreviewModal/RenderSocialMedia.tsx | 2 +- .../OfferTokenForm/DepositToken/index.tsx | 33 +- .../OfferTokenForm/NewAddedConstraint.tsx | 2 +- .../TokenContactInformation.tsx | 22 +- .../components/AddNftIdListModal.tsx | 24 +- .../components/SelectChainDropDown.tsx | 6 +- .../TokenInfo/components/SelectTokenOrNft.tsx | 48 +- .../OfferTokenForm/TokenInfo/index.tsx | 10 +- .../TokenInformationVerification.tsx | 4 +- .../components/ConstraintListModal.tsx | 2 +- .../TokenTapRequirements/index.tsx | 4 +- .../components/ManualDuration.tsx | 6 +- .../components/PeopleLimitation.tsx | 4 +- .../components/StartDateComp.tsx | 6 +- .../TokenTapTimeEnrollLimitation/index.tsx | 6 +- .../components/OfferTokenForm/index.tsx | 34 +- .../token-tap/create/layout.tsx | 4 +- .../token-tap/details/[id]/layout.tsx | 31 ++ .../token-tap/details/[id]/page.tsx | 10 + app/contribution-hub/token-tap/layout.tsx | 12 - .../token-tap/verification/[id]/layout.tsx | 30 ++ .../token-tap/verification/[id]/page.tsx | 11 + .../Modals/FundTransactionModal/index.tsx | 2 +- app/prizetap/components/Linea/index.tsx | 8 +- app/prizetap/components/RafflesList.tsx | 41 +- .../landing/prizeTap/raffleTimer.tsx | 68 +-- .../containers/provider-dashboard/Header.tsx | 10 +- .../helpers/approveErc20Token.ts | 25 +- .../helpers/checkCollectionAddress.ts | 99 ++-- .../helpers/createErc20TokenDistribution.ts | 226 +++++---- .../helpers/getErc20TokenContract.ts | 37 +- .../helpers/getErc20TokenContractTokenTap.ts | 55 +++ .../hooks/useAddRequirement.ts | 9 +- .../containers/provider-dashboard/layout.tsx | 2 +- constants/contributionHub.ts | 85 ++++ constants/providerDashboard.tsx | 4 - context/providerDashboardContext.tsx | 110 +---- context/providerDashboardTokenTapContext.tsx | 265 +++-------- types/provider-dashboard.ts | 56 ++- utils/api/provider-dashboard.ts | 17 +- utils/routes.ts | 3 + utils/serverApis/contributionHub.ts | 37 +- 85 files changed, 1775 insertions(+), 1131 deletions(-) create mode 100644 app/contribution-hub/token-tap/details/[id]/layout.tsx create mode 100644 app/contribution-hub/token-tap/details/[id]/page.tsx delete mode 100644 app/contribution-hub/token-tap/layout.tsx create mode 100644 app/contribution-hub/token-tap/verification/[id]/layout.tsx create mode 100644 app/contribution-hub/token-tap/verification/[id]/page.tsx create mode 100644 components/containers/provider-dashboard/helpers/getErc20TokenContractTokenTap.ts create mode 100644 constants/contributionHub.ts delete mode 100644 constants/providerDashboard.tsx diff --git a/app/contribution-hub/ChainList.tsx b/app/contribution-hub/ChainList.tsx index fffe26c5..3f8cc6d7 100644 --- a/app/contribution-hub/ChainList.tsx +++ b/app/contribution-hub/ChainList.tsx @@ -7,14 +7,18 @@ interface Props { setRequirementParamsList: any; requirementParamsList: any; allChainList: Chain[] | undefined; + selectedChain: Chain | undefined; + setSelectedChain: (chain: Chain | undefined) => void; } const ChainList = ({ setRequirementParamsList, requirementParamsList, allChainList, + selectedChain, + setSelectedChain, }: Props) => { - const [selectedChain, setSelectedChain] = useState(); + // const [selectedChain, setSelectedChain] = useState(); const handleSelectChain = (chian: Chain) => { setSelectedChain(chian); @@ -42,7 +46,8 @@ const ChainList = ({ const chain = allChainList!.find( (item) => item.pk === requirementParamsList.CHAIN ); - setSelectedChain(chain); + setSelectedChain(chain!); + setChainName(chain!.chainName); }, [requirementParamsList]); useOutsideClick(ref, () => { diff --git a/app/contribution-hub/ConstraintDetailsModal.tsx b/app/contribution-hub/ConstraintDetailsModal.tsx index 84a9464a..e072e22b 100644 --- a/app/contribution-hub/ConstraintDetailsModal.tsx +++ b/app/contribution-hub/ConstraintDetailsModal.tsx @@ -1,14 +1,17 @@ "use client"; -import { useEffect, useState } from "react"; +import { FC, useEffect, useState } from "react"; import { RequirementProps, ConstraintProps, Chain } from "@/types"; import useAddRequirement from "@/components/containers/provider-dashboard/hooks/useAddRequirement"; import Icon from "@/components/ui/Icon"; import ChainList from "@/app/contribution-hub/ChainList"; import SelectMethodInput from "@/app/contribution-hub/SelectMethodInput"; import { useWalletProvider } from "@/utils/wallet"; -import { isAddress } from "viem"; -import { checkCollectionAddress } from "@/components/containers/provider-dashboard/helpers/checkCollectionAddress"; +import { isAddress, zeroAddress } from "viem"; +import { + checkNftCollectionAddress, + checkTokenContractAddress, +} from "@/components/containers/provider-dashboard/helpers/checkCollectionAddress"; import CsvFileInput from "./CsvFileInput"; interface CreateModalParam { @@ -18,6 +21,12 @@ interface CreateModalParam { constraintFile: any; allChainList: Chain[]; setConstraintFile: (item: any) => void; + requirementList: RequirementProps[]; + isCollectionValid: boolean; + setIsCollectionValid: (e: boolean) => void; + setErrorMessage: (message: string) => void; + decimals: number | undefined; + setDecimals: (decimal: number | undefined) => void; } interface DetailsModal { @@ -29,16 +38,14 @@ interface DetailsModal { allChainList: Chain[]; } -const ConstraintDetailsModal = ({ +const ConstraintDetailsModal: FC = ({ constraint, handleBackToConstraintListModal, requirementList, insertRequirement, updateRequirement, allChainList, -}: DetailsModal) => { - const provider = useWalletProvider(); - +}) => { const addRequirements = useAddRequirement( handleBackToConstraintListModal, insertRequirement, @@ -54,6 +61,10 @@ const ConstraintDetailsModal = ({ const [constraintFile, setConstraintFile] = useState(); + const [isCollectionValid, setIsCollectionValid] = useState(false); + + const [decimals, setDecimals] = useState(); + const createRequirementParamsList = () => { if (constraint.params.length > 0) { setRequirementParamsList( @@ -82,14 +93,15 @@ const ConstraintDetailsModal = ({ } }, []); - const checkingParamsValidation = async () => { + const checkingParamsValidation = () => { if (!requirementParamsList) return false; if ( - !requirementParamsList.COLLECTION_ADDRESS || + !requirementParamsList.ADDRESS || !requirementParamsList.CHAIN || - !requirementParamsList.MINIMUM + !requirementParamsList.MINIMUM || + Number(requirementParamsList.MINIMUM) <= 0 ) { - !requirementParamsList.COLLECTION_ADDRESS + !requirementParamsList.ADDRESS ? setErrorMessage("Please enter collection address.") : !requirementParamsList.CHAIN ? setErrorMessage("Please select chain.") @@ -97,27 +109,11 @@ const ConstraintDetailsModal = ({ return false; } - if (requirementParamsList.COLLECTION_ADDRESS) { - const step2Check = isAddress(requirementParamsList.COLLECTION_ADDRESS); - const chain = allChainList?.find( - (item) => Number(item.pk) === Number(requirementParamsList.CHAIN) - ); - - if (!chain) return false; - - const res = await checkCollectionAddress( - provider, - requirementParamsList.COLLECTION_ADDRESS, - Number(chain.chainId) - ); - - (!step2Check || !res) && setErrorMessage("Invalid contract address."); - return step2Check && res; - } + if (!isCollectionValid) return false; + return true; }; const checkCsvFileUploadedValidation = () => { - console.log(requirementParamsList, requirementParamsList.CSV_FILE); if (!requirementParamsList) return false; if (!requirementParamsList.CSV_FILE) { setErrorMessage("Please upload a csv file."); @@ -126,9 +122,12 @@ const ConstraintDetailsModal = ({ return true; }; - const handleAddRequirement = async () => { - if (constraint.name === "core.HasNFTVerification") { - const res = await checkingParamsValidation(); + const handleAddRequirement = () => { + if ( + constraint.name === "core.HasNFTVerification" || + constraint.name === "core.HasTokenVerification" + ) { + const res = checkingParamsValidation(); if (!res) return; } @@ -144,7 +143,8 @@ const ConstraintDetailsModal = ({ constraint.title, isNotSatisfy, requirementParamsList, - constraintFile + constraintFile, + decimals ); }; @@ -160,7 +160,7 @@ const ConstraintDetailsModal = ({ >
@@ -194,12 +194,18 @@ const ConstraintDetailsModal = ({ constraintFile={constraintFile} setConstraintFile={setConstraintFile} allChainList={allChainList} + requirementList={requirementList} + isCollectionValid={isCollectionValid} + setIsCollectionValid={setIsCollectionValid} + setErrorMessage={setErrorMessage} + decimals={decimals} + setDecimals={setDecimals} />
{constraint.description}
-
{errorMessage}
+
{errorMessage}
Add Requirement
@@ -207,51 +213,166 @@ const ConstraintDetailsModal = ({ ); }; -const CreateParams = ({ +const CreateParams: FC = ({ constraint, setRequirementParamsList, requirementParamsList, constraintFile, setConstraintFile, allChainList, -}: CreateModalParam) => { - const [reqNftAddress, setReqNftAddress] = useState(""); + requirementList, + isCollectionValid, + setIsCollectionValid, + setErrorMessage, + decimals, + setDecimals, +}) => { + const [collectionAddress, setCollectionAddress] = useState(""); + const [isNativeToken, setIsNativeToken] = useState(false); + const [selectedChain, setSelectedChain] = useState(); + const requirement = requirementList.find((item) => item.pk == constraint.pk); + + const provider = useWalletProvider(); useEffect(() => { - if (!requirementParamsList) return; - setReqNftAddress(requirementParamsList.COLLECTION_ADDRESS); - }, [requirementParamsList]); + if (requirement) { + if (!requirement.params) return; + setCollectionAddress(requirement.params.ADDRESS); + if (requirement.params.ADDRESS === zeroAddress) { + setIsNativeToken(true); + } else { + checkCollectionContract(); + } + } + }, []); + + useEffect(() => { + if (!collectionAddress) return; + const isAddressValid = isAddress(collectionAddress); + !isAddressValid && setErrorMessage("Invalid contract address."); + isAddressValid && setErrorMessage(""); + if (isAddressValid) { + if (collectionAddress === zeroAddress) { + setIsCollectionValid(true); + setDecimals(18); + return; + } else { + checkCollectionContract(); + } + } else { + setIsCollectionValid(false); + } + }, [collectionAddress, selectedChain, isNativeToken]); + + const checkCollectionContract = async () => { + if (!selectedChain) return; + let res = false; + + if (constraint.name === "core.HasNFTVerification") { + res = await checkNftCollectionAddress( + provider, + requirementParamsList.ADDRESS, + Number(selectedChain.chainId) + ); + setDecimals(18); + } + + if (constraint.name === "core.HasTokenVerification") { + if (requirementParamsList.ADDRESS == zeroAddress) { + setDecimals(18); + return true; + } + res = await checkTokenContractAddress( + provider, + requirementParamsList.ADDRESS, + Number(selectedChain.chainId), + setDecimals + ); + } + !res && setErrorMessage("Invalid contract address."); + setIsCollectionValid(res); + }; const handleChangeCollection = (address: string) => { - setReqNftAddress(address); + setCollectionAddress(address); setRequirementParamsList({ ...requirementParamsList, - ["COLLECTION_ADDRESS"]: address, + ["ADDRESS"]: address, }); }; - if (constraint.params.length === 0) return; + if (constraint.params.length === 0) return null; + + if ( + constraint.name === "core.HasNFTVerification" || + constraint.name === "core.HasTokenVerification" + ) { + const isNft: boolean = constraint.name === "core.HasNFTVerification"; + + const handleSelectNativeToken = (isNative: boolean) => { + if (!selectedChain) return; + setIsNativeToken((prev) => !prev); + !isNative ? setCollectionAddress(zeroAddress) : setCollectionAddress(""); + setRequirementParamsList({ + ...requirementParamsList, + ["ADDRESS"]: !isNative ? zeroAddress : "", + }); + }; - if (constraint.name === "core.HasNFTVerification") { return (
-
+ + {!isNft && ( +
handleSelectNativeToken(isNativeToken)} + className={`${ + !selectedChain ? "opacity-50" : "opacity-1 cursor-pointer" + } -mb-1 flex gap-2 items-center mt-2 min-h-[20px] max-w-[110px]`} + > + + is native token +
+ )} + +
handleChangeCollection(e.target.value)} />
+
); @@ -264,9 +385,11 @@ const CreateParams = ({ requirementParamsList={requirementParamsList} setConstraintFile={setConstraintFile} constraintFile={constraintFile} + requirement={requirement} /> ); } + return <>; }; diff --git a/app/contribution-hub/CsvFileInput.tsx b/app/contribution-hub/CsvFileInput.tsx index d2bbcad5..d63063d2 100644 --- a/app/contribution-hub/CsvFileInput.tsx +++ b/app/contribution-hub/CsvFileInput.tsx @@ -1,5 +1,6 @@ "use client"; import Icon from "@/components/ui/Icon"; +import { RequirementProps } from "@/types"; import React, { useEffect, useState } from "react"; interface Prop { @@ -7,22 +8,25 @@ interface Prop { setRequirementParamsList: any; setConstraintFile: (item: any) => void; constraintFile: any; + requirement: RequirementProps | undefined; } const CsvFileInput = ({ setRequirementParamsList, requirementParamsList, setConstraintFile, - constraintFile, + requirement, }: Prop) => { const [isUploadedFileValid, setIsUploadedFileValid] = useState(false); - - console.log(constraintFile); const [uploadedFileName, setUploadedFileName] = useState(); useEffect(() => { if (!requirementParamsList) return; if (!requirementParamsList.CSV_FILE) return; + if (requirement) { + if (!requirement.constraintFile) return; + setConstraintFile(requirement.constraintFile); + } setIsUploadedFileValid(true); setUploadedFileName(requirementParamsList.CSV_FILE); }, [requirementParamsList]); @@ -77,7 +81,7 @@ const CsvFileInput = ({ type="file" className="uploadFileInput w-[100%] flex cursor-pointer p-3 text-gray100" onChange={(e) => handleChangeUploadedFile(e)} - accept=".csv, .txt" + accept=".csv" />
@@ -86,7 +90,7 @@ const CsvFileInput = ({

file name: {uploadedFileName}

diff --git a/app/contribution-hub/DisplaySteps.tsx b/app/contribution-hub/DisplaySteps.tsx index e8636cdf..541b30a5 100644 --- a/app/contribution-hub/DisplaySteps.tsx +++ b/app/contribution-hub/DisplaySteps.tsx @@ -14,7 +14,7 @@ const DisplaySteps = ({ page, displaySteps }: Prop) => { > {displaySteps.map((item, index) => (
diff --git a/app/contribution-hub/SelectMethodInput.tsx b/app/contribution-hub/SelectMethodInput.tsx index 5d207586..afee4d0f 100644 --- a/app/contribution-hub/SelectMethodInput.tsx +++ b/app/contribution-hub/SelectMethodInput.tsx @@ -1,20 +1,36 @@ import Icon from "@/components/ui/Icon"; +import { RequirementProps } from "@/types"; import { useOutsideClick } from "@/utils/hooks/dom"; +import { fromWei, toWei } from "@/utils/numbersBigNumber"; import React, { useEffect, useRef, useState } from "react"; +import Big from "big.js"; export enum SelectMethod { Minimum = "Minimum", Maximum = "Maximum", } +interface MethodProp { + minimum: string; + maximum: string; +} + interface Prop { setRequirementParamsList: (e: any) => void; requirementParamsList: any; + isNft: boolean; + requirement: RequirementProps | undefined; + isDisabled: boolean; + decimals: number | undefined; } const SelectMethodInput = ({ setRequirementParamsList, requirementParamsList, + requirement, + isNft, + isDisabled, + decimals, }: Prop) => { const [selectedMethod, setSelectedMethod] = useState(); const [showItems, setShowItems] = useState(false); @@ -24,14 +40,9 @@ const SelectMethodInput = ({ setShowItems(false); }; - interface MethodProp { - minimum: number; - maximum: number; - } - const [methodValues, setMethodValues] = useState({ - minimum: 0, - maximum: 0, + minimum: "0", + maximum: "0", }); const ref = useRef(null); @@ -43,31 +54,56 @@ const SelectMethodInput = ({ const handleChangeMethodValues = (e: string) => { const value = e === "increase" - ? methodValues.minimum! + 1 - : Math.max(1, methodValues.minimum - 1); + ? Number(methodValues.minimum!) + 1 + : Math.max(0, Number(methodValues.minimum) - 1); + handleChange(value.toString()); + }; + const handleChange = (e: string) => { setMethodValues({ ...methodValues, - minimum: value, + minimum: isNft ? e.replace(/[^0-9]/g, "") : e, + }); + setRequirementParamsList({ + ...requirementParamsList, + ["MINIMUM"]: isNft + ? e.replace(/[^0-9]/g, "") + : e + ? new Big(toWei(e, decimals)).toFixed() + : "", }); - - setRequirementParamsList({ ...requirementParamsList, ["MINIMUM"]: value }); }; useEffect(() => { - if (!requirementParamsList) return; - if (!requirementParamsList.MINIMUM) return; + if (!methodValues.minimum) return; + handleChange(methodValues.minimum); + }, [decimals]); + + useEffect(() => { + if (!requirement) return; handleSelectMethod(); setMethodValues({ ...methodValues, - minimum: requirementParamsList.MINIMUM, + minimum: isNft + ? requirement.params.MINIMUM + : new Big( + fromWei( + requirement.params.MINIMUM, + requirement.decimals ? requirement.decimals : 18 + ) + ).toFixed(), }); - }, [requirementParamsList]); + }, []); + + const handleShowItems = () => { + if (isDisabled) return; + setShowItems(!showItems); + }; return (
setShowItems(!showItems)} + onClick={() => handleShowItems()} className="flex w-full items-center justify-between bored border-gray50 bg-gray40 rounded-xl px-3 h-[43px] cursor-pointer" >
+ {showItems && (
- setMethodValues({ - ...methodValues, - minimum: Number(e.target.value) ?? "", - }) - } + onChange={(e) => handleChange(e.target.value)} />
{ + const isTestnet = donation.faucet.chain.isTestnet; + const status = donation.status; + return ( +
+
+
+
+ +

{donation.faucet.chain.chainName}

+
+
+
+ {donation.faucet.chain.chainType} +
+
+ {isTestnet ? "Testnet" : "Mainnet"} +
+
+
+
+
+
+ Currency{" "} + + {" "} + {donation.faucet.chain.nativeCurrencyName} + +
+
+ Refill Amount{" "} + {donation.value} +
+
+
+ {status == Status.Pending && ( + +

Pending...

+
+ )} + {status == Status.Rejected && ( + +

Rejected

+
+ )} + {status == Status.Verified && ( + +

Done

+
+ )} +
+
+
+
+ ); +}; const GasTapContent = () => { + const [userDonations, setUserDonations] = useState([]); + const [loading, setLoading] = useState(false); + const { userToken } = useUserProfileContext(); + + const filter: filterProps = { + statusFilter: StatusFilters.All, + mainnetFilter: MainnetFilters.All, + evmFilter: EvmFilters.All, + }; + + const [selectedFilter, setSelectedFilter] = useState(filter); + + const [filteredItem, setFilteredItem] = useState([]); + + const handleGetUserDonations = useCallback(async () => { + if (!userToken) return; + try { + const donations = await getUserDonations(userToken); + setUserDonations(donations.results); + setLoading(false); + } catch (e: any) { + setLoading(false); + } + }, [userToken]); + + const handleSelectFilter = (filter: string, value: string) => { + if (selectedFilter[filter as keyof filterProps] == value) return; + setSelectedFilter({ ...selectedFilter, [filter]: value }); + setFilteredItem([]); + }; + + const canDisplayAll = + selectedFilter.evmFilter === "All" && + selectedFilter.mainnetFilter === "All" && + selectedFilter.statusFilter === "All"; + + const [searchPhrase, setSearchPhrase] = useState(""); + + const filterByPhrase = (filteredItem: UserDonation[]) => { + if (searchPhrase) { + setFilteredItem( + filteredItem.filter( + (item) => + item.faucet.chain.chainName + .toLocaleLowerCase() + .includes(searchPhrase.toLocaleLowerCase()) || + item.faucet.chain.chainId.includes(searchPhrase) || + item.value.includes(searchPhrase) + ) + ); + } else { + setFilteredItem(filteredItem); + } + }; + + useEffect(() => { + if (canDisplayAll) { + setFilteredItem(userDonations); + filterByPhrase(userDonations); + return; + } else { + let filteredItem = userDonations.filter((item) => + selectedFilter.statusFilter != "All" + ? item.status === selectedFilter.statusFilter + : item + ); + + filteredItem = filteredItem.filter((item) => + selectedFilter.evmFilter != "All" + ? item.faucet.chain.chainType === selectedFilter.evmFilter + : item + ); + + const isTestnet = selectedFilter.mainnetFilter === MainnetFilters.Testnet; + filteredItem = filteredItem.filter((item) => + selectedFilter.mainnetFilter != "All" + ? item.faucet.chain.isTestnet === isTestnet + : item + ); + + filterByPhrase(filteredItem); + } + }, [userDonations, selectedFilter, canDisplayAll, searchPhrase]); + + const handleSetSearchPhrase = (str: string) => { + const debounce = setTimeout(() => { + setSearchPhrase(str); + }, 700); + return () => clearTimeout(debounce); + }; + + useRefreshWithInitial( + () => { + setLoading(true); + handleGetUserDonations(); + }, + FAST_INTERVAL, + [] + ); + return (
-
- -
-
All
-
ongoing
-
verified
-
rejected
-
finished
+
+ +
+
+
handleSelectFilter("statusFilter", "All")} + > + All +
+
handleSelectFilter("statusFilter", "Pending")} + > + ongoing +
+
handleSelectFilter("statusFilter", "Verified")} + > + verified +
+
handleSelectFilter("statusFilter", "Rejected")} + > + rejected +
+
+
+
handleSelectFilter("mainnetFilter", "All")} + > + All +
+
handleSelectFilter("mainnetFilter", "Testnet")} + > + Testnet +
+
handleSelectFilter("mainnetFilter", "Mainnet")} + > + Mainnet +
+
+
+
handleSelectFilter("evmFilter", "All")} + > + All +
+
handleSelectFilter("evmFilter", "EVM")} + > + EVM +
+
handleSelectFilter("evmFilter", "NonEvm")} + > + nonEVM +
+
-

- Refill Gas Tap Tokens -

{" "} -

Provide Gas Fee.

+

Refill Gas Tap Tokens

{" "} +

Provide Gas Fee.

handleSelectProvideGasFee(true)} href={RoutePath.PROVIDER_GASTAP_CREATE} className="flex mt-5 sm:mt-0 items-center justify-center cursor-pointer border-2 border-white rounded-[12px] bg-[#0C0C17] w-[226px] h-[46px]" > @@ -48,111 +316,53 @@ const GasTapContent = () => {
-
-
-
- -

Polygon

-
-
-
- EVM -
-
- Mainnet -
-
-
-
-
-
- Currency Matic -
-
- Refill Amount 2,137 -
-
-
- -

Pending...

-
-
-
-
- -
-
-
- -

Polygon

-
-
-
- EVM -
-
- Mainnet -
-
-
-
-
-
- Currency Matic -
-
- Refill Amount 2,137 -
-
-
- -

Done

-
-
-
+ {filteredItem.length > 0 && + filteredItem.map((item, index) => ( + + ))} +
+ {filteredItem.length == 0 && loading && canDisplayAll && ( +
+ + +
+ )} -
-
-
- -

Polygon

-
-
-
- EVM -
-
- Mainnet -
-
-
-
-
-
- Currency Matic -
-
- Refill Amount 2,137 -
-
-
- -

Done

-
-
-
+ {filteredItem.length == 0 && !loading && ( +
+ No items found{" "}
-
+ )}
); }; export default GasTapContent; + +const Skeleton = () => { + return ( +
+
+
+
+

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ); +}; diff --git a/app/contribution-hub/gas-tap/components/ProvideGasFeeContent.tsx b/app/contribution-hub/gas-tap/components/ProvideGasFeeContent.tsx index 74f7e557..7b545bb6 100644 --- a/app/contribution-hub/gas-tap/components/ProvideGasFeeContent.tsx +++ b/app/contribution-hub/gas-tap/components/ProvideGasFeeContent.tsx @@ -1,3 +1,5 @@ +"use client"; + import FundTransactionModal from "@/app/gastap/components/Modals/FundTransactionModal"; import SelectChainModal from "@/app/gastap/components/Modals/SelectChainModal"; import { ClaimButton } from "@/components/ui/Button/button"; @@ -222,7 +224,7 @@ const ProvideGasFeeContent: FC<{ initialChainId?: number }> = ({
-

Provide Gas Fee

+

Provide Gas Fee

100% of contributions will fund distributions and transaction @@ -270,7 +272,7 @@ const ProvideGasFeeContent: FC<{ initialChainId?: number }> = ({ />

setFundAmount(balance.data?.formatted!)} - className="bg-gray20 select-not hover:bg-gray40 border border-gray100 text-gray100 text-[12px] flex items-center w-[52px] h-[28px] rounded-xl justify-center cursor-pointer" + className="bg-gray20 select-not hover:bg-gray40 border border-gray100 text-gray100 text-xs flex items-center w-[52px] h-[28px] rounded-xl justify-center cursor-pointer" > Max
diff --git a/app/contribution-hub/gas-tap/create/page.tsx b/app/contribution-hub/gas-tap/create/page.tsx index edbd4e16..9af7c27c 100644 --- a/app/contribution-hub/gas-tap/create/page.tsx +++ b/app/contribution-hub/gas-tap/create/page.tsx @@ -1,5 +1,3 @@ -"use client"; - import ProvideGasFeeContent from "../components/ProvideGasFeeContent"; const Page = () => { diff --git a/app/contribution-hub/gas-tap/layout.tsx b/app/contribution-hub/gas-tap/layout.tsx index 60a32708..926f8798 100644 --- a/app/contribution-hub/gas-tap/layout.tsx +++ b/app/contribution-hub/gas-tap/layout.tsx @@ -1,14 +1,8 @@ -import { getUserDonationsServer } from "@/utils/serverApis"; -import { cookies } from "next/headers"; import { FC, PropsWithChildren } from "react"; const ProviderDashboardGasTapLayout: FC = async ({ children, }) => { - const cookieStore = cookies(); - const token = cookieStore.get("userToken"); - const userDonationList = await getUserDonationsServer(token!.value); - console.log(userDonationList); return <>{children}; }; diff --git a/app/contribution-hub/pagination.tsx b/app/contribution-hub/pagination.tsx index f5463019..aa45280c 100644 --- a/app/contribution-hub/pagination.tsx +++ b/app/contribution-hub/pagination.tsx @@ -25,7 +25,7 @@ const Pagination = ({

Submit Contribution

diff --git a/app/contribution-hub/prize-tap/components/CardTimer.tsx b/app/contribution-hub/prize-tap/components/CardTimer.tsx index 47285dc4..a7934356 100644 --- a/app/contribution-hub/prize-tap/components/CardTimer.tsx +++ b/app/contribution-hub/prize-tap/components/CardTimer.tsx @@ -62,28 +62,28 @@ export const ProviderDashboardCardTimer = ({
{(start && Number(days) >= 1) || !start ? (
-
+

{days}

d

:

-
+

{hours}

h

:

-
+

{minutes}

m

:

-
+

{seconds}

@@ -94,7 +94,7 @@ export const ProviderDashboardCardTimer = ({ Number(minutes) > 0 || Number(hours) > 0 || Number(seconds) > 0 ? ( -
+
Ends in {hours} hours and {minutes} minutes and {seconds} seconds.
) : null} diff --git a/app/contribution-hub/prize-tap/components/Content.tsx b/app/contribution-hub/prize-tap/components/Content.tsx index cb70ae81..36161d21 100644 --- a/app/contribution-hub/prize-tap/components/Content.tsx +++ b/app/contribution-hub/prize-tap/components/Content.tsx @@ -13,17 +13,15 @@ import { ProviderDashboardButtonShowDetails, } from "../../Buttons"; import SearchInput from "./SearchInput"; -// import { usePrizeOfferFormContext } from "@/context/providerDashboardContext"; import { ProviderDashboardCardTimer } from "./CardTimer"; import Styles from "./content.module.scss"; import "./content.module.scss"; -// import OfferPrizeForm from "./OfferPrizeForm"; import WinnersModal from "./Modals/winnersModal"; import RoutePath from "@/utils/routes"; import Link from "next/link"; import { useUserProfileContext } from "@/context/userProfile"; import { getUserRaffles } from "@/utils/api"; -import { useFastRefresh, useRefreshWithInitial } from "@/utils/hooks/refresh"; +import { useRefreshWithInitial } from "@/utils/hooks/refresh"; import { FAST_INTERVAL } from "@/constants"; interface PrizeCardProp { @@ -41,8 +39,6 @@ enum RaffleStatus { } const PrizeCard = ({ prize }: PrizeCardProp) => { - // const { handleCheckForReason } = usePrizeOfferFormContext(); - const [winnersResultRaffle, setWinnersResultRaffle] = useState(null); @@ -67,7 +63,7 @@ const PrizeCard = ({ prize }: PrizeCardProp) => { width="15px" height="14px" /> -

+

on {prize.chain.chainName}

@@ -85,7 +81,7 @@ const PrizeCard = ({ prize }: PrizeCardProp) => {
-
+
{prize.prizeName}
{new Date(prize.startAt) < new Date() && @@ -115,7 +111,7 @@ const PrizeCard = ({ prize }: PrizeCardProp) => { )}
-
+
by {prize.creatorName}
@@ -143,7 +139,7 @@ const PrizeCard = ({ prize }: PrizeCardProp) => { new Date(prize.deadline) < new Date()) ? (
{prize.numberOfOnchainEntries ? ( -
+
{prize.maxNumberOfEntries - prize.numberOfOnchainEntries}{" "} {prize.status === RaffleStatus.FINISHED ? " Spots Enrolled" @@ -169,7 +165,7 @@ const PrizeCard = ({ prize }: PrizeCardProp) => { startTime={prize.startAt} FinishTime={prize.deadline} /> -
+

{prize.maxNumberOfEntries - prize.numberOfOnchainEntries}{" "} @@ -198,7 +194,7 @@ const PrizeCard = ({ prize }: PrizeCardProp) => {

) : (
-
+

{prize.numberOfOnchainEntries}{" "} {prize.numberOfOnchainEntries > 1 ? "spots" : "spot"} Enrolled @@ -206,7 +202,7 @@ const PrizeCard = ({ prize }: PrizeCardProp) => {

handleWinnersResult(prize)} - className="bg-gray50 rounded-xl cursor-pointer border border-gray70 text-[10px] font-medium text-gray100 h-[48px] flex items-center justify-center" + className="bg-gray50 rounded-xl cursor-pointer border border-gray70 text-2xs font-medium text-gray100 h-[48px] flex items-center justify-center" >

{prize.numberOfOnchainEntries >= 1 && @@ -339,7 +335,7 @@ const PrizeTapContent = () => { handleSetSearchPhrase={handleSetSearchPhrase} />

{
-

Offer a New Prize

{" "} -

+

Offer a New Prize

{" "} +

Here you can provide an NFT or Token for Prize Tap.

@@ -443,10 +439,10 @@ const Skeleton = () => {
-
-
+
+
-
+
diff --git a/app/contribution-hub/prize-tap/components/CreateRaffleModal/index.tsx b/app/contribution-hub/prize-tap/components/CreateRaffleModal/index.tsx index ff2cc343..3874eec4 100644 --- a/app/contribution-hub/prize-tap/components/CreateRaffleModal/index.tsx +++ b/app/contribution-hub/prize-tap/components/CreateRaffleModal/index.tsx @@ -10,13 +10,10 @@ import { useWalletNetwork, } from "@/utils/wallet"; import { ClaimButton } from "@/components/ui/Button/button"; -import Icon from "@/components/ui/Icon"; -import { Text } from "@/components/ui/text.style"; import Modal from "@/components/ui/Modal/modal"; const CreateRaffleModalBody = ({ chain }: { chain: Chain }) => { const { address, isConnected } = useWalletAccount(); - const { chain: activeChain } = useWalletNetwork(); const chainId = activeChain?.id; const { switchChain } = useNetworkSwitcher(); @@ -29,15 +26,6 @@ const CreateRaffleModalBody = ({ chain }: { chain: Chain }) => { function renderWrongNetworkBody(chain: Chain) { return ( <> - {/* - - */}

You need to switch to the {chain.chainName} network.

@@ -79,79 +67,11 @@ const CreateRaffleModalBody = ({ chain }: { chain: Chain }) => { ); } - function renderSuccessBody() { - const handleShareClaimTwitter = () => { - // const twitterUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent( - // `I won ${selectedRaffleForEnroll?.name} from @Unitap_app among ${ - // selectedRaffleForEnroll?.numberOfOnchainEntries - // } participants. 🤩🎉 (raffled off by @${selectedRaffleForEnroll?.twitterUrl.split('/').at(-1)}) - // Try your luck to win valuable prizes at `, - // )}&url=${encodeURIComponent('unitap.app/prize-tap')}`; - // window.open(twitterUrl, '_blank'); - // }; - // const handleShareEnrollTwitter = () => { - // const twitterUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent( - // `Trying my chances to win ${ - // selectedRaffleForEnroll?.name - // } at @unitap_app (raffled off by @${selectedRaffleForEnroll?.twitterUrl.split('/').at(-1)}) 💚💜 - // Feeling lucky? 😎 `, - // )}&url=${encodeURIComponent('unitap.app/prize-tap')}`; - // window.open(twitterUrl, '_blank'); - }; - - return ( - <> - - {/* - successfully enrolled in {selectedRaffleForEnroll?.name} raffle - */} - - - - window.open(getTxUrl(chain, claimOrEnrollWithMetamaskResponse!.txHash!), '_blank')} - > - view on explorer - - -
- - -
- - ); - } - const getEnrollModalBody = () => { if (!userProfile) return ; if (!isConnected) return ; - // if (createRaffleResponse?.state === 'Done') return renderSuccessBody(); - if (!chainId || chainId.toString() !== chain.chainId) return renderWrongNetworkBody(chain); diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/ContactInformation.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/ContactInformation.tsx index 9df35e01..0410b640 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/ContactInformation.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/ContactInformation.tsx @@ -85,7 +85,7 @@ const ContactInformation = ({ {index == 3 &&

Contact info

}
= 3 ? "mb-2" : "" } ${ (field.required && showErrors && !data[field.name]) || @@ -110,14 +110,14 @@ const ContactInformation = ({ />
{field.required && showErrors && !data[field.name] && ( -

+

Required

)} {showErrors && data[field.name] && !(socialMediaValidation as any)[field.name] && ( -

+

Invalid input

)} diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/DepositContent.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/DepositContent.tsx index 42dcd8f3..452b2ab5 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/DepositContent.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/DepositContent.tsx @@ -22,8 +22,8 @@ const DepositContent = ({ width={isNFT ? "84x" : "90px"} />
-

{title}

-

{description}

+

{title}

+

{description}

); diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/DisplaySelectedTokenOrNft.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/DisplaySelectedTokenOrNft.tsx index 9d066ff6..ca9b27f7 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/DisplaySelectedTokenOrNft.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/DisplaySelectedTokenOrNft.tsx @@ -7,7 +7,7 @@ interface Prop { const DisplaySelectedTokenOrNft = ({ data }: Prop) => { return ( -
+
{!data.isNft ? (
@@ -33,7 +33,7 @@ const DisplaySelectedTokenOrNft = ({ data }: Prop) => { {data.nftTokenIds.length} {data.nftName}{" "} {data.nftTokenIds.length > 1 ? "NFTs" : "NFT"}
-
+
{data.nftTokenIds.join(", ")}
diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/ShowPreviewModal/FormYouFilled.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/ShowPreviewModal/FormYouFilled.tsx index 9aaa75ee..a0f1fea9 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/ShowPreviewModal/FormYouFilled.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/ShowPreviewModal/FormYouFilled.tsx @@ -49,7 +49,7 @@ const FormYouFilled = ({ data }: Prop) => {

{prizeName}

-

+

on{" "} {data.selectedChain?.chainName ? data.selectedChain.chainName : ""}

@@ -60,7 +60,7 @@ const FormYouFilled = ({ data }: Prop) => { />
-
+

{prizeName}

@@ -98,10 +98,10 @@ const FormYouFilled = ({ data }: Prop) => { ) : null}
-
+
by {data.provider}
-
+
{data.description}
@@ -109,7 +109,7 @@ const FormYouFilled = ({ data }: Prop) => { ? requirementList.map((item, index) => { return (
{item.isNotSatisfy && "Not "} {item.title} @@ -125,7 +125,7 @@ const FormYouFilled = ({ data }: Prop) => { >
-

0 people enrolled

+

0 people enrolled

+

{days} diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/ShowPreviewModal/RenderInitialBody.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/ShowPreviewModal/RenderInitialBody.tsx index 0fdd4414..41ed63ec 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/ShowPreviewModal/RenderInitialBody.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/ShowPreviewModal/RenderInitialBody.tsx @@ -51,7 +51,7 @@ const RenderInitialBody = ({ data }: Prop) => { ]); return (

-
+
This is how your card will appear. If you are sure of the accuracy of the form you filled out, please submit your contribution.
@@ -62,7 +62,7 @@ const RenderInitialBody = ({ data }: Prop) => { Switch Network @@ -89,7 +89,7 @@ const RenderInitialBody = ({ data }: Prop) => { {createRaffleLoading ? ( diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/ShowPreviewModal/RenderSocialMedia.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/ShowPreviewModal/RenderSocialMedia.tsx index da24b836..0b23fb7e 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/ShowPreviewModal/RenderSocialMedia.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/components/ShowPreviewModal/RenderSocialMedia.tsx @@ -10,7 +10,7 @@ interface Prop { const RenderSocialMedia = ({ data }: Prop) => { return ( -
+
{socialMedias.map( (item, index) => data[item as keyof ProviderDashboardFormDataProp] && ( diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/index.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/index.tsx index f9f9b910..3117c7a8 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/index.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/DepositPrize/index.tsx @@ -127,7 +127,7 @@ const DepositPrize = ({ ) : address && !isRightChain && data.selectedChain ? ( Switch Network diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/InformationVerification.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/InformationVerification.tsx index 0c17ee9d..b665b841 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/InformationVerification.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/InformationVerification.tsx @@ -9,10 +9,10 @@ import RoutePath from "@/utils/routes"; const InformationVerification = () => { const { selectedRaffleForCheckReason } = usePrizeOfferFormContext(); return ( -
+
-
+
{!selectedRaffleForCheckReason ? (
{" "} diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/NewAddedConstraint.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/NewAddedConstraint.tsx index 70cd690a..d6fc5f6f 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/NewAddedConstraint.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/NewAddedConstraint.tsx @@ -47,7 +47,7 @@ const NewAddedConstraint = ({ requirement }: Props) => {
Edit
diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/PrizeInfo/components/AddNftIdListModal.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/PrizeInfo/components/AddNftIdListModal.tsx index c3a33834..31eaa1ad 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/PrizeInfo/components/AddNftIdListModal.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/PrizeInfo/components/AddNftIdListModal.tsx @@ -239,7 +239,7 @@ const AddNftIdListModalModalBody = () => {
{!!Number(nftRange.to) && Number(nftRange.from) >= Number(nftRange.to) && ( -

+

Invalid range

)} @@ -247,7 +247,7 @@ const AddNftIdListModalModalBody = () => { !uploadedFile && !invalidInput && !(Number(nftRange.from) >= Number(nftRange.to)) ? ( -

+

{error}

) : null} @@ -258,7 +258,7 @@ const AddNftIdListModalModalBody = () => { {selectedTab === tabsName.PASTE_IDS && (
@@ -275,13 +275,13 @@ const AddNftIdListModalModalBody = () => {
{error && !textAreaData && !invalidInput ? ( -

+

{error}

) : null} {error && textAreaData && invalidInput ? ( -

+

{error}

) : null} @@ -302,7 +302,7 @@ const AddNftIdListModalModalBody = () => {

{
{error && !uploadedFile && !invalidInput ? ( -

+

{error}

) : null} {error && uploadedFile && invalidInput ? ( -

+

{error}

) : null} @@ -344,7 +344,7 @@ const AddNftIdListModalModalBody = () => {

@@ -366,17 +366,17 @@ const AddNftIdListModalModalBody = () => { >
)} -

+

{nftStatus.length > 0 && "Invalid NFT IDs is entered"}

{error && !!uploadedFile && nftIds.length > 0 && ( -

{error}

+

{error}

)}
@@ -107,8 +113,11 @@ const SelectTokenOrNft = ({ showErrors, isRightChain }: Prop) => {
handleSelectNativeToken(data.isNativeToken)} + className="flex items-center justify-center gap-1 text-white text-2xs mb-[9px] cursor-pointer max-w-[140px]" + onClick={() => { + if (!isRightChain) return; + handleSelectNativeToken(data.isNativeToken); + }} > { : "/assets/images/provider-dashboard/check-true.svg" } /> -

use native token

+

use native token

{
{tokenContractStatus.isValid === ContractValidationStatus.NotValid && ( -

+

Invalid Token Contract Address

)} {showErrors && !data.tokenContractAddress && ( -

+

Required

)} @@ -239,7 +248,7 @@ const SelectTokenOrNft = ({ showErrors, isRightChain }: Prop) => { className="py-2" />

Total Amount

@@ -256,16 +265,16 @@ const SelectTokenOrNft = ({ showErrors, isRightChain }: Prop) => { {showErrors && (!data.totalAmount || Number(data.totalAmount) <= 0) ? ( -

+

Required

) : Number(data.winnersCount) > 500 ? ( -

+

The maximum number of winners is 500.

) : ( insufficientBalance && ( -

+

Insufficient Balance

) @@ -277,7 +286,7 @@ const SelectTokenOrNft = ({ showErrors, isRightChain }: Prop) => {
= 1 ? "opacity-[0.5]" : "opacity-1" @@ -319,13 +328,13 @@ const SelectTokenOrNft = ({ showErrors, isRightChain }: Prop) => { )}
{showErrors && !data.nftContractAddress && ( -

+

Required

)} {nftContractStatus.isValid === ContractValidationStatus.NotValid && ( -

+

Invalid NFT Contract Address

)} @@ -340,7 +349,7 @@ const SelectTokenOrNft = ({ showErrors, isRightChain }: Prop) => {
500 || (data.nftTokenIds.length > 0 && data.nftTokenIds.length != Number(numberOfNfts)) @@ -375,23 +384,23 @@ const SelectTokenOrNft = ({ showErrors, isRightChain }: Prop) => { />
{Number(numberOfNfts) > 500 && ( -

+

Maximum is 500

)}
{data.nftTokenIds.length > 0 && data.nftTokenIds.length != Number(numberOfNfts) && ( -

+

Number of NFTs are not equal with Number of NFts you added.

)}
{data.nftTokenIds.length > 0 ? (
-
+

{data.nftTokenIds.length} NFT ID added

-
+

{data.nftTokenIds.length > 1 ? data.nftTokenIds.join(", ") @@ -402,7 +411,7 @@ const SelectTokenOrNft = ({ showErrors, isRightChain }: Prop) => {

@@ -420,7 +429,7 @@ const SelectTokenOrNft = ({ showErrors, isRightChain }: Prop) => { if (!numberOfNfts) return; openAddNftIdListModal(); }} - className={`flex text-white text-[12px] ${ + className={`flex text-white text-xs ${ nftContractStatus.isValid === ContractValidationStatus.NotValid || !numberOfNfts || @@ -443,7 +452,7 @@ const SelectTokenOrNft = ({ showErrors, isRightChain }: Prop) => {
{data.nftTokenIds.length == 0 && showErrors && ( -

+

Required

)} diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/PrizeInfo/index.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/PrizeInfo/index.tsx index d7fc0cfa..db5b454e 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/PrizeInfo/index.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/PrizeInfo/index.tsx @@ -82,7 +82,7 @@ const PrizeInfo = ({ >
@@ -101,7 +101,7 @@ const PrizeInfo = ({

{data.provider?.length}/30

{showErrors && !data.provider && ( -

+

Required

)} @@ -113,7 +113,7 @@ const PrizeInfo = ({
{data.description?.length}/100

{showErrors && !data.description && ( -

+

Required

)} diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/Requirements/components/ConstraintListModal.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/Requirements/components/ConstraintListModal.tsx index 55536a95..32a0b08c 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/Requirements/components/ConstraintListModal.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/Requirements/components/ConstraintListModal.tsx @@ -51,7 +51,7 @@ export const InitialBody = () => { className="cursor-pointer z-[999999]" />
-

General

+

General

{constraintsListApi!.map((constraint, index) => (
-
+

Add any requirements for Enrolling or leave it free.

@@ -23,7 +23,7 @@ const Requirements = ({ ))}
{
))}
-
+
diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/TimeEnrollLimitation/components/PeopleLimitation.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/TimeEnrollLimitation/components/PeopleLimitation.tsx index 5ccf4e53..cd740e59 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/TimeEnrollLimitation/components/PeopleLimitation.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/TimeEnrollLimitation/components/PeopleLimitation.tsx @@ -8,7 +8,7 @@ interface PeopleLimitationProp { const PeopleLimitation = ({ showErrors }: PeopleLimitationProp) => { const { data, handleChange, isShowingDetails } = usePrizeOfferFormContext(); return ( -
+
{ />
{showErrors && !showErrors.maximumLimitationStatus && ( -

+

{showErrors?.maximumLimitationMessage}

)} diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/TimeEnrollLimitation/components/StartDateComp.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/TimeEnrollLimitation/components/StartDateComp.tsx index e121a5c3..935af523 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/TimeEnrollLimitation/components/StartDateComp.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/TimeEnrollLimitation/components/StartDateComp.tsx @@ -42,13 +42,13 @@ const StartDateComp = ({ showErrors }: StartDateCompProp) => { return (
-

+

Start Date & Time

{ />
{showErrors && showErrors.startDateStatus == false && ( -

+

{showErrors && showErrors.statDateStatusMessage}

)} diff --git a/app/contribution-hub/prize-tap/components/OfferPrizeForm/index.tsx b/app/contribution-hub/prize-tap/components/OfferPrizeForm/index.tsx index 2455dd1b..f63a5e07 100644 --- a/app/contribution-hub/prize-tap/components/OfferPrizeForm/index.tsx +++ b/app/contribution-hub/prize-tap/components/OfferPrizeForm/index.tsx @@ -57,7 +57,7 @@ const OfferPrizeForm = ({ detailRafflePk, verificationRafflePK }: FromProp) => { {page >= 1 && page < 5 && ( )} diff --git a/app/contribution-hub/prize-tap/components/SearchInput.tsx b/app/contribution-hub/prize-tap/components/SearchInput.tsx index c9fda652..849408af 100644 --- a/app/contribution-hub/prize-tap/components/SearchInput.tsx +++ b/app/contribution-hub/prize-tap/components/SearchInput.tsx @@ -26,7 +26,6 @@ const SearchInput = ({ const phrase: string = event.target.value; setSearchPhraseInput(phrase); handleSetSearchPhrase(phrase); - // changeSearchPhrase!(phrase); updateURLQuery(phrase); }; diff --git a/app/contribution-hub/prize-tap/components/content.module.scss b/app/contribution-hub/prize-tap/components/content.module.scss index ff00cb27..dfb71435 100644 --- a/app/contribution-hub/prize-tap/components/content.module.scss +++ b/app/contribution-hub/prize-tap/components/content.module.scss @@ -75,11 +75,11 @@ } .requireModal { - @apply text-[14px] font-semibold flex flex-col gap-2 items-center justify-center cursor-pointer max-w-[184px] h-[84px] bg-gray40 border border-gray70 rounded-xl; + @apply text-sm font-semibold flex flex-col gap-2 items-center justify-center cursor-pointer max-w-[184px] h-[84px] bg-gray40 border border-gray70 rounded-xl; } .requireModalIntegration { - @apply bg-gray40 border mt-1 border-gray70 text-gray100 text-[14px] font-semibold cursor-pointer max-w-[376px] rounded-xl px-3 h-[48px] flex items-center justify-between; + @apply bg-gray40 border mt-1 border-gray70 text-gray100 text-sm font-semibold cursor-pointer max-w-[376px] rounded-xl px-3 h-[48px] flex items-center justify-between; } .provider-dashboard-input { diff --git a/app/contribution-hub/styles.scss b/app/contribution-hub/styles.scss index 7ef7b36c..8ecd7f47 100644 --- a/app/contribution-hub/styles.scss +++ b/app/contribution-hub/styles.scss @@ -3,7 +3,7 @@ } .requireModal { - @apply text-[14px] font-semibold flex flex-col gap-2 items-center justify-center cursor-pointer max-w-[184px] h-[84px] bg-gray40 border border-gray70 rounded-xl; + @apply text-sm font-semibold flex flex-col gap-2 items-center justify-center cursor-pointer max-w-[184px] h-[84px] bg-gray40 border border-gray70 rounded-xl; } .enrollment-duration-wrap > div:last-child { diff --git a/app/contribution-hub/token-tap/components/CardTimerTokenTap.tsx b/app/contribution-hub/token-tap/components/CardTimerTokenTap.tsx index 0b0897a9..ae580b8e 100644 --- a/app/contribution-hub/token-tap/components/CardTimerTokenTap.tsx +++ b/app/contribution-hub/token-tap/components/CardTimerTokenTap.tsx @@ -80,29 +80,29 @@ export const CardTimerTokenTap = ({ : "Starts in"} :

-
-
+
+

{days}

d

:

-
+

{hours}

h

:

-
+

{minutes}

m

:

-
+

{seconds}

diff --git a/app/contribution-hub/token-tap/components/Content.tsx b/app/contribution-hub/token-tap/components/Content.tsx index 205307c4..9436ac29 100644 --- a/app/contribution-hub/token-tap/components/Content.tsx +++ b/app/contribution-hub/token-tap/components/Content.tsx @@ -4,35 +4,44 @@ import { ProviderDashboardButton, ProviderDashboardButtonCheck, ProviderDashboardButtonRejected, + ProviderDashboardButtonShowDetails, ProviderDashboardButtonSuccess, ProviderDashboardButtonVerifying, } from "../../Buttons"; import Icon from "@/components/ui/Icon"; -import SearchInput from "@/app/contribution-hub/prize-tap/components/SearchInput"; -import { ProviderDashboardCardTimer } from "@/app/contribution-hub/prize-tap/components/CardTimer"; +import SearchInput from "../../prize-tap/components/SearchInput"; import Styles from "./content.module.scss"; import Link from "next/link"; import RoutePath from "@/utils/routes"; import { getUserDistributions } from "@/utils/api/provider-dashboard"; import { useRefreshWithInitial } from "@/utils/hooks/refresh"; import { FAST_INTERVAL } from "@/constants"; -import { useCallback, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { useUserProfileContext } from "@/context/userProfile"; import { UserTokenDistribution } from "@/types/provider-dashboard"; import { CardTimerTokenTap } from "./CardTimerTokenTap"; -const handleSetSearchPhrase = () => {}; - interface DistributionCardProp { distribution: UserTokenDistribution; } +enum Filters { + All = "All", + Pending = "PENDING", + Verified = "VERIFIED", + Rejected = "REJECTED", + Finished = "Finished", +} + const DistributionCard = ({ distribution }: DistributionCardProp) => { const [finished, setFinished] = useState(false); const [isStarted, setIsStarted] = useState(false); + const isStart = new Date(distribution.startAt) < new Date(); + const isFinished = new Date(distribution.deadline) < new Date(); + const status = distribution.status; return ( -
+
@@ -41,29 +50,44 @@ const DistributionCard = ({ distribution }: DistributionCardProp) => { width="36px" height="36px" /> -

+

{distribution.name}

- {isStarted && !finished && ( + {status === Filters.Rejected && ( + +

Rejected

+
+ )} + {status === Filters.Pending && ( + + Verifying + + )} + {isStart && !isFinished && status == Filters.Verified && (

Ongoing...

)} - {finished && ( -
+ {!isStart && status == Filters.Verified && ( + +

Verified

+
+ )} + {isFinished && status == Filters.Verified && ( +
Finished
)}
-
+
Decentralized verification system
-
+
on {distribution.chain.chainName}
{ />
-
non-Repeatable
+
non-Repeatable
-
- 30 Spots Left +
+ {isStart && isFinished && status === Filters.Verified && ( +
+ {distribution.numberOfClaims} Spots Enrolled +
+ )} + + {isStart && !isFinished && status === Filters.Verified && ( +
+ {distribution.maxNumberOfClaims - distribution.numberOfClaims}{" "} + Spots left +
+ )}
-
- +
+ {status == Filters.Verified && ( + + )} + + {status == Filters.Pending && ( + + + Show Details + + + )} + + + {status === Filters.Rejected && ( + + Check For Reasons + + )} +
@@ -99,42 +158,161 @@ const DistributionCard = ({ distribution }: DistributionCardProp) => { }; const TokenTapContent = () => { + const { userToken } = useUserProfileContext(); + const [userDistributions, setUserDistributions] = useState< - UserTokenDistribution[] | undefined - >(); + UserTokenDistribution[] + >([]); - const { userToken } = useUserProfileContext(); + const [filteredItems, setFilteredItems] = useState( + [] + ); + + const [selectedFilter, setSelectedFilter] = useState(Filters.All); + + const handleSelectFilter = (filter: any) => { + if (filter == selectedFilter) return; + setFilteredItems([]); + setSelectedFilter(filter); + }; + + const [loading, setLoading] = useState(false); + + const [searchPhrase, setSearchPhrase] = useState(""); + + const handleSetSearchPhrase = (str: string) => { + const debounce = setTimeout(() => { + setSearchPhrase(str); + }, 700); + return () => clearTimeout(debounce); + }; const handleGetUserDistribution = useCallback(async () => { if (!userToken) return; - const res = await getUserDistributions(userToken); - console.log(res); - setUserDistributions(res); + try { + const distributions = await getUserDistributions(userToken); + setUserDistributions(distributions); + setLoading(false); + } catch (e: any) { + setLoading(false); + } }, [userToken]); + useEffect(() => { + if (selectedFilter === Filters.All) { + setFilteredItems(userDistributions); + } + + if (selectedFilter === Filters.Rejected) { + setFilteredItems( + userDistributions.filter((item) => item.status === Filters.Rejected) + ); + } + + // this is ongoing filter. we have no pending filter to display + if (selectedFilter === Filters.Pending) { + setFilteredItems( + userDistributions.filter( + (item) => + item.status === Filters.Verified && + new Date(item.startAt) < new Date() && + new Date(item.deadline) > new Date() + ) + ); + } + + if (selectedFilter === Filters.Verified) { + setFilteredItems( + userDistributions.filter( + (item) => + item.status === Filters.Verified && + item.status === Filters.Verified && + new Date(item.startAt) > new Date() + ) + ); + } + + if (selectedFilter === Filters.Finished) { + setFilteredItems( + userDistributions.filter( + (item) => + item.status === Filters.Verified && + new Date(item.deadline) < new Date() + ) + ); + } + if (searchPhrase) { + setFilteredItems( + filteredItems.filter( + (item) => + item.chain.chainName + .toLocaleLowerCase() + .includes(searchPhrase.toLocaleLowerCase()) || + item.name + .toLocaleLowerCase() + .includes(searchPhrase.toLocaleLowerCase()) || + item.chain.chainId.includes(searchPhrase) + ) + ); + } + }, [userDistributions, selectedFilter, searchPhrase]); + useRefreshWithInitial( () => { - // setUserRafflesLoading(true); + setLoading(true); handleGetUserDistribution(); }, FAST_INTERVAL, [] ); return ( - <> -
+
+
-
All
-
ongoing
-
verified
-
rejected
-
finished
+
handleSelectFilter(Filters.All)} + > + All +
+
handleSelectFilter(Filters.Pending)} + > + ongoing +
+
handleSelectFilter(Filters.Verified)} + > + verified +
+
handleSelectFilter(Filters.Rejected)} + > + rejected +
+
handleSelectFilter(Filters.Finished)} + > + finished +
{
-

Offer a New Token

{" "} -

+

Offer a New Token

{" "} +

Here you can provide Token for Token Tap.

@@ -162,13 +340,51 @@ const TokenTapContent = () => {
- {userDistributions && - userDistributions.map((distribution, index: number) => ( + {filteredItems.length > 0 && + filteredItems.map((distribution, index: number) => ( ))}
- + + {loading && + filteredItems.length == 0 && + selectedFilter === Filters.All && ( +
+ + + +
+ )} + + {filteredItems.length === 0 && !loading && ( +
+

No items found.

+
+ )} +
); }; export default TokenTapContent; + +const Skeleton = () => { + return ( +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ); +}; diff --git a/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/DepositContent.tsx b/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/DepositContent.tsx index 430025d4..547b7ccf 100644 --- a/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/DepositContent.tsx +++ b/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/DepositContent.tsx @@ -9,10 +9,10 @@ type DepositContentProp = { const DepositContent = ({ title, description, icon }: DepositContentProp) => { return (
- +
-

{title}

-

{description}

+

{title}

+

{description}

); diff --git a/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/DisplaySelectedTokenOrNft.tsx b/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/DisplaySelectedTokenOrNft.tsx index 9d066ff6..ca9b27f7 100644 --- a/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/DisplaySelectedTokenOrNft.tsx +++ b/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/DisplaySelectedTokenOrNft.tsx @@ -7,7 +7,7 @@ interface Prop { const DisplaySelectedTokenOrNft = ({ data }: Prop) => { return ( -
+
{!data.isNft ? (
@@ -33,7 +33,7 @@ const DisplaySelectedTokenOrNft = ({ data }: Prop) => { {data.nftTokenIds.length} {data.nftName}{" "} {data.nftTokenIds.length > 1 ? "NFTs" : "NFT"}
-
+
{data.nftTokenIds.join(", ")}
diff --git a/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/ShowPreviewModal/FormYouFilled.tsx b/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/ShowPreviewModal/FormYouFilled.tsx index 4b1d00e0..b11fbc32 100644 --- a/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/ShowPreviewModal/FormYouFilled.tsx +++ b/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/ShowPreviewModal/FormYouFilled.tsx @@ -1,20 +1,8 @@ "use client"; -import styled from "styled-components"; import { ProviderDashboardFormDataProp } from "@/types"; -import { DV } from "@/components/ui/designVariables"; import { useTokenTapFromContext } from "@/context/providerDashboardTokenTapContext"; import Icon from "@/components/ui/Icon"; -import { ProviderDashboardButtonSubmit } from "@/app/contribution-hub/Buttons"; -import RaffleCardTimerSubmitContribution from "./RaffleCardTimerSubmitContribution"; - -const Action = styled.div` - display: flex; - - // @media only screen and (max-width: ${DV.breakpoints.smallDesktop}) { - flex-direction: column; - } -`; interface Prop { data: ProviderDashboardFormDataProp; @@ -50,18 +38,16 @@ const FormYouFilled = ({ data }: Prop) => { className="cursor-pointer" />
-

Decentralized verification system

+

Decentralized verification system

-
- {data.description} -
+
{data.description}
{requirementList.length > 0 ? requirementList.map((item, index) => { return (
{item.isNotSatisfy && "Not "} {item.title} @@ -82,7 +68,7 @@ const FormYouFilled = ({ data }: Prop) => { height="12px" />
-
+
Repeats Weekly
{ - const { handleCreateRaffle, createRaffleLoading, createRaffleResponse } = - useTokenTapFromContext(); + const { + handleCreateDistribution, + createRaffleLoading, + createRaffleResponse, + } = useTokenTapFromContext(); const { address, isConnected } = useWalletAccount(); const { chain } = useWalletNetwork(); @@ -51,7 +54,7 @@ const RenderInitialBody = ({ data }: Prop) => { ]); return (
-
+
This is how your card will appear. If you are sure of the accuracy of the form you filled out, please submit your contribution.
@@ -62,7 +65,7 @@ const RenderInitialBody = ({ data }: Prop) => { Switch Network @@ -87,9 +90,9 @@ const RenderInitialBody = ({ data }: Prop) => {
{createRaffleLoading ? ( diff --git a/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/ShowPreviewModal/RenderSocialMedia.tsx b/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/ShowPreviewModal/RenderSocialMedia.tsx index da24b836..0b23fb7e 100644 --- a/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/ShowPreviewModal/RenderSocialMedia.tsx +++ b/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/components/ShowPreviewModal/RenderSocialMedia.tsx @@ -10,7 +10,7 @@ interface Prop { const RenderSocialMedia = ({ data }: Prop) => { return ( -
+
{socialMedias.map( (item, index) => data[item as keyof ProviderDashboardFormDataProp] && ( diff --git a/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/index.tsx b/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/index.tsx index 9c6d2f20..6fc0a0ba 100644 --- a/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/index.tsx +++ b/app/contribution-hub/token-tap/components/OfferTokenForm/DepositToken/index.tsx @@ -4,7 +4,6 @@ import { ProviderFormPaginationProp } from "@/types"; import DepositContent from "./components/DepositContent"; import DisplaySelectedTokenOrNft from "./components/DisplaySelectedTokenOrNft"; import Pagination from "@/app/contribution-hub/pagination"; -import CreateRaffleModal from "@/app/contribution-hub/prize-tap/components/CreateRaffleModal"; import { useCallback, useEffect, useMemo } from "react"; import ShowPreviewModal from "./components/ShowPreviewModal"; import { useTokenTapFromContext } from "@/context/providerDashboardTokenTapContext"; @@ -29,7 +28,7 @@ const tokenDescription = { description: `Please proceed with depositing the Token for which you have completed the corresponding form. Please wait momentarily as we validate your request. In the event of rejection, the token will promptly returned to your designated wallet.`, - icon: "/assets/images/provider-dashboard/tokenSelected.svg", + icon: "/assets/images/provider-dashboard/deposit-token.png", }; const DepositToken = ({ @@ -41,11 +40,6 @@ const DepositToken = ({ data, page, createRaffleResponse, - isErc20Approved, - isApprovedAll, - handleApproveErc721Token, - handleApproveErc20Token, - approveLoading, isShowingDetails, } = useTokenTapFromContext(); @@ -87,12 +81,6 @@ const DepositToken = ({ setIsWalletPromptOpen, ]); - const approve = data.isNativeToken - ? true - : data.isNft - ? isApprovedAll - : isErc20Approved; - useEffect(() => { createRaffleResponse?.state === "Done" ? handleChangeFormPageNext() : null; }, [createRaffleResponse, handleChangeFormPageNext]); @@ -130,7 +118,7 @@ const DepositToken = ({ ) : address && !isRightChain && data.selectedChain ? ( Switch Network @@ -144,20 +132,6 @@ const DepositToken = ({ > Connect Wallet - ) : !approve && !isShowingDetails ? ( - -

{approveLoading ? "Approving Contract..." : "Approve Contract"}

-
) : ( )} - {data.selectedChain && !isShowingDetails && ( - - )}
); }; diff --git a/app/contribution-hub/token-tap/components/OfferTokenForm/NewAddedConstraint.tsx b/app/contribution-hub/token-tap/components/OfferTokenForm/NewAddedConstraint.tsx index c63ead0d..6c39f30c 100644 --- a/app/contribution-hub/token-tap/components/OfferTokenForm/NewAddedConstraint.tsx +++ b/app/contribution-hub/token-tap/components/OfferTokenForm/NewAddedConstraint.tsx @@ -47,7 +47,7 @@ const NewAddedConstraint = ({ requirement }: Props) => {
Edit
diff --git a/app/contribution-hub/token-tap/components/OfferTokenForm/TokenContactInformation.tsx b/app/contribution-hub/token-tap/components/OfferTokenForm/TokenContactInformation.tsx index 347bb6bf..debb04cf 100644 --- a/app/contribution-hub/token-tap/components/OfferTokenForm/TokenContactInformation.tsx +++ b/app/contribution-hub/token-tap/components/OfferTokenForm/TokenContactInformation.tsx @@ -77,13 +77,23 @@ const ContactInformation = ({ Your website, twitter & discord will be shown on PrizeTap card.

-
+
{contactFields.map((field, index) => (
- {index == 3 ?

Contact info

: ""} + {index == 3 ? ( +
+

Contact info

+
{" "} + + These info will not share with anybody. + +
+ ) : ( + "" + )}
{field.required && showErrors && !data[field.name] && ( -

+

Required

)} {showErrors && data[field.name] && !(socialMediaValidation as any)[field.name] && ( -

+

Invalid input

)} @@ -123,7 +133,7 @@ const ContactInformation = ({