From 55c1f5748a75a1e608eb4c4850cf5c95c976234c Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Thu, 9 Nov 2023 17:08:26 +0100 Subject: [PATCH] fix(props): props from plas to form (#1176) --- frontend/components/hypercert-create.tsx | 16 ++++++++-------- frontend/plasmic-init.ts | 5 ++--- graph/tests/.latest.json | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/frontend/components/hypercert-create.tsx b/frontend/components/hypercert-create.tsx index 1db8a43d..98b37b6a 100644 --- a/frontend/components/hypercert-create.tsx +++ b/frontend/components/hypercert-create.tsx @@ -62,8 +62,6 @@ const DEFAULT_FORM_DATA: HypercertCreateFormData = { backgroundColor: "", backgroundVectorArt: "", metadataProperties: "", - transferRestrictions: TransferRestrictions.FromCreatorOnly, - applicationName: "hypercerts.org", }; interface HypercertCreateFormData { @@ -91,8 +89,6 @@ interface HypercertCreateFormData { backgroundColor: string; backgroundVectorArt: string; metadataProperties: string; - transferRestrictions: TransferRestrictions; - applicationName: string; } /** @@ -294,10 +290,12 @@ const ValidationSchema = Yup.object().shape({ export interface HypercertCreateFormProps { className?: string; // Plasmic CSS class children?: ReactNode; // Form elements + transferRestrictions: TransferRestrictions; + applicationName: string; } export function HypercertCreateForm(props: HypercertCreateFormProps) { - const { className, children } = props; + const { className, children, transferRestrictions, applicationName } = props; const { address } = useAccountLowerCase(); const { push } = useRouter(); const { hideModal } = useContractModal(); @@ -378,6 +376,7 @@ export function HypercertCreateForm(props: HypercertCreateFormProps) { values, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion address!, + applicationName, image, ); console.log(`Metadata(valid=${metaData.valid}): `, metaData.data); @@ -389,13 +388,13 @@ export function HypercertCreateForm(props: HypercertCreateFormProps) { allowlistUrl: values.allowlistUrl, allowlistPercentage: values.allowlistPercentage, deduplicate: values.deduplicateAllowlist, - transferRestrictions: values.transferRestrictions, + transferRestrictions, }); } else { await mintClaim( metaData.data, DEFAULT_NUM_FRACTIONS, - values.transferRestrictions, + transferRestrictions, ); } } else { @@ -444,6 +443,7 @@ export function HypercertCreateForm(props: HypercertCreateFormProps) { const formatValuesToMetaData = ( val: HypercertCreateFormData, address: string, + applicationName: string, image?: string, ) => { // Split contributor names and addresses. @@ -481,7 +481,7 @@ const formatValuesToMetaData = ( { trait_type: "Minted by", value: "true", - application: val.applicationName, + application: applicationName, }, ]; if (val.metadataProperties) { diff --git a/frontend/plasmic-init.ts b/frontend/plasmic-init.ts index 07f0ceb2..b9ffaeb1 100644 --- a/frontend/plasmic-init.ts +++ b/frontend/plasmic-init.ts @@ -239,9 +239,8 @@ PLASMIC.registerComponent(HypercertCreateForm, { }, }, transferRestrictions: { - type: "choice", - options: ["AllowAll", "DisallowAll", "FromCreatorOnly"], - defaultValueHint: "FromCreatorOnly", + type: "number", + description: "0: AllowAll, 1: DisallowAll, 2: FromCreatorOnly", }, applicationName: { type: "string", diff --git a/graph/tests/.latest.json b/graph/tests/.latest.json index 67836539..39dc3ab6 100644 --- a/graph/tests/.latest.json +++ b/graph/tests/.latest.json @@ -1,4 +1,4 @@ { "version": "0.6.0", - "timestamp": 1699397492586 + "timestamp": 1699545675983 }