Migrates to svelte 5

This commit is contained in:
Christian Beutel
2025-01-24 17:46:13 +01:00
parent 7571f6e9b9
commit 3721b7f537
106 changed files with 5524 additions and 4232 deletions

View File

@@ -1,12 +1,12 @@
<script lang="ts">
import { page } from "$app/stores";
import { page } from "$app/state";
import Toggle from "$lib/components/base/toggle.svelte";
import { NotificationType } from "$lib/models/notification";
import type { Settings } from "$lib/models/settings";
import { settings_update } from "$lib/stores/settings_store";
import { _ } from "svelte-i18n";
const notifications = ($page.data.settings as Settings)?.notifications ?? {
const notifications = $state((page.data.settings as Settings)?.notifications ?? {
list_create: {
web: true,
email: true,
@@ -31,7 +31,7 @@
web: true,
email: true,
},
};
});
const notificationItems: { text: string; key: NotificationType }[] = [
{
@@ -62,7 +62,7 @@
async function updateNotificationSettings() {
await settings_update({
id: $page.data.settings!.id,
id: page.data.settings!.id,
notifications,
});
}
@@ -85,13 +85,13 @@
<p>{item.text}</p>
<div>
<Toggle
on:change={updateNotificationSettings}
onchange={updateNotificationSettings}
bind:value={notifications[item.key].web}
></Toggle>
</div>
<div>
<Toggle
on:change={updateNotificationSettings}
onchange={updateNotificationSettings}
bind:value={notifications[item.key].email}
></Toggle>
</div>