-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathplayground.tsx
More file actions
36 lines (32 loc) · 959 Bytes
/
playground.tsx
File metadata and controls
36 lines (32 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { useEntities, useSpace } from '@graphprotocol/hypergraph-react';
import { Event } from '../schema';
export const Playground = ({ spaceId }: { spaceId: string }) => {
const { data, isLoading, isError } = useEntities(Event, {
mode: 'public',
include: {
sponsors: {
jobOffers: {},
},
},
// filter: {
// or: [{ name: { startsWith: 'test' } }, { name: { startsWith: 'ETH' } }],
// },
first: 100,
space: spaceId,
});
const { name } = useSpace({ mode: 'public', space: spaceId });
console.log({ isLoading, isError, data });
return (
<div>
<h2 className="text-lg font-bold">Space: {name}</h2>
{isLoading && <div>Loading...</div>}
{isError && <div>Error</div>}
{data?.map((event) => (
<div key={event.id}>
<h2>{event.name}</h2>
<pre className="text-xs">{JSON.stringify(event, null, 2)}</pre>
</div>
))}
</div>
);
};