Skip to content

Commit b3bc6fc

Browse files
committed
prepare routes
1 parent 7e20c0b commit b3bc6fc

File tree

10 files changed

+371
-134
lines changed

10 files changed

+371
-134
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { Link, useRouter } from '@tanstack/react-router';
2+
import { clsx } from 'clsx';
3+
4+
type Tab = {
5+
label: string;
6+
to: string;
7+
};
8+
9+
const tabs: Tab[] = [
10+
{ label: 'Projects', to: '/explore-public-knowledge/projects' },
11+
{ label: 'dApps', to: '/explore-public-knowledge/dapps' },
12+
{ label: 'Investment Rounts', to: '/explore-public-knowledge/investment-rounts' },
13+
{ label: 'Asset Market', to: '/explore-public-knowledge/asset-market' },
14+
];
15+
16+
export function ExploreTabs() {
17+
const router = useRouter();
18+
const pathname = router.state.location.pathname ?? '';
19+
20+
return (
21+
<div className="w-full flex justify-center">
22+
<div className="inline-flex rounded-lg border bg-background p-1">
23+
{tabs.map((tab) => {
24+
const isActive = pathname.startsWith(tab.to);
25+
return (
26+
<Link
27+
key={tab.to}
28+
to={tab.to}
29+
className={clsx(
30+
'px-4 py-2 text-sm rounded-md transition-colors',
31+
isActive
32+
? 'bg-primary text-primary-foreground'
33+
: 'text-foreground hover:bg-accent hover:text-accent-foreground',
34+
)}
35+
>
36+
{tab.label}
37+
</Link>
38+
);
39+
})}
40+
</div>
41+
</div>
42+
);
43+
}

apps/create-hypergraph/template-vite-react/src/components/navbar.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { Button } from '@/components/ui/button';
22
import {
3-
NavigationMenu,
4-
NavigationMenuContent,
5-
NavigationMenuItem,
6-
NavigationMenuLink,
7-
NavigationMenuList,
8-
NavigationMenuTrigger,
3+
NavigationMenu,
4+
NavigationMenuContent,
5+
NavigationMenuItem,
6+
NavigationMenuLink,
7+
NavigationMenuList,
8+
NavigationMenuTrigger,
99
} from '@/components/ui/navigation-menu';
1010
import { TooltipProvider } from '@/components/ui/tooltip';
1111
import { useHypergraphApp, useHypergraphAuth } from '@graphprotocol/hypergraph-react';
@@ -51,7 +51,7 @@ export function Navbar() {
5151
</NavigationMenuItem>
5252

5353
<NavigationMenuItem>
54-
<Link to="/explore-public-knowledge">
54+
<Link to="/explore-public-knowledge/projects">
5555
<NavigationMenuLink className="group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1">
5656
Explore Public Knowledge
5757
</NavigationMenuLink>

apps/create-hypergraph/template-vite-react/src/routeTree.gen.ts

Lines changed: 128 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ import { Route as LoginRouteImport } from './routes/login'
1313
import { Route as ExplorePublicKnowledgeRouteImport } from './routes/explore-public-knowledge'
1414
import { Route as AuthenticateSuccessRouteImport } from './routes/authenticate-success'
1515
import { Route as IndexRouteImport } from './routes/index'
16+
import { Route as ExplorePublicKnowledgeIndexRouteImport } from './routes/explore-public-knowledge/index'
1617
import { Route as PublicSpaceSpaceIdRouteImport } from './routes/public-space/$space-id'
1718
import { Route as PrivateSpaceSpaceIdRouteImport } from './routes/private-space/$space-id'
19+
import { Route as ExplorePublicKnowledgeProjectsRouteImport } from './routes/explore-public-knowledge/projects'
20+
import { Route as ExplorePublicKnowledgeInvestmentRountsRouteImport } from './routes/explore-public-knowledge/investment-rounts'
21+
import { Route as ExplorePublicKnowledgeDappsRouteImport } from './routes/explore-public-knowledge/dapps'
22+
import { Route as ExplorePublicKnowledgeAssetMarketRouteImport } from './routes/explore-public-knowledge/asset-market'
1823

1924
const LoginRoute = LoginRouteImport.update({
2025
id: '/login',
@@ -36,6 +41,12 @@ const IndexRoute = IndexRouteImport.update({
3641
path: '/',
3742
getParentRoute: () => rootRouteImport,
3843
} as any)
44+
const ExplorePublicKnowledgeIndexRoute =
45+
ExplorePublicKnowledgeIndexRouteImport.update({
46+
id: '/',
47+
path: '/',
48+
getParentRoute: () => ExplorePublicKnowledgeRoute,
49+
} as any)
3950
const PublicSpaceSpaceIdRoute = PublicSpaceSpaceIdRouteImport.update({
4051
id: '/public-space/$space-id',
4152
path: '/public-space/$space-id',
@@ -46,31 +57,69 @@ const PrivateSpaceSpaceIdRoute = PrivateSpaceSpaceIdRouteImport.update({
4657
path: '/private-space/$space-id',
4758
getParentRoute: () => rootRouteImport,
4859
} as any)
60+
const ExplorePublicKnowledgeProjectsRoute =
61+
ExplorePublicKnowledgeProjectsRouteImport.update({
62+
id: '/projects',
63+
path: '/projects',
64+
getParentRoute: () => ExplorePublicKnowledgeRoute,
65+
} as any)
66+
const ExplorePublicKnowledgeInvestmentRountsRoute =
67+
ExplorePublicKnowledgeInvestmentRountsRouteImport.update({
68+
id: '/investment-rounts',
69+
path: '/investment-rounts',
70+
getParentRoute: () => ExplorePublicKnowledgeRoute,
71+
} as any)
72+
const ExplorePublicKnowledgeDappsRoute =
73+
ExplorePublicKnowledgeDappsRouteImport.update({
74+
id: '/dapps',
75+
path: '/dapps',
76+
getParentRoute: () => ExplorePublicKnowledgeRoute,
77+
} as any)
78+
const ExplorePublicKnowledgeAssetMarketRoute =
79+
ExplorePublicKnowledgeAssetMarketRouteImport.update({
80+
id: '/asset-market',
81+
path: '/asset-market',
82+
getParentRoute: () => ExplorePublicKnowledgeRoute,
83+
} as any)
4984

5085
export interface FileRoutesByFullPath {
5186
'/': typeof IndexRoute
5287
'/authenticate-success': typeof AuthenticateSuccessRoute
53-
'/explore-public-knowledge': typeof ExplorePublicKnowledgeRoute
88+
'/explore-public-knowledge': typeof ExplorePublicKnowledgeRouteWithChildren
5489
'/login': typeof LoginRoute
90+
'/explore-public-knowledge/asset-market': typeof ExplorePublicKnowledgeAssetMarketRoute
91+
'/explore-public-knowledge/dapps': typeof ExplorePublicKnowledgeDappsRoute
92+
'/explore-public-knowledge/investment-rounts': typeof ExplorePublicKnowledgeInvestmentRountsRoute
93+
'/explore-public-knowledge/projects': typeof ExplorePublicKnowledgeProjectsRoute
5594
'/private-space/$space-id': typeof PrivateSpaceSpaceIdRoute
5695
'/public-space/$space-id': typeof PublicSpaceSpaceIdRoute
96+
'/explore-public-knowledge/': typeof ExplorePublicKnowledgeIndexRoute
5797
}
5898
export interface FileRoutesByTo {
5999
'/': typeof IndexRoute
60100
'/authenticate-success': typeof AuthenticateSuccessRoute
61-
'/explore-public-knowledge': typeof ExplorePublicKnowledgeRoute
62101
'/login': typeof LoginRoute
102+
'/explore-public-knowledge/asset-market': typeof ExplorePublicKnowledgeAssetMarketRoute
103+
'/explore-public-knowledge/dapps': typeof ExplorePublicKnowledgeDappsRoute
104+
'/explore-public-knowledge/investment-rounts': typeof ExplorePublicKnowledgeInvestmentRountsRoute
105+
'/explore-public-knowledge/projects': typeof ExplorePublicKnowledgeProjectsRoute
63106
'/private-space/$space-id': typeof PrivateSpaceSpaceIdRoute
64107
'/public-space/$space-id': typeof PublicSpaceSpaceIdRoute
108+
'/explore-public-knowledge': typeof ExplorePublicKnowledgeIndexRoute
65109
}
66110
export interface FileRoutesById {
67111
__root__: typeof rootRouteImport
68112
'/': typeof IndexRoute
69113
'/authenticate-success': typeof AuthenticateSuccessRoute
70-
'/explore-public-knowledge': typeof ExplorePublicKnowledgeRoute
114+
'/explore-public-knowledge': typeof ExplorePublicKnowledgeRouteWithChildren
71115
'/login': typeof LoginRoute
116+
'/explore-public-knowledge/asset-market': typeof ExplorePublicKnowledgeAssetMarketRoute
117+
'/explore-public-knowledge/dapps': typeof ExplorePublicKnowledgeDappsRoute
118+
'/explore-public-knowledge/investment-rounts': typeof ExplorePublicKnowledgeInvestmentRountsRoute
119+
'/explore-public-knowledge/projects': typeof ExplorePublicKnowledgeProjectsRoute
72120
'/private-space/$space-id': typeof PrivateSpaceSpaceIdRoute
73121
'/public-space/$space-id': typeof PublicSpaceSpaceIdRoute
122+
'/explore-public-knowledge/': typeof ExplorePublicKnowledgeIndexRoute
74123
}
75124
export interface FileRouteTypes {
76125
fileRoutesByFullPath: FileRoutesByFullPath
@@ -79,30 +128,44 @@ export interface FileRouteTypes {
79128
| '/authenticate-success'
80129
| '/explore-public-knowledge'
81130
| '/login'
131+
| '/explore-public-knowledge/asset-market'
132+
| '/explore-public-knowledge/dapps'
133+
| '/explore-public-knowledge/investment-rounts'
134+
| '/explore-public-knowledge/projects'
82135
| '/private-space/$space-id'
83136
| '/public-space/$space-id'
137+
| '/explore-public-knowledge/'
84138
fileRoutesByTo: FileRoutesByTo
85139
to:
86140
| '/'
87141
| '/authenticate-success'
88-
| '/explore-public-knowledge'
89142
| '/login'
143+
| '/explore-public-knowledge/asset-market'
144+
| '/explore-public-knowledge/dapps'
145+
| '/explore-public-knowledge/investment-rounts'
146+
| '/explore-public-knowledge/projects'
90147
| '/private-space/$space-id'
91148
| '/public-space/$space-id'
149+
| '/explore-public-knowledge'
92150
id:
93151
| '__root__'
94152
| '/'
95153
| '/authenticate-success'
96154
| '/explore-public-knowledge'
97155
| '/login'
156+
| '/explore-public-knowledge/asset-market'
157+
| '/explore-public-knowledge/dapps'
158+
| '/explore-public-knowledge/investment-rounts'
159+
| '/explore-public-knowledge/projects'
98160
| '/private-space/$space-id'
99161
| '/public-space/$space-id'
162+
| '/explore-public-knowledge/'
100163
fileRoutesById: FileRoutesById
101164
}
102165
export interface RootRouteChildren {
103166
IndexRoute: typeof IndexRoute
104167
AuthenticateSuccessRoute: typeof AuthenticateSuccessRoute
105-
ExplorePublicKnowledgeRoute: typeof ExplorePublicKnowledgeRoute
168+
ExplorePublicKnowledgeRoute: typeof ExplorePublicKnowledgeRouteWithChildren
106169
LoginRoute: typeof LoginRoute
107170
PrivateSpaceSpaceIdRoute: typeof PrivateSpaceSpaceIdRoute
108171
PublicSpaceSpaceIdRoute: typeof PublicSpaceSpaceIdRoute
@@ -138,6 +201,13 @@ declare module '@tanstack/react-router' {
138201
preLoaderRoute: typeof IndexRouteImport
139202
parentRoute: typeof rootRouteImport
140203
}
204+
'/explore-public-knowledge/': {
205+
id: '/explore-public-knowledge/'
206+
path: '/'
207+
fullPath: '/explore-public-knowledge/'
208+
preLoaderRoute: typeof ExplorePublicKnowledgeIndexRouteImport
209+
parentRoute: typeof ExplorePublicKnowledgeRoute
210+
}
141211
'/public-space/$space-id': {
142212
id: '/public-space/$space-id'
143213
path: '/public-space/$space-id'
@@ -152,13 +222,65 @@ declare module '@tanstack/react-router' {
152222
preLoaderRoute: typeof PrivateSpaceSpaceIdRouteImport
153223
parentRoute: typeof rootRouteImport
154224
}
225+
'/explore-public-knowledge/projects': {
226+
id: '/explore-public-knowledge/projects'
227+
path: '/projects'
228+
fullPath: '/explore-public-knowledge/projects'
229+
preLoaderRoute: typeof ExplorePublicKnowledgeProjectsRouteImport
230+
parentRoute: typeof ExplorePublicKnowledgeRoute
231+
}
232+
'/explore-public-knowledge/investment-rounts': {
233+
id: '/explore-public-knowledge/investment-rounts'
234+
path: '/investment-rounts'
235+
fullPath: '/explore-public-knowledge/investment-rounts'
236+
preLoaderRoute: typeof ExplorePublicKnowledgeInvestmentRountsRouteImport
237+
parentRoute: typeof ExplorePublicKnowledgeRoute
238+
}
239+
'/explore-public-knowledge/dapps': {
240+
id: '/explore-public-knowledge/dapps'
241+
path: '/dapps'
242+
fullPath: '/explore-public-knowledge/dapps'
243+
preLoaderRoute: typeof ExplorePublicKnowledgeDappsRouteImport
244+
parentRoute: typeof ExplorePublicKnowledgeRoute
245+
}
246+
'/explore-public-knowledge/asset-market': {
247+
id: '/explore-public-knowledge/asset-market'
248+
path: '/asset-market'
249+
fullPath: '/explore-public-knowledge/asset-market'
250+
preLoaderRoute: typeof ExplorePublicKnowledgeAssetMarketRouteImport
251+
parentRoute: typeof ExplorePublicKnowledgeRoute
252+
}
155253
}
156254
}
157255

256+
interface ExplorePublicKnowledgeRouteChildren {
257+
ExplorePublicKnowledgeAssetMarketRoute: typeof ExplorePublicKnowledgeAssetMarketRoute
258+
ExplorePublicKnowledgeDappsRoute: typeof ExplorePublicKnowledgeDappsRoute
259+
ExplorePublicKnowledgeInvestmentRountsRoute: typeof ExplorePublicKnowledgeInvestmentRountsRoute
260+
ExplorePublicKnowledgeProjectsRoute: typeof ExplorePublicKnowledgeProjectsRoute
261+
ExplorePublicKnowledgeIndexRoute: typeof ExplorePublicKnowledgeIndexRoute
262+
}
263+
264+
const ExplorePublicKnowledgeRouteChildren: ExplorePublicKnowledgeRouteChildren =
265+
{
266+
ExplorePublicKnowledgeAssetMarketRoute:
267+
ExplorePublicKnowledgeAssetMarketRoute,
268+
ExplorePublicKnowledgeDappsRoute: ExplorePublicKnowledgeDappsRoute,
269+
ExplorePublicKnowledgeInvestmentRountsRoute:
270+
ExplorePublicKnowledgeInvestmentRountsRoute,
271+
ExplorePublicKnowledgeProjectsRoute: ExplorePublicKnowledgeProjectsRoute,
272+
ExplorePublicKnowledgeIndexRoute: ExplorePublicKnowledgeIndexRoute,
273+
}
274+
275+
const ExplorePublicKnowledgeRouteWithChildren =
276+
ExplorePublicKnowledgeRoute._addFileChildren(
277+
ExplorePublicKnowledgeRouteChildren,
278+
)
279+
158280
const rootRouteChildren: RootRouteChildren = {
159281
IndexRoute: IndexRoute,
160282
AuthenticateSuccessRoute: AuthenticateSuccessRoute,
161-
ExplorePublicKnowledgeRoute: ExplorePublicKnowledgeRoute,
283+
ExplorePublicKnowledgeRoute: ExplorePublicKnowledgeRouteWithChildren,
162284
LoginRoute: LoginRoute,
163285
PrivateSpaceSpaceIdRoute: PrivateSpaceSpaceIdRoute,
164286
PublicSpaceSpaceIdRoute: PublicSpaceSpaceIdRoute,

0 commit comments

Comments
 (0)