Skip to content

Commit

Permalink
feat(sandbox): allow setting GM package manually
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidsowardx committed Sep 5, 2023
1 parent e6249cc commit 5d61043
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const DeployGumballMachineCard = () => {
loading: boolean
account?: string
nftAddress?: string
nftCollectionAddress?: string
}>({ loading: false })

const exec = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import * as React from 'react'
import { Card } from '../../components/Card'
import { setGumballMachineState, useGumballMachineState } from '../state'
import { Button, FormControl, FormLabel, Input } from '@mui/joy'

export const SetGumballMachinePackageCard = () => {
const [address, setAddress] = React.useState('')
const { gumballMachinePackageAddress } = useGumballMachineState()
return gumballMachinePackageAddress ? null : (
<Card title="Set Gumball Machine Package">
<FormControl>
<FormLabel>Gumball Machine Package Address</FormLabel>
<Input
size="sm"
placeholder="e.g. package_tdx_e_1pkdkzp9qs7pe9nd....."
onChange={(e) => {
setAddress(e.target.value)
}}
/>
</FormControl>
<Button
sx={{ mt: 1 }}
disabled={!address}
onClick={() => {
setGumballMachineState({
gumballMachinePackageAddress: address,
components: {},
})
}}
>
Set Package Address
</Button>
</Card>
)
}
7 changes: 6 additions & 1 deletion examples/integration-tests/IntegrationTestsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DeployGumballMachineCard } from './GumballMachine/DeployGumballMachineC
import { GumballMachineExamples } from './GumballMachine/GumballMachineExamples'
import { useGumballMachineState } from './state'
import { GumballMachineCard } from './GumballMachine/GumballMachineCard'
import { SetGumballMachinePackageCard } from './GumballMachine/SetGumballMachinePackageCard'

export const IntegrationTestsPage = () => {
const { components } = useGumballMachineState()
Expand All @@ -23,9 +24,13 @@ export const IntegrationTestsPage = () => {
gap: 2,
}}
>
<SetGumballMachinePackageCard />
<DeployGumballMachineCard />
{Object.values(components).map((component) => (
<GumballMachineCard key={component.address} {...component}></GumballMachineCard>
<GumballMachineCard
key={component.address}
{...component}
></GumballMachineCard>
))}
{GumballMachineExamples()}
</Box>
Expand Down

0 comments on commit 5d61043

Please sign in to comment.