diff --git a/src/app/components/CalendarEventActions.svelte b/src/app/components/CalendarEventActions.svelte
new file mode 100644
index 00000000..56cbeac6
--- /dev/null
+++ b/src/app/components/CalendarEventActions.svelte
@@ -0,0 +1,96 @@
+
+
+
+
{meta.title || meta.name}
-
+
diff --git a/src/app/components/CalendarEventMenu.svelte b/src/app/components/CalendarEventMenu.svelte
new file mode 100644
index 00000000..85ada53c
--- /dev/null
+++ b/src/app/components/CalendarEventMenu.svelte
@@ -0,0 +1,67 @@
+
+
+
+ {#if isRoot}
+ -
+
+
+ {/if}
+ -
+
+
+ {#if event.pubkey === $pubkey}
+ -
+
+
+ {:else}
+ -
+
+
+ {/if}
+
diff --git a/src/app/components/CalendarEventShare.svelte b/src/app/components/CalendarEventShare.svelte
new file mode 100644
index 00000000..6b7d3e4b
--- /dev/null
+++ b/src/app/components/CalendarEventShare.svelte
@@ -0,0 +1,66 @@
+
+
+
diff --git a/src/app/components/ThreadActions.svelte b/src/app/components/ThreadActions.svelte
index 60af31b1..250ec677 100644
--- a/src/app/components/ThreadActions.svelte
+++ b/src/app/components/ThreadActions.svelte
@@ -16,7 +16,7 @@
import ThreadMenu from "@app/components/ThreadMenu.svelte"
import {publishDelete, publishReaction} from "@app/commands"
import {notifications} from "@app/notifications"
- import {makeSpacePath} from "@app/routes"
+ import {makeThreadPath} from "@app/routes"
interface Props {
url: any
@@ -28,7 +28,7 @@
const thunk = $derived($thunks[event.id])
const deleted = deriveIsDeleted(repository, event)
- const path = makeSpacePath(url, "threads", event.id)
+ const path = makeThreadPath(url, event.id)
const filters = [{kinds: [COMMENT], "#E": [event.id]}]
const replies = deriveEvents(repository, {filters})
diff --git a/src/app/notifications.ts b/src/app/notifications.ts
index 5d7a79b6..c583c80f 100644
--- a/src/app/notifications.ts
+++ b/src/app/notifications.ts
@@ -3,8 +3,14 @@ import {synced, throttled} from "@welshman/store"
import {pubkey} from "@welshman/app"
import {prop, spec, identity, now, groupBy} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util"
-import {MESSAGE, THREAD, COMMENT, getTagValue} from "@welshman/util"
-import {makeSpacePath, makeChatPath, makeThreadPath, makeRoomPath} from "@app/routes"
+import {EVENT_TIME, MESSAGE, THREAD, COMMENT, getTagValue} from "@welshman/util"
+import {
+ makeSpacePath,
+ makeChatPath,
+ makeThreadPath,
+ makeCalendarPath,
+ makeRoomPath,
+} from "@app/routes"
import {chats, getUrlsForEvent, userRoomsByUrl, repositoryStore} from "@app/state"
// Checked state
@@ -57,18 +63,31 @@ export const notifications = derived(
{kinds: [THREAD]},
{kinds: [COMMENT], "#K": [String(THREAD)]},
])
+
+ const allCalendarEvents = $repository.query([
+ {kinds: [EVENT_TIME]},
+ {kinds: [COMMENT], "#K": [String(EVENT_TIME)]},
+ ])
+
const allMessageEvents = $repository.query([{kinds: [MESSAGE]}])
for (const [url, rooms] of $userRoomsByUrl.entries()) {
const spacePath = makeSpacePath(url)
const threadPath = makeThreadPath(url)
+ const calendarPath = makeCalendarPath(url)
const threadEvents = allThreadEvents.filter(e => $getUrlsForEvent(e.id).includes(url))
+ const calendarEvents = allCalendarEvents.filter(e => $getUrlsForEvent(e.id).includes(url))
if (hasNotification(threadPath, threadEvents[0])) {
paths.add(spacePath)
paths.add(threadPath)
}
+ if (hasNotification(calendarPath, calendarEvents[0])) {
+ paths.add(spacePath)
+ paths.add(calendarPath)
+ }
+
const commentsByThreadId = groupBy(
e => getTagValue("E", e.tags),
threadEvents.filter(spec({kind: COMMENT})),
@@ -82,6 +101,19 @@ export const notifications = derived(
}
}
+ const commentsByEventId = groupBy(
+ e => getTagValue("E", e.tags),
+ calendarEvents.filter(spec({kind: COMMENT})),
+ )
+
+ for (const [eventId, [comment]] of commentsByEventId.entries()) {
+ const calendarEventPath = makeCalendarPath(url, eventId)
+
+ if (hasNotification(calendarEventPath, comment)) {
+ paths.add(calendarEventPath)
+ }
+ }
+
for (const room of rooms) {
const roomPath = makeRoomPath(url, room)
const latestEvent = allMessageEvents.find(
diff --git a/src/app/routes.ts b/src/app/routes.ts
index fdcfc5a8..96aad395 100644
--- a/src/app/routes.ts
+++ b/src/app/routes.ts
@@ -1,11 +1,17 @@
import type {Page} from "@sveltejs/kit"
+import {identity} from "@welshman/lib"
import {makeChatId, decodeRelay, encodeRelay, userRoomsByUrl} from "@app/state"
-export const makeSpacePath = (url: string, ...extra: string[]) => {
+export const makeSpacePath = (url: string, ...extra: (string | undefined)[]) => {
let path = `/spaces/${encodeRelay(url)}`
if (extra.length > 0) {
- path += "/" + extra.map(s => encodeURIComponent(s)).join("/")
+ path +=
+ "/" +
+ extra
+ .filter(identity)
+ .map(s => encodeURIComponent(s as string))
+ .join("/")
}
return path
@@ -15,15 +21,11 @@ export const makeChatPath = (pubkeys: string[]) => `/chat/${makeChatId(pubkeys)}
export const makeRoomPath = (url: string, room: string) => `/spaces/${encodeRelay(url)}/${room}`
-export const makeThreadPath = (url: string, eventId?: string) => {
- let path = `/spaces/${encodeRelay(url)}/threads`
+export const makeThreadPath = (url: string, eventId?: string) =>
+ makeSpacePath(url, "threads", eventId)
- if (eventId) {
- path += "/" + eventId
- }
-
- return path
-}
+export const makeCalendarPath = (url: string, eventId?: string) =>
+ makeSpacePath(url, "calendar", eventId)
export const getPrimaryNavItem = ($page: Page) => $page.route?.id?.split("/")[1]
diff --git a/src/routes/spaces/[relay]/+page.svelte b/src/routes/spaces/[relay]/+page.svelte
index 923a0c7a..c7cbf4ec 100644
--- a/src/routes/spaces/[relay]/+page.svelte
+++ b/src/routes/spaces/[relay]/+page.svelte
@@ -25,7 +25,7 @@
deriveOtherRooms,
userRoomsByUrl,
} from "@app/state"
- import {makeChatPath, makeRoomPath, makeSpacePath} from "@app/routes"
+ import {makeChatPath, makeThreadPath, makeCalendarPath, makeRoomPath} from "@app/routes"
import {notifications} from "@app/notifications"
import {pushModal} from "@app/modal"
@@ -33,7 +33,8 @@
const relay = deriveRelay(url)
const userRooms = deriveUserRooms(url)
const otherRooms = deriveOtherRooms(url)
- const threadsPath = makeSpacePath(url, "threads")
+ const threadsPath = makeThreadPath(url)
+ const calendarPath = makeCalendarPath(url)
const joinSpace = () => pushModal(SpaceJoin, {url})
@@ -137,6 +138,18 @@
{/if}
+