diff --git a/components/collections/creation/CollectionDetails.tsx b/components/collections/creation/CollectionDetails.tsx index 6e039e8..13a137f 100644 --- a/components/collections/creation/CollectionDetails.tsx +++ b/components/collections/creation/CollectionDetails.tsx @@ -192,11 +192,13 @@ export const CollectionDetails = ({ : new Date(Date.now() + new Date().getTimezoneOffset() * 60 * 1000) } onChange={(date) => - setTimestamp( - timezone === 'Local' - ? date - : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), - ) + date + ? setTimestamp( + timezone === 'Local' + ? date + : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), + ) + : setTimestamp(undefined) } value={ timezone === 'Local' diff --git a/components/collections/creation/MintingDetails.tsx b/components/collections/creation/MintingDetails.tsx index ed44002..e03752f 100644 --- a/components/collections/creation/MintingDetails.tsx +++ b/components/collections/creation/MintingDetails.tsx @@ -1,4 +1,5 @@ /* eslint-disable eslint-comments/disable-enable-pair */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable no-nested-ternary */ import { FormControl } from 'components/FormControl' import { FormGroup } from 'components/FormGroup' @@ -22,6 +23,8 @@ interface MintingDetailsProps { minimumMintPrice: number mintingTokenFromFactory?: TokenInfo importedMintingDetails?: MintingDetailsDataProps + isPresale: boolean + whitelistStartDate?: string } export interface MintingDetailsDataProps { @@ -40,6 +43,8 @@ export const MintingDetails = ({ minimumMintPrice, mintingTokenFromFactory, importedMintingDetails, + isPresale, + whitelistStartDate, }: MintingDetailsProps) => { const wallet = useWallet() const { timezone } = useGlobalSettings() @@ -129,6 +134,12 @@ export const MintingDetails = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [importedMintingDetails]) + useEffect(() => { + if (isPresale) { + setTimestamp(whitelistStartDate ? new Date(Number(whitelistStartDate) / 1_000_000) : undefined) + } + }, [whitelistStartDate, isPresale]) + return (
@@ -162,17 +173,22 @@ export const MintingDetails = ({ - setTimestamp( - timezone === 'Local' ? date : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), - ) + date + ? setTimestamp( + timezone === 'Local' ? date : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), + ) + : setTimestamp(undefined) } value={ timezone === 'Local' diff --git a/components/collections/creation/WhitelistDetails.tsx b/components/collections/creation/WhitelistDetails.tsx index b32fcad..2bd08a6 100644 --- a/components/collections/creation/WhitelistDetails.tsx +++ b/components/collections/creation/WhitelistDetails.tsx @@ -1,4 +1,5 @@ /* eslint-disable eslint-comments/disable-enable-pair */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable no-nested-ternary */ import { FormControl } from 'components/FormControl' import { FormGroup } from 'components/FormGroup' @@ -331,16 +332,20 @@ export const WhitelistDetails = ({ htmlId="start-date" isRequired subtitle="Start time for minting tokens to whitelisted addresses" - title={`Start Time ${timezone === 'Local' ? '(local)' : '(UTC)'}`} + title={`Whitelist Start Time ${timezone === 'Local' ? '(local)' : '(UTC)'}`} > - setStartDate( - timezone === 'Local' ? date : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), - ) + date + ? setStartDate( + timezone === 'Local' + ? date + : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), + ) + : setStartDate(undefined) } value={ timezone === 'Local' @@ -354,17 +359,21 @@ export const WhitelistDetails = ({ - setEndDate( - timezone === 'Local' ? date : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), - ) + date + ? setEndDate( + timezone === 'Local' + ? date + : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), + ) + : setEndDate(undefined) } value={ timezone === 'Local' diff --git a/components/openEdition/CollectionDetails.tsx b/components/openEdition/CollectionDetails.tsx index 1ed1014..994cb75 100644 --- a/components/openEdition/CollectionDetails.tsx +++ b/components/openEdition/CollectionDetails.tsx @@ -236,9 +236,13 @@ export const CollectionDetails = ({ timezone === 'Local' ? new Date() : new Date(Date.now() + new Date().getTimezoneOffset() * 60 * 1000) } onChange={(date) => - setTimestamp( - timezone === 'Local' ? date : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), - ) + date + ? setTimestamp( + timezone === 'Local' + ? date + : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), + ) + : setTimestamp(undefined) } value={ timezone === 'Local' diff --git a/components/openEdition/MintingDetails.tsx b/components/openEdition/MintingDetails.tsx index 9d18a89..a707321 100644 --- a/components/openEdition/MintingDetails.tsx +++ b/components/openEdition/MintingDetails.tsx @@ -1,4 +1,5 @@ /* eslint-disable eslint-comments/disable-enable-pair */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable no-nested-ternary */ import { FormControl } from 'components/FormControl' import { FormGroup } from 'components/FormGroup' @@ -155,9 +156,11 @@ export const MintingDetails = ({ timezone === 'Local' ? new Date() : new Date(Date.now() + new Date().getTimezoneOffset() * 60 * 1000) } onChange={(date) => - setTimestamp( - timezone === 'Local' ? date : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), - ) + date + ? setTimestamp( + timezone === 'Local' ? date : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), + ) + : setTimestamp(undefined) } value={ timezone === 'Local' @@ -179,9 +182,11 @@ export const MintingDetails = ({ timezone === 'Local' ? new Date() : new Date(Date.now() + new Date().getTimezoneOffset() * 60 * 1000) } onChange={(date) => - setEndTimestamp( - timezone === 'Local' ? date : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), - ) + date + ? setEndTimestamp( + timezone === 'Local' ? date : new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000), + ) + : setEndTimestamp(undefined) } value={ timezone === 'Local' diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index 7086f93..1562372 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -1908,6 +1908,7 @@ const CollectionCreationPage: NextPage = () => { { numberOfTokens={uploadDetails?.assetFiles.length} onChange={setMintingDetails} uploadMethod={uploadDetails?.uploadMethod as UploadMethod} + whitelistStartDate={whitelistDetails?.startTime} />