Skip to content

Commit 179c6ca

Browse files
committed
fetch data
1 parent b3bc6fc commit 179c6ca

File tree

5 files changed

+70
-12
lines changed

5 files changed

+70
-12
lines changed

apps/create-hypergraph/template-vite-react/src/mapping.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,22 @@ export const mapping: Mapping.Mapping = {
2626
avatar: Id('1155beff-fad5-49b7-a2e0-da4777b8792c'),
2727
},
2828
},
29+
Dapp: {
30+
typeIds: [Id('8ca136d0-698a-4bbf-a76b-8e2741b2dc8c')],
31+
properties: {
32+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
33+
},
34+
},
35+
InvestmentRound: {
36+
typeIds: [Id('8f03f4c9-59e4-44a8-a625-c0a40b1ff330')],
37+
properties: {
38+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
39+
},
40+
},
41+
Asset: {
42+
typeIds: [Id('f8780a80-c238-4a2a-96cb-567d88b1aa63')],
43+
properties: {
44+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
45+
},
46+
},
2947
};

apps/create-hypergraph/template-vite-react/src/routes/explore-public-knowledge/asset-market.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1+
import { Asset } from '@/schema';
2+
import { useQuery } from '@graphprotocol/hypergraph-react';
13
import { createFileRoute } from '@tanstack/react-router';
24

5+
export const Route = createFileRoute('/explore-public-knowledge/asset-market')({
6+
component: AssetMarket,
7+
});
8+
39
function AssetMarket() {
10+
const { data: assets, isPending } = useQuery(Asset, {
11+
mode: 'public',
12+
space: 'b2565802-3118-47be-91f2-e59170735bac',
13+
first: 40,
14+
});
15+
16+
console.log(assets, isPending);
417
return (
518
<div className="container mx-auto px-0 py-0">
619
<h1 className="text-3xl font-bold mb-2">Asset Market</h1>
720
<p className="text-muted-foreground">Coming soon.</p>
821
</div>
922
);
1023
}
11-
12-
export const Route = createFileRoute('/explore-public-knowledge/asset-market')({
13-
component: AssetMarket,
14-
});

apps/create-hypergraph/template-vite-react/src/routes/explore-public-knowledge/dapps.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1+
import { Dapp } from '@/schema';
2+
import { useQuery } from '@graphprotocol/hypergraph-react';
13
import { createFileRoute } from '@tanstack/react-router';
24

5+
export const Route = createFileRoute('/explore-public-knowledge/dapps')({
6+
component: Dapps,
7+
});
8+
39
function Dapps() {
10+
const { data: dapps, isPending } = useQuery(Dapp, {
11+
mode: 'public',
12+
space: 'b2565802-3118-47be-91f2-e59170735bac',
13+
first: 40,
14+
});
15+
16+
console.log(dapps, isPending);
17+
418
return (
519
<div className="container mx-auto px-0 py-0">
620
<h1 className="text-3xl font-bold mb-2">dApps</h1>
721
<p className="text-muted-foreground">Coming soon.</p>
822
</div>
923
);
1024
}
11-
12-
export const Route = createFileRoute('/explore-public-knowledge/dapps')({
13-
component: Dapps,
14-
});

apps/create-hypergraph/template-vite-react/src/routes/explore-public-knowledge/investment-rounts.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1+
import { InvestmentRound } from '@/schema';
2+
import { useQuery } from '@graphprotocol/hypergraph-react';
13
import { createFileRoute } from '@tanstack/react-router';
24

5+
export const Route = createFileRoute('/explore-public-knowledge/investment-rounts')({
6+
component: InvestmentRounts,
7+
});
8+
39
function InvestmentRounts() {
10+
const { data: investmentRounds, isPending } = useQuery(InvestmentRound, {
11+
mode: 'public',
12+
space: 'b2565802-3118-47be-91f2-e59170735bac',
13+
first: 40,
14+
});
15+
16+
console.log(investmentRounds, isPending);
417
return (
518
<div className="container mx-auto px-0 py-0">
619
<h1 className="text-3xl font-bold mb-2">Investment Rounts</h1>
720
<p className="text-muted-foreground">Coming soon.</p>
821
</div>
922
);
1023
}
11-
12-
export const Route = createFileRoute('/explore-public-knowledge/investment-rounts')({
13-
component: InvestmentRounts,
14-
});

apps/create-hypergraph/template-vite-react/src/schema.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,15 @@ export class Project extends Entity.Class<Project>('Project')({
1515
xUrl: Type.optional(Type.String),
1616
avatar: Type.Relation(Image),
1717
}) {}
18+
19+
export class Dapp extends Entity.Class<Dapp>('Dapp')({
20+
name: Type.String,
21+
}) {}
22+
23+
export class InvestmentRound extends Entity.Class<InvestmentRound>('InvestmentRound')({
24+
name: Type.String,
25+
}) {}
26+
27+
export class Asset extends Entity.Class<Asset>('Asset')({
28+
name: Type.String,
29+
}) {}

0 commit comments

Comments
 (0)