Complete createBadge related fields on Badge Hub dashboard > Execute

This commit is contained in:
Serkan Reis 2023-02-06 16:02:40 +03:00
parent 5a903f691e
commit cb30fbf13c

View File

@ -202,9 +202,9 @@ const BadgeHubExecutePage: NextPage = () => {
})) }))
.filter((attr) => attr.trait_type && attr.value) .filter((attr) => attr.trait_type && attr.value)
: undefined, : undefined,
background_color: backgroundColorState.value, background_color: backgroundColorState.value || undefined,
animation_url: animationUrlState.value, animation_url: animationUrlState.value || undefined,
youtube_url: youtubeUrlState.value, youtube_url: youtubeUrlState.value || undefined,
}, },
transferrable, transferrable,
rule: { rule: {
@ -214,11 +214,11 @@ const BadgeHubExecutePage: NextPage = () => {
max_supply: maxSupplyState.value, max_supply: maxSupplyState.value,
}, },
metadata: { metadata: {
name: nameState.value, name: nameState.value || undefined,
description: descriptionState.value, description: descriptionState.value || undefined,
image: imageState.value, image: imageState.value || undefined,
image_data: imageDataState.value, image_data: imageDataState.value || undefined,
external_url: externalUrlState.value, external_url: externalUrlState.value || undefined,
attributes: attributes:
attributesState.values[0]?.trait_type && attributesState.values[0]?.value attributesState.values[0]?.trait_type && attributesState.values[0]?.value
? attributesState.values ? attributesState.values
@ -228,9 +228,9 @@ const BadgeHubExecutePage: NextPage = () => {
})) }))
.filter((attr) => attr.trait_type && attr.value) .filter((attr) => attr.trait_type && attr.value)
: undefined, : undefined,
background_color: backgroundColorState.value, background_color: backgroundColorState.value || undefined,
animation_url: animationUrlState.value, animation_url: animationUrlState.value || undefined,
youtube_url: youtubeUrlState.value, youtube_url: youtubeUrlState.value || undefined,
}, },
id: idState.value, id: idState.value,
owner: ownerState.value, owner: ownerState.value,
@ -273,6 +273,12 @@ const BadgeHubExecutePage: NextPage = () => {
}, },
) )
const handleGenerateKey = () => {
//generate public and private key pair
keyState.onChange('test')
}
const router = useRouter() const router = useRouter()
useEffect(() => { useEffect(() => {
@ -307,25 +313,50 @@ const BadgeHubExecutePage: NextPage = () => {
<AddressInput {...contractState} /> <AddressInput {...contractState} />
<ExecuteCombobox {...comboboxState} /> <ExecuteCombobox {...comboboxState} />
{showBadgeField && <AddressInput {...managerState} />} {showBadgeField && <AddressInput {...managerState} />}
{showBadgeField && <TextInput {...keyState} />}
{showBadgeField && <Button onClick={handleGenerateKey}>Generate Key</Button>}
{showMetadataField && ( {showMetadataField && (
<div className="mt-2"> <div className="p-4 rounded-md border-2 border-gray-800">
<MetadataAttributes <TextInput className="mt-2" {...nameState} />
attributes={attributesState.entries} <TextInput className="mt-2" {...descriptionState} />
onAdd={attributesState.add} <TextInput className="mt-2" {...imageState} />
onChange={attributesState.update} <TextInput className="mt-2" {...imageDataState} />
onRemove={attributesState.remove} <TextInput className="mt-2" {...externalUrlState} />
title="Traits" <div className="mt-2">
/> <MetadataAttributes
attributes={attributesState.entries}
onAdd={attributesState.add}
onChange={attributesState.update}
onRemove={attributesState.remove}
title="Traits"
/>
</div>
<TextInput className="mt-2" {...backgroundColorState} />
<TextInput className="mt-2" {...animationUrlState} />
<TextInput className="mt-2" {...youtubeUrlState} />
</div> </div>
)} )}
{showBadgeField && <TextInput {...keyState} />}
{showBadgeField && <NumberInput {...maxSupplyState} />}
{/* TODO: Fix address execute message */}
<Conditional test={showBadgeField}> <Conditional test={showBadgeField}>
<FormControl htmlId="expiry-date" subtitle="Badge minting expiry date" title="Expiry Date"> <FormControl htmlId="expiry-date" subtitle="Badge minting expiry date" title="Expiry Date">
<InputDateTime minDate={new Date()} onChange={(date) => setTimestamp(date)} value={timestamp} /> <InputDateTime minDate={new Date()} onChange={(date) => setTimestamp(date)} value={timestamp} />
</FormControl> </FormControl>
</Conditional> </Conditional>
{showBadgeField && <NumberInput {...maxSupplyState} />}
{showBadgeField && (
<div className="form-control">
<label className="justify-start cursor-pointer label">
<span className="mr-4">Transferrable</span>
<input
checked={transferrable}
className={`toggle ${transferrable ? `bg-stargaze` : `bg-gray-600`}`}
onClick={() => setTransferrable(!transferrable)}
type="checkbox"
/>
</label>
</div>
)}
{/* TODO: Fix address execute message */}
</div> </div>
<div className="space-y-8"> <div className="space-y-8">
<div className="relative"> <div className="relative">