1
- import {
2
- _useCreateEntityPublic ,
3
- _useDeleteEntityPublic ,
4
- useHypergraphApp ,
5
- useQuery ,
6
- useSpace ,
7
- } from '@graphprotocol/hypergraph-react' ;
1
+ import { _useDeleteEntityPublic , useHypergraphApp , useQuery , useSpace } from '@graphprotocol/hypergraph-react' ;
8
2
import { useState } from 'react' ;
9
3
import { Event } from '../schema' ;
10
4
import { Button } from './ui/button' ;
@@ -24,13 +18,11 @@ export const Playground = ({ spaceId }: { spaceId: string }) => {
24
18
space : spaceId ,
25
19
} ) ;
26
20
const [ isDeleting , setIsDeleting ] = useState ( false ) ;
27
- const [ isCreating , setIsCreating ] = useState ( false ) ;
28
21
const { getSmartSessionClient } = useHypergraphApp ( ) ;
29
22
30
23
const { name } = useSpace ( { mode : 'public' , space : spaceId } ) ;
31
24
32
25
const deleteEntity = _useDeleteEntityPublic ( Event , { space : spaceId } ) ;
33
- const createEntity = _useCreateEntityPublic ( Event , { space : spaceId } ) ;
34
26
35
27
console . log ( { isLoading, isError, data } ) ;
36
28
@@ -39,29 +31,6 @@ export const Playground = ({ spaceId }: { spaceId: string }) => {
39
31
< h2 className = "text-lg font-bold" > Space: { name } </ h2 >
40
32
{ isLoading && < div > Loading...</ div > }
41
33
{ isError && < div > Error</ div > }
42
- < Button
43
- disabled = { isCreating }
44
- onClick = { async ( ) => {
45
- setIsCreating ( true ) ;
46
- const walletClient = await getSmartSessionClient ( ) ;
47
- if ( ! walletClient ) {
48
- alert ( 'Wallet client not found' ) ;
49
- setIsCreating ( false ) ;
50
- return ;
51
- }
52
- const { success, cid, txResult } = await createEntity (
53
- {
54
- name : 'Test Event 42 by Nik' ,
55
- sponsors : [ ] ,
56
- } ,
57
- { walletClient } ,
58
- ) ;
59
- console . log ( 'created' , { success, cid, txResult } ) ;
60
- setIsCreating ( false ) ;
61
- } }
62
- >
63
- Create
64
- </ Button >
65
34
{ data ?. map ( ( event ) => (
66
35
< div key = { event . id } >
67
36
< h2 > { event . name } </ h2 >
0 commit comments