Files
wanderer/web/src/routes/settings/notifications/+page.svelte
Flomp 9276690d60 Federation (#327)
* initial commit federation

* more federation

* more federation

* more federation

* completes follow, accept, undo

* add trail create activity

* process trail create activity

* more trail create activity

* adds missing endpoints

* adds update and delete activity

* adds comment activities

* adds activities back

* adds summit logs activities

* deletes follow counts table

* fixes migrations

* fixes migrations

* fixes migrations

* fixes migrations

* adds remote profiles

* ctd

* ctd

* we are getting closer...

* adds public summit logs

* fixes federated trails in lists

* adds remote lists

* adds list activites

* fixes lists

* adds notifications

* adds iri redirect

* fixes comments and summitlogs

* fixes follows and profiles

* adds asynchronous send

* fixes list search

* adds encryption key

* bug fixes

* fixes activity signing

* removes custon activity object types

* adds html editor

* fixes html editor

* fixes display issues on mastodon

* adds federated sharing

* finishes announcements

* fixes small summit log issues

* adds trail likes

* finalizes likes

* fixes images for komoot

* add disable federation option

* adds private profiles

* updates docs

* adds federated comments

* adds trail and comments actvitiypub routes

* adds mentions to editor

* adds mentions to trails, comments, summit logs

* updates theme

* updates theme

* update docs

* update docs

* updates docs

* fixes various frontend problems

* fixes activitypub follows api

* updates docs

* updates docs

---------

Co-authored-by: Christian Beutel <>
2025-06-21 10:09:22 +02:00

126 lines
3.9 KiB
Svelte

<script lang="ts">
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 s = (page.data.settings as Settings)?.notifications
const notifications = $state({
list_share: {
web: s?.list_share?.web ?? true,
email: s?.list_share?.email ?? true,
},
trail_share: {
web: s?.trail_share?.web ?? true,
email: s?.trail_share?.email ?? true,
},
trail_like: {
web: s?.trail_like?.web ?? true,
email: s?.trail_like?.email ?? true,
},
new_follower: {
web: s?.new_follower?.web ?? true,
email: s?.new_follower?.email ?? true,
},
trail_comment: {
web: s?.trail_comment?.web ?? true,
email: s?.trail_comment?.email ?? true,
},
summit_log_create: {
web: s?.summit_log_create?.web ?? true,
email: s?.summit_log_create?.email ?? true,
},
trail_mention: {
web: s?.trail_mention?.web ?? true,
email: s?.trail_mention?.email ?? true,
},
comment_mention: {
web: s?.comment_mention?.web ?? true,
email: s?.comment_mention?.email ?? true,
},
summit_log_mention: {
web: s?.summit_log_mention?.web ?? true,
email: s?.summit_log_mention?.email ?? true,
},
});
const notificationItems: { text: string; key: NotificationType }[] = [
{
text: $_("settings-notification-trail-comment"),
key: NotificationType.trailComment,
},
{
text: $_("settings-notification-new-follower"),
key: NotificationType.newFollower,
},
{
text: $_("settings-notification-trail-share"),
key: NotificationType.trailShare,
},
{
text: $_("settings-notification-trail-like"),
key: NotificationType.trailLike,
},
{
text: $_("settings-notification-list-share"),
key: NotificationType.listShare,
},
{
text: $_("settings-notification-summit-log-create"),
key: NotificationType.summitLogCreate,
},
{
text: $_("settings-notification-trail-mention"),
key: NotificationType.trailMention,
},
{
text: $_("settings-notification-comment-mention"),
key: NotificationType.commentMention,
},
{
text: $_("settings-notification-summit-log-mention"),
key: NotificationType.summitLogMention,
},
];
async function updateNotificationSettings() {
await settings_update({
id: page.data.settings!.id,
notifications,
});
}
</script>
<svelte:head>
<title>{$_("settings")} | wanderer</title>
</svelte:head>
<h2 class="text-2xl font-semibold">{$_("notifications")}</h2>
<hr class="mt-4 mb-6 border-input-border" />
<div
class="grid gap-4"
style="grid-template-columns: 1fr min-content min-content;"
>
<div></div>
<span class="text-sm font-medium">Web</span>
<span class="text-sm font-medium">Email</span>
{#each notificationItems as item}
<p>{item.text}</p>
<div>
<Toggle
onchange={updateNotificationSettings}
bind:value={notifications[item.key].web}
></Toggle>
</div>
<div>
<Toggle
onchange={updateNotificationSettings}
bind:value={notifications[item.key].email}
></Toggle>
</div>
{/each}
</div>