Skip to content

Commit

Permalink
feat(metadata): add application name (#1174)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbeckers authored Nov 9, 2023
1 parent a827b5e commit 34436b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions frontend/components/hypercert-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const DEFAULT_FORM_DATA: HypercertCreateFormData = {
backgroundVectorArt: "",
metadataProperties: "",
transferRestrictions: TransferRestrictions.FromCreatorOnly,
applicationName: "hypercerts.org",
};

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

/**
Expand Down Expand Up @@ -475,10 +477,16 @@ const formatValuesToMetaData = (
? new Date(val.workTimeEnd).getTime() / 1000
: 0;

let properties = [];
let properties = [
{
trait_type: "Minted by",
value: "true",
application: val.applicationName,
},
];
if (val.metadataProperties) {
try {
properties = JSON.parse(val.metadataProperties);
properties = [...properties, ...JSON.parse(val.metadataProperties)];
} catch (e) {
console.warn(
`Unable to parse metadataProperties: ${val.metadataProperties}`,
Expand Down
4 changes: 4 additions & 0 deletions frontend/plasmic-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ PLASMIC.registerComponent(HypercertCreateForm, {
options: ["AllowAll", "DisallowAll", "FromCreatorOnly"],
defaultValueHint: "FromCreatorOnly",
},
applicationName: {
type: "string",
defaultValueHint: "hypercerts.org/create",
},
},
providesData: true,
importPath: "./components/hypercert-create",
Expand Down

0 comments on commit 34436b9

Please sign in to comment.