From 8a02a7f80daf877ae45f0b816fbc22d82439a5cf Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Mon, 15 Apr 2024 13:48:44 +0300 Subject: [PATCH] Enable setting both time & token count limit for OE collections --- components/openEdition/MintingDetails.tsx | 30 +++++++++++++------ .../openEdition/OpenEditionMinterCreator.tsx | 11 +++++-- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/components/openEdition/MintingDetails.tsx b/components/openEdition/MintingDetails.tsx index c18bcb1..622489a 100644 --- a/components/openEdition/MintingDetails.tsx +++ b/components/openEdition/MintingDetails.tsx @@ -17,7 +17,7 @@ import { useWallet } from 'utils/wallet' import { NumberInput, TextInput } from '../forms/FormInput' import type { UploadMethod } from './OffChainMetadataUploadDetails' -export type LimitType = 'count_limited' | 'time_limited' +export type LimitType = 'count_limited' | 'time_limited' | 'time_and_count_limited' interface MintingDetailsProps { onChange: (data: MintingDetailsDataProps) => void @@ -113,11 +113,19 @@ export const MintingDetails = ({ : '', perAddressLimit: perAddressLimitState.value, startTime: timestamp ? (timestamp.getTime() * 1_000_000).toString() : '', - endTime: endTimestamp ? (endTimestamp.getTime() * 1_000_000).toString() : '', + endTime: + limitType === 'time_limited' || limitType === 'time_and_count_limited' + ? endTimestamp + ? (endTimestamp.getTime() * 1_000_000).toString() + : '' + : undefined, paymentAddress: paymentAddressState.value.trim(), selectedMintToken, limitType, - tokenCountLimit: limitType === 'count_limited' ? tokenCountLimitState.value : undefined, + tokenCountLimit: + limitType === 'count_limited' || limitType === 'time_and_count_limited' + ? tokenCountLimitState.value + : undefined, } onChange(data) // eslint-disable-next-line react-hooks/exhaustive-deps @@ -208,10 +216,12 @@ export const MintingDetails = ({