@@ -2,7 +2,7 @@ import { Button } from '@/components/ui/button';
22import { Card , CardContent , CardHeader , CardTitle } from '@/components/ui/card' ;
33import { Input } from '@/components/ui/input' ;
44import { store } from '@graphprotocol/hypergraph' ;
5- import { useHypergraphApp } from '@graphprotocol/hypergraph-react' ;
5+ import { useHypergraphApp , useSpaces } from '@graphprotocol/hypergraph-react' ;
66import { Link , createFileRoute } from '@tanstack/react-router' ;
77import { useSelector } from '@xstate/store/react' ;
88import { useEffect , useState } from 'react' ;
@@ -12,6 +12,7 @@ export const Route = createFileRoute('/')({
1212} ) ;
1313
1414function Index ( ) {
15+ const { data : publicSpaces } = useSpaces ( { mode : 'public' } ) ;
1516 const spaces = useSelector ( store , ( state ) => state . context . spaces ) ;
1617 const [ spaceName , setSpaceName ] = useState ( '' ) ;
1718
@@ -89,6 +90,8 @@ function Index() {
8990 Create space
9091 </ Button >
9192 </ div >
93+
94+ < h2 className = "text-lg font-bold" > Private Spaces</ h2 >
9295 < ul className = "flex flex-col gap-2" >
9396 { spaces . length === 0 && < div > No spaces</ div > }
9497 { spaces . map ( ( space ) => {
@@ -106,6 +109,21 @@ function Index() {
106109 } ) }
107110 </ ul >
108111
112+ < h2 className = "text-lg font-bold" > Public Spaces</ h2 >
113+ < ul className = "flex flex-col gap-2" >
114+ { publicSpaces ?. map ( ( space ) => {
115+ return (
116+ < li key = { space . id } >
117+ < Card >
118+ < CardHeader >
119+ < CardTitle > { space . name } </ CardTitle >
120+ </ CardHeader >
121+ </ Card >
122+ </ li >
123+ ) ;
124+ } ) }
125+ </ ul >
126+
109127 < div className = "flex flex-col gap-2" >
110128 < h2 className = "text-lg font-bold" > Account Inboxes</ h2 >
111129 < Button
0 commit comments