Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit 543a6fd

Browse files
committed
finish migration to Jazz 0.18
1 parent 6cb23dd commit 543a6fd

7 files changed

Lines changed: 31 additions & 31 deletions

File tree

src/lib/components/AreaForm.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
area,
77
onsave,
88
}: {
9-
area?: co.loaded<typeof Area, { title: true; notes: true }>;
10-
onsave: (area: Area) => void;
9+
area?: co.loaded<typeof Area, { title: true; notes: true; projects: true }>;
10+
onsave: (area: co.loaded<typeof Area, { title: true; notes: true; projects: true }>) => void;
1111
} = $props();
1212
1313
let draftTitle = $state(area?.title?.toString() || '');
@@ -17,8 +17,8 @@
1717
e.preventDefault();
1818
1919
if (area) {
20-
area.title.applyDiff(draftTitle);
21-
area.notes.applyDiff(draftNotes);
20+
area.title.$jazz.applyDiff(draftTitle);
21+
area.notes.$jazz.applyDiff(draftNotes);
2222
onsave(area);
2323
} else {
2424
onsave(

src/lib/components/ProfileEditor.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
placeholder="Kermit the Frog"
1313
type="text"
1414
value={profile.name}
15-
oninput={(ev) => (profile.name = ev.currentTarget.value)}
15+
oninput={(ev) => profile.$jazz.set('name', ev.currentTarget.value)}
1616
/>
1717
</label>
1818
</form>

src/lib/components/Sidebar.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@
7676
</div>
7777
{:else}
7878
<ol class="flex flex-col gap-4">
79-
{#each root.areas.filter((area) => !area.archived) as area (area.id)}
79+
{#each root.areas.filter((area) => !area.archived) as area (area.$jazz.id)}
8080
{@render link(
81-
`/area/${area.id}`,
81+
`/area/${area.$jazz.id}`,
8282
area.title?.toString(),
83-
page.route.id === `/area/${area.id}`,
83+
page.route.id === `/area/${area.$jazz.id}`,
8484
Grid2x2,
8585
'text-surface-300-700',
8686
area.projects.length > 0 ? area.projects.length.toString() : '',
@@ -121,7 +121,7 @@
121121
>
122122
<QuickAdd
123123
onadd={(task) => {
124-
if (root?.inbox) root.inbox.push(task);
124+
if (root?.inbox) root.inbox.$jazz.push(task);
125125
quickAdd.close();
126126
}}
127127
/>
@@ -134,7 +134,7 @@
134134
>
135135
<AreaForm
136136
onsave={(area) => {
137-
if (root?.areas) root.areas.push(area);
137+
if (root?.areas) root.areas.$jazz.push(area);
138138
newArea.close();
139139
}}
140140
/>

src/lib/components/SingleTask.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
bind:value={
105105
() => task.title?.toString(),
106106
(val) => {
107-
if (val) task.title?.applyDiff(val);
107+
if (val) task.title?.$jazz.applyDiff(val);
108108
}
109109
}
110110
/>
@@ -140,7 +140,7 @@
140140
bind:value={waitDraft}
141141
onblur={parseAndSave(
142142
waitDraft,
143-
(v) => (task.wait = v),
143+
(v) => task.$jazz.set('wait', v),
144144
() => (waitDraft = task.wait?.toLocaleString() || ''),
145145
)}
146146
/>
@@ -155,7 +155,7 @@
155155
bind:value={dueDraft}
156156
onblur={parseAndSave(
157157
dueDraft,
158-
(v) => (task.due = v),
158+
(v) => task.$jazz.set('due', v),
159159
() => (dueDraft = task.due?.toLocaleString() || ''),
160160
)}
161161
/>

src/lib/components/TaskList.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</script>
88

99
<ol class="flex flex-col gap-2">
10-
{#each list as task (task?.id)}
10+
{#each list as task (task?.$jazz.id)}
1111
{#if task}
1212
<li>
1313
<SingleTask {task} />

src/lib/schema/account.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,31 @@ export const Account = co
1717
if (account.root === undefined) {
1818
const group = Group.create();
1919

20-
account.root = Root.create(
21-
{
22-
inbox: [],
23-
areas: [],
24-
},
25-
group,
26-
);
20+
account.$jazz.set("root", Root.create(
21+
{
22+
inbox: [],
23+
areas: [],
24+
},
25+
group,
26+
));
2727
}
2828

2929
if (account.root && account.root.areas === undefined) {
3030
const group = Group.create();
31-
group.addMember(account.root._owner, 'admin');
31+
group.addMember(account.root.$jazz.owner, 'admin');
3232

33-
account.root.areas = Root.shape.areas.create([], group);
33+
account.root.$jazz.set("areas", Root.shape.areas.create([], group));
3434
}
3535

3636
if (!account.profile) {
3737
const group = Group.create();
3838
group.addMember('everyone', 'reader');
3939

40-
account.profile = Profile.create(
41-
{
42-
name: '',
43-
},
44-
group,
45-
);
40+
account.$jazz.set("profile", Profile.create(
41+
{
42+
name: '',
43+
},
44+
group,
45+
));
4646
}
4747
});

src/routes/area/[id]/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141

4242
<div id={optionsId} class="rounded-base p-2" {@attach popover}>
4343
{#if !area.archived}
44-
<button class="btn-primary btn" onclick={() => (area.archived = new Date())}>
44+
<button class="btn-primary btn" onclick={() => area.$jazz.set('archived', new Date())}>
4545
<Archive class="h-8 w-8 text-error-500" />
4646
Archive {area.title}
4747
</button>
4848
{:else}
49-
<button class="btn-primary btn" onclick={() => (area.archived = undefined)}>
49+
<button class="btn-primary btn" onclick={() => area.$jazz.delete('archived')}>
5050
<ArchiveRestore class="h-8 w-8 text-success-500" />
5151
Restore {area.title}
5252
</button>

0 commit comments

Comments
 (0)