File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed
apps/create-hypergraph-app/template-vite-react/src Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ import { HypergraphAppProvider } from '@graphprotocol/hypergraph-react' ;
2+ import { RouterProvider , createRouter } from '@tanstack/react-router' ;
3+ import ReactDOM from 'react-dom/client' ;
4+ import './index.css' ;
5+ import { mapping } from './mapping' ;
6+
7+ // Import the generated route tree
8+ import { routeTree } from './routeTree.gen' ;
9+
10+ // Create a new router instance
11+ const router = createRouter ( { routeTree } ) ;
12+
13+ // Register the router instance for type safety
14+ declare module '@tanstack/react-router' {
15+ interface Register {
16+ router : typeof router ;
17+ }
18+ }
19+
20+ // Render the app
21+ const rootElement = document . getElementById ( 'root' ) ;
22+ if ( rootElement && ! rootElement . innerHTML ) {
23+ const root = ReactDOM . createRoot ( rootElement ) ;
24+ root . render (
25+ // <React.StrictMode>
26+ < HypergraphAppProvider mapping = { mapping } >
27+ < RouterProvider router = { router } />
28+ </ HypergraphAppProvider > ,
29+ // </React.StrictMode>,
30+ ) ;
31+ }
Original file line number Diff line number Diff line change 1+ import { Id } from '@graphprotocol/grc-20' ;
2+ import type { Mapping } from '@graphprotocol/hypergraph' ;
3+
4+ export const mapping : Mapping = {
5+ Address : {
6+ typeIds : [ Id . Id ( '5c6e72fb-8340-47c0-8281-8be159ecd495' ) ] ,
7+ properties : {
8+ name : Id . Id ( 'a126ca53-0c8e-48d5-b888-82c734c38935' ) ,
9+ description : Id . Id ( '9b1f76ff-9711-404c-861e-59dc3fa7d037' ) ,
10+ } ,
11+ } ,
12+ Project : {
13+ typeIds : [ Id . Id ( '484a18c5-030a-499c-b0f2-ef588ff16d50' ) ] ,
14+ properties : {
15+ name : Id . Id ( 'a126ca53-0c8e-48d5-b888-82c734c38935' ) ,
16+ } ,
17+ } ,
18+ } ;
You can’t perform that action at this time.
0 commit comments