1- import { _useDeleteEntityPublic , useEntities , useHypergraphApp , useSpace } from '@graphprotocol/hypergraph-react' ;
2- import { useState } from 'react' ;
1+ import { useEntities , useSpace } from '@graphprotocol/hypergraph-react' ;
32import { Event } from '../schema' ;
4- import { Button } from './ui/button' ;
53
64export const Playground = ( { spaceId } : { spaceId : string } ) => {
75 const { data, isLoading, isError, invalidEntities } = useEntities ( Event , {
@@ -18,13 +16,9 @@ export const Playground = ({ spaceId }: { spaceId: string }) => {
1816 first : 100 ,
1917 space : spaceId ,
2018 } ) ;
21- const [ isDeleting , setIsDeleting ] = useState ( false ) ;
22- const { getSmartSessionClient } = useHypergraphApp ( ) ;
2319
2420 const { name } = useSpace ( { mode : 'public' , space : spaceId } ) ;
2521
26- const deleteEntity = _useDeleteEntityPublic ( Event , { space : spaceId } ) ;
27-
2822 console . log ( { isLoading, isError, data, invalidEntities } ) ;
2923
3024 return (
@@ -35,24 +29,6 @@ export const Playground = ({ spaceId }: { spaceId: string }) => {
3529 { data ?. map ( ( event ) => (
3630 < div key = { event . id } >
3731 < h2 > { event . name } </ h2 >
38- < Button
39- onClick = { async ( ) => {
40- setIsDeleting ( true ) ;
41- const walletClient = await getSmartSessionClient ( ) ;
42- if ( ! walletClient ) {
43- alert ( 'Wallet client not found' ) ;
44- return ;
45- }
46- await deleteEntity ( {
47- id : event . id ,
48- walletClient,
49- } ) ;
50- setIsDeleting ( false ) ;
51- } }
52- disabled = { isDeleting }
53- >
54- { isDeleting ? 'Deleting...' : 'Delete' }
55- </ Button >
5632 < pre className = "text-xs" > { JSON . stringify ( event , null , 2 ) } </ pre >
5733 </ div >
5834 ) ) }
0 commit comments