Skip to content

Commit

Permalink
fix(props): props from plas to form (#1176)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbeckers authored Nov 9, 2023
1 parent fc0161d commit 55c1f57
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
16 changes: 8 additions & 8 deletions frontend/components/hypercert-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ const DEFAULT_FORM_DATA: HypercertCreateFormData = {
backgroundColor: "",
backgroundVectorArt: "",
metadataProperties: "",
transferRestrictions: TransferRestrictions.FromCreatorOnly,
applicationName: "hypercerts.org",
};

interface HypercertCreateFormData {
Expand Down Expand Up @@ -91,8 +89,6 @@ interface HypercertCreateFormData {
backgroundColor: string;
backgroundVectorArt: string;
metadataProperties: string;
transferRestrictions: TransferRestrictions;
applicationName: string;
}

/**
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -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 {
Expand Down Expand Up @@ -444,6 +443,7 @@ export function HypercertCreateForm(props: HypercertCreateFormProps) {
const formatValuesToMetaData = (
val: HypercertCreateFormData,
address: string,
applicationName: string,
image?: string,
) => {
// Split contributor names and addresses.
Expand Down Expand Up @@ -481,7 +481,7 @@ const formatValuesToMetaData = (
{
trait_type: "Minted by",
value: "true",
application: val.applicationName,
application: applicationName,
},
];
if (val.metadataProperties) {
Expand Down
5 changes: 2 additions & 3 deletions frontend/plasmic-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion graph/tests/.latest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "0.6.0",
"timestamp": 1699397492586
"timestamp": 1699545675983
}

0 comments on commit 55c1f57

Please sign in to comment.