Skip to content

Commit 7cff182

Browse files
committed
Merge branch 'main' of github.com:graphprotocol/hypergraph into chris.whited/feat-352/client
2 parents 72bd170 + 7fbf1eb commit 7cff182

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1080
-2837
lines changed

.changeset/clean-spies-stare.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/great-papayas-divide.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

apps/connect/src/routes/authenticate.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,8 @@ function AuthenticateComponent() {
385385
appId: state.appInfo.appId,
386386
address: newAppIdentity.address,
387387
accountAddress,
388-
signaturePublicKey: keys.signaturePublicKey,
389-
encryptionPublicKey: keys.encryptionPublicKey,
388+
signaturePublicKey: newAppIdentity.signaturePublicKey,
389+
encryptionPublicKey: newAppIdentity.encryptionPublicKey,
390390
ciphertext,
391391
accountProof,
392392
keyProof,

apps/create-hypergraph/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# create-hypergraph
22

3+
## 0.4.6
4+
### Patch Changes
5+
6+
- dcc05b3: improve templates (use Projects instead of Address, show space IDs, show Project IDs)
7+
8+
## 0.4.5
9+
### Patch Changes
10+
11+
- 7e20c0b: improve projects listing in both templates
12+
- b2fbdbb: add datasets (dapps, investment roundes, assets) to templates
13+
314
## 0.4.4
415
### Patch Changes
516

apps/create-hypergraph/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-hypergraph",
3-
"version": "0.4.4",
3+
"version": "0.4.6",
44
"description": "CLI toolchain to scaffold a Hypergraph-enabled application with a given template.",
55
"type": "module",
66
"bin": {

apps/create-hypergraph/template-nextjs/Components/Space/PrivateSpace.tsx

Lines changed: 57 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from '@graphprotocol/hypergraph-react';
1313
import { useState } from 'react';
1414

15-
import { Address } from '@/app/schema';
15+
import { Project } from '@/app/schema';
1616
import { Button } from '../ui/button';
1717

1818
export function PrivateSpaceWrapper({ spaceid }: Readonly<{ spaceid: string }>) {
@@ -24,12 +24,13 @@ export function PrivateSpaceWrapper({ spaceid }: Readonly<{ spaceid: string }>)
2424
}
2525

2626
function 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

Comments
 (0)