@@ -12,7 +12,7 @@ import {
1212} from '@graphprotocol/hypergraph-react' ;
1313import { useState } from 'react' ;
1414
15- import { Address } from '@/app/schema' ;
15+ import { Project } from '@/app/schema' ;
1616import { Button } from '../ui/button' ;
1717
1818export function PrivateSpaceWrapper ( { spaceid } : Readonly < { spaceid : string } > ) {
@@ -24,12 +24,13 @@ export function PrivateSpaceWrapper({ spaceid }: Readonly<{ spaceid: string }>)
2424}
2525
2626function PrivateSpace ( ) {
27- const { name, ready } = useSpace ( { mode : 'private' } ) ;
28- const { data : addresses } = useQuery ( Address , { mode : 'private' } ) ;
27+ const { name, ready, id : spaceId } = useSpace ( { mode : 'private' } ) ;
28+ const { data : projects } = useQuery ( Project , { mode : 'private' } ) ;
2929 const { data : publicSpaces } = useSpaces ( { mode : 'public' } ) ;
3030 const [ selectedSpace , setSelectedSpace ] = useState < string > ( '' ) ;
31- const createAddress = useCreateEntity ( Address ) ;
32- const [ addressName , setAddressName ] = useState ( '' ) ;
31+ const createProject = useCreateEntity ( Project ) ;
32+ const [ projectName , setProjectName ] = useState ( '' ) ;
33+ const [ projectDescription , setProjectDescription ] = useState ( '' ) ;
3334 const { getSmartSessionClient } = useHypergraphApp ( ) ;
3435
3536 if ( ! ready ) {
@@ -45,32 +46,33 @@ function PrivateSpace() {
4546
4647 const handleSubmit = ( e : React . FormEvent < HTMLFormElement > ) => {
4748 e . preventDefault ( ) ;
48- createAddress ( { name : addressName , description : 'Beautiful address' } ) ;
49- setAddressName ( '' ) ;
49+ createProject ( { name : projectName , description : projectDescription } ) ;
50+ setProjectName ( '' ) ;
51+ setProjectDescription ( '' ) ;
5052 } ;
5153
52- const publishToPublicSpace = async ( address : Address ) => {
54+ const publishToPublicSpace = async ( project : Project ) => {
5355 if ( ! selectedSpace ) {
5456 alert ( 'No space selected' ) ;
5557 return ;
5658 }
5759 try {
58- const { ops } = await preparePublish ( { entity : address , publicSpace : selectedSpace } ) ;
60+ const { ops } = await preparePublish ( { entity : project , publicSpace : selectedSpace } ) ;
5961 const smartSessionClient = await getSmartSessionClient ( ) ;
6062 if ( ! smartSessionClient ) {
6163 throw new Error ( 'Missing smartSessionClient' ) ;
6264 }
6365 const publishResult = await publishOps ( {
6466 ops,
6567 space : selectedSpace ,
66- name : 'Publish Address ' ,
68+ name : 'Publish Project ' ,
6769 walletClient : smartSessionClient ,
6870 } ) ;
6971 console . log ( publishResult , ops ) ;
70- alert ( 'Address published to public space' ) ;
72+ alert ( 'Project published to public space' ) ;
7173 } catch ( error ) {
7274 console . error ( error ) ;
73- alert ( 'Error publishing address to public space' ) ;
75+ alert ( 'Error publishing project to public space' ) ;
7476 }
7577 } ;
7678
@@ -79,32 +81,47 @@ function PrivateSpace() {
7981 < div className = "container mx-auto px-4 py-8 max-w-4xl" >
8082 { /* Header */ }
8183 < div className = "mb-8" >
82- < h1 className = "text-3xl font-bold text-foreground mb-2" > { name } </ h1 >
83- < p className = "text-muted-foreground" > Manage your private addresses and publish them to public spaces</ p >
84+ < p className = "text-slate-600 mt-1 text-sm" > Private Space</ p >
85+ < h1 className = "text-3xl font-bold text-slate-900" > { name } </ h1 >
86+ < p className = "text-slate-600 mt-1 text-sm" > ID: { spaceId } </ p >
87+ < p className = "text-muted-foreground mt-6" > Manage your private projects and publish them to public spaces</ p >
8488 </ div >
8589
8690 < div className = "grid gap-8 lg:grid-cols-2" >
87- { /* Create Address Form */ }
91+ { /* Create Project Form */ }
8892 < div className = "space-y-6" >
8993 < div className = "bg-card border rounded-lg p-6 shadow-sm" >
90- < h2 className = "text-xl font-semibold text-card-foreground mb-4" > Create New Address </ h2 >
94+ < h2 className = "text-xl font-semibold text-card-foreground mb-4" > Create New Project </ h2 >
9195 < form onSubmit = { handleSubmit } className = "space-y-4" >
9296 < div className = "space-y-2" >
93- < label htmlFor = "address -name" className = "text-sm font-medium text-card-foreground" >
94- Address Name
97+ < label htmlFor = "project -name" className = "text-sm font-medium text-card-foreground" >
98+ Project Name
9599 </ label >
96100 < input
97- id = "address -name"
101+ id = "project -name"
98102 type = "text"
99- value = { addressName }
100- onChange = { ( e ) => setAddressName ( e . target . value ) }
101- placeholder = "Enter address name..."
103+ value = { projectName }
104+ onChange = { ( e ) => setProjectName ( e . target . value ) }
105+ placeholder = "Enter project name..."
102106 className = "w-full px-3 py-2 border border-input bg-background rounded-md text-sm transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"
103107 required
104108 />
105109 </ div >
106- < Button type = "submit" className = "w-full" disabled = { ! addressName . trim ( ) } >
107- Create Address
110+ < div className = "space-y-2" >
111+ < label htmlFor = "project-description" className = "text-sm font-medium text-card-foreground" >
112+ Project Description
113+ </ label >
114+ < input
115+ id = "project-description"
116+ type = "text"
117+ value = { projectDescription }
118+ onChange = { ( e ) => setProjectDescription ( e . target . value ) }
119+ placeholder = "Enter project description..."
120+ className = "w-full px-3 py-2 border border-input bg-background rounded-md text-sm transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"
121+ />
122+ </ div >
123+ < Button type = "submit" className = "w-full" disabled = { ! projectName . trim ( ) } >
124+ Create Project
108125 </ Button >
109126 </ form >
110127 </ div >
@@ -114,18 +131,23 @@ function PrivateSpace() {
114131 < div className = "space-y-6" >
115132 < div className = "bg-card border rounded-lg p-6 shadow-sm" >
116133 < h2 className = "text-xl font-semibold text-card-foreground mb-4" >
117- Your Addresses ({ addresses ?. length || 0 } )
134+ Your Projects ({ projects ?. length || 0 } )
118135 </ h2 >
119136
120- { addresses && addresses . length > 0 ? (
137+ { projects && projects . length > 0 ? (
121138 < div className = "space-y-4" >
122- { addresses . map ( ( address ) => (
123- < div key = { address . id } className = "border border-border rounded-lg p-4 bg-background" >
139+ { projects . map ( ( project ) => (
140+ < div key = { project . id } className = "border border-border rounded-lg p-4 bg-background" >
141+ < div className = "flex items-center justify-between mb-3" >
142+ < h3 className = "font-medium text-foreground" > { project . name } </ h3 >
143+ </ div >
144+
145+ < div className = "flex items-center justify-between mb-3" >
146+ < p className = "text-xs text-muted-foreground" > ID: { project . id } </ p >
147+ </ div >
148+
124149 < div className = "flex items-center justify-between mb-3" >
125- < h3 className = "font-medium text-foreground" > { address . name } </ h3 >
126- < span className = "text-xs text-muted-foreground bg-muted px-2 py-1 rounded" >
127- ID: { address . id . slice ( 0 , 8 ) } ...
128- </ span >
150+ < p className = "text-sm text-muted-foreground" > { project . description } </ p >
129151 </ div >
130152
131153 < div className = "space-y-3" >
@@ -149,7 +171,7 @@ function PrivateSpace() {
149171 </ div >
150172
151173 < Button
152- onClick = { ( ) => publishToPublicSpace ( address ) }
174+ onClick = { ( ) => publishToPublicSpace ( project ) }
153175 disabled = { ! selectedSpace }
154176 variant = "outline"
155177 size = "sm"
@@ -178,8 +200,8 @@ function PrivateSpace() {
178200 />
179201 </ svg >
180202 </ div >
181- < p className = "text-muted-foreground" > No addresses created yet</ p >
182- < p className = "text-sm text-muted-foreground mt-1" > Create your first address using the form</ p >
203+ < p className = "text-muted-foreground" > No projects created yet</ p >
204+ < p className = "text-sm text-muted-foreground mt-1" > Create your first project using the form</ p >
183205 </ div >
184206 ) }
185207 </ div >
0 commit comments