Skip to content

Commit 47f0d52

Browse files
committed
merge "refactor: update to latest version of Leaf / Roomy SDK. (#154)" conflicts
1 parent 5fcfa2b commit 47f0d52

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

src/lib/components/RoomBar.svelte

+15-9
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@
2525
let availableThreads = derivePromise([], async () =>
2626
((await g.space?.threads.items()) || []).filter((x) => !x.softDeleted),
2727
);
28+
2829
let categories = derivePromise([], async () => {
2930
if (!g.space) return [];
3031
return (await g.space.sidebarItems.items())
3132
.map((x) => x.tryCast(Category) as Category)
3233
.filter((x) => !!x);
3334
});
35+
3436
let sidebarItems = derivePromise([], async () => {
3537
if (!g.space) return [];
3638
return await g.space.sidebarItems.items();
@@ -50,11 +52,11 @@
5052
if (!g.space) return;
5153
if (!showSpaceSettings) {
5254
spaceNameInput = g.space.name;
53-
newSpaceHandle = g.space?.handles.get(0) || "";
55+
newSpaceHandle = g.space?.handles((x) => x.get(0)) || "";
5456
verificationFailed = false;
5557
saveSpaceLoading = false;
5658
Promise.all(
57-
Object.keys(g.space.bans.toJSON()).map((x) => getProfile(x)),
59+
Object.keys(g.space.bans((x) => x.toJSON())).map((x) => getProfile(x)),
5860
).then(
5961
(profiles) =>
6062
(bannedHandlesInput = profiles.map((x) => x.handle).join(", ")),
@@ -72,10 +74,12 @@
7274
.map((x) => user.agent!.resolveHandle({ handle: x })),
7375
)
7476
).map((x) => x.data.did);
75-
g.space.bans.clear();
76-
for (const ban of bannedIds) {
77-
g.space.bans.set(ban, true);
78-
}
77+
g.space.bans((bans) => {
78+
bans.clear();
79+
for (const ban of bannedIds) {
80+
bans.set(ban, true);
81+
}
82+
});
7983
g.space.commit();
8084
showSpaceSettings = false;
8185
}
@@ -89,7 +93,7 @@
8993
saveSpaceLoading = true;
9094
9195
if (!newSpaceHandle) {
92-
g.space.handles.clear();
96+
g.space.handles((h) => h.clear());
9397
g.space.commit();
9498
saveSpaceLoading = false;
9599
showSpaceSettings = false;
@@ -106,8 +110,10 @@
106110
saveSpaceLoading = false;
107111
return;
108112
}
109-
g.space.handles.clear();
110-
g.space.handles.push(newSpaceHandle);
113+
g.space.handles((h) => {
114+
h.clear();
115+
h.push(newSpaceHandle);
116+
});
111117
g.space.commit();
112118
saveSpaceLoading = false;
113119
showSpaceSettings = false;

src/routes/(app)/[[spaceIndicator=dash]]/[space=space]/+layout.svelte

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import { page } from "$app/state";
99
import { outerWidth } from "svelte/reactivity/window";
1010
11+
let { children } = $props();
12+
let isMobile = $derived((outerWidth.current || 0) < 640);
1113
// TODO: track users via the space data
1214
let users = derivePromise([], async () => {
1315
if (!g.space) {
@@ -19,7 +21,7 @@
1921
for (const timelineItem of await channel.timeline.items()) {
2022
const message = timelineItem.tryCast(Message);
2123
if (message && message.authors.length > 0) {
22-
for (const author of message.authors.toArray()) {
24+
for (const author of message.authors((x) => x.toArray())) {
2325
result.add(author);
2426
}
2527
}
@@ -76,11 +78,9 @@
7678
7779
setContext("users", users);
7880
setContext("contextItems", contextItems);
79-
let { children } = $props();
80-
let isMobile = $derived((outerWidth.current || 0) < 640);
8181
</script>
8282

83-
{#if g.channel || !(page.params.thread || page.params.channel)}
83+
{#if g.space}
8484
<main
8585
class="drawer-content h-full overflox-x-auto flex flex-col gap-4 p-4 overflow-clip bg-base-100 {!isMobile
8686
? 'grow min-w-0 rounded-xl border-4 border-base-300'
@@ -90,6 +90,7 @@
9090
>
9191
{@render children()}
9292
</main>
93+
<!-- If there is no space. -->
9394
{:else}
9495
<span class="loading loading-spinner mx-auto w-25"></span>
9596
{/if}

0 commit comments

Comments
 (0)