From 092a0f3f336efcf0f488295ff089a936e087952c Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Thu, 15 Jun 2023 17:53:56 +0300 Subject: [PATCH] Auto-handle animation url for on-chain metadata uploads --- components/openEdition/ImageUploadDetails.tsx | 2 +- .../openEdition/OnChainMetadataInputDetails.tsx | 7 +++++-- components/openEdition/OpenEditionMinterCreator.tsx | 13 +++++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/components/openEdition/ImageUploadDetails.tsx b/components/openEdition/ImageUploadDetails.tsx index 1b37a97..e48e3be 100644 --- a/components/openEdition/ImageUploadDetails.tsx +++ b/components/openEdition/ImageUploadDetails.tsx @@ -319,7 +319,7 @@ export const ImageUploadDetails = ({ onChange }: ImageUploadDetailsProps) => { )} > { +export const OnChainMetadataInputDetails = ({ onChange, uploadMethod }: OnChainMetadataInputDetailsProps) => { const wallet = useWallet() const [timestamp, setTimestamp] = useState(undefined) const [metadataFile, setMetadataFile] = useState() @@ -203,7 +204,9 @@ export const OnChainMetadataInputDetails = ({ onChange }: OnChainMetadataInputDe - + + +
diff --git a/components/openEdition/OpenEditionMinterCreator.tsx b/components/openEdition/OpenEditionMinterCreator.tsx index 2160ae5..ae6ea56 100644 --- a/components/openEdition/OpenEditionMinterCreator.tsx +++ b/components/openEdition/OpenEditionMinterCreator.tsx @@ -1,4 +1,5 @@ /* eslint-disable eslint-comments/disable-enable-pair */ +/* eslint-disable no-nested-ternary */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ @@ -320,7 +321,12 @@ export const OpenEditionMinterCreator = ({ description: onChainMetadataInputDetails?.description, attributes: onChainMetadataInputDetails?.attributes, external_url: onChainMetadataInputDetails?.external_url, - animation_url: onChainMetadataInputDetails?.animation_url, + animation_url: + imageUploadDetails?.uploadMethod === 'existing' + ? onChainMetadataInputDetails?.animation_url + : getAssetType(imageUploadDetails?.assetFile?.name as string) === 'video' + ? uri + : undefined, youtube_url: onChainMetadataInputDetails?.youtube_url, } : null, @@ -443,7 +449,10 @@ export const OpenEditionMinterCreator = ({
- +