Skip to content

Commit 65d776f

Browse files
committed
use space name for spaces list
1 parent 8458747 commit 65d776f

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

apps/events/src/routes/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function Index() {
7575
<div className="flex flex-row gap-2 justify-between items-center">
7676
<Input value={spaceName} onChange={(e) => setSpaceName(e.target.value)} />
7777
<Button
78+
disabled={true} // disabled until we have delegation for creating a space
7879
onClick={async (event) => {
7980
event.preventDefault();
8081
// const smartAccountWalletClient = await getSmartAccountWalletClient();
@@ -96,7 +97,7 @@ function Index() {
9697
<Link to="/space/$spaceId" params={{ spaceId: space.id }}>
9798
<Card>
9899
<CardHeader>
99-
<CardTitle>{space.id}</CardTitle>
100+
<CardTitle>{space.name}</CardTitle>
100101
</CardHeader>
101102
</Card>
102103
</Link>

packages/hypergraph-react/src/HypergraphAppContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ export function HypergraphAppProvider({
373373
store.send({
374374
type: 'setSpaceFromList',
375375
spaceId: space.id,
376+
name: space.name,
376377
});
377378
});
378379
break;

packages/hypergraph/src/messages/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ export const ResponseListSpaces = Schema.Struct({
277277
spaces: Schema.Array(
278278
Schema.Struct({
279279
id: Schema.String,
280+
name: Schema.String,
280281
}),
281282
),
282283
});

packages/hypergraph/src/store.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export type AccountInboxStorageEntry = {
4242

4343
export type SpaceStorageEntry = {
4444
id: string;
45+
name: string;
4546
events: SpaceEvent[];
4647
state: SpaceState | undefined;
4748
keys: { id: string; key: string }[];
@@ -85,7 +86,7 @@ type StoreEvent =
8586
| { type: 'reset' }
8687
| { type: 'addUpdateInFlight'; updateId: string }
8788
| { type: 'removeUpdateInFlight'; updateId: string }
88-
| { type: 'setSpaceFromList'; spaceId: string }
89+
| { type: 'setSpaceFromList'; spaceId: string; name: string }
8990
| { type: 'applyEvent'; spaceId: string; event: SpaceEvent; state: SpaceState }
9091
| { type: 'updateConfirmed'; spaceId: string; clock: number }
9192
| { type: 'applyUpdate'; spaceId: string; firstUpdateClock: number; lastUpdateClock: number }
@@ -170,7 +171,7 @@ export const store: Store<StoreContext, StoreEvent, GenericEventObject> = create
170171
updatesInFlight: context.updatesInFlight.filter((id) => id !== event.updateId),
171172
};
172173
},
173-
setSpaceFromList: (context, event: { spaceId: string }) => {
174+
setSpaceFromList: (context, event: { spaceId: string; name: string }) => {
174175
if (!context.repo) {
175176
return context;
176177
}
@@ -188,6 +189,7 @@ export const store: Store<StoreContext, StoreEvent, GenericEventObject> = create
188189
if (existingSpace.id === event.spaceId) {
189190
const newSpace: SpaceStorageEntry = {
190191
id: existingSpace.id,
192+
name: existingSpace.name,
191193
events: existingSpace.events ?? [],
192194
state: existingSpace.state,
193195
keys: existingSpace.keys ?? [],
@@ -210,6 +212,7 @@ export const store: Store<StoreContext, StoreEvent, GenericEventObject> = create
210212
...context.spaces,
211213
{
212214
id: event.spaceId,
215+
name: event.name,
213216
events: [],
214217
state: undefined,
215218
keys: [],

0 commit comments

Comments
 (0)