Move alerts to their own page, add direct message alerts

This commit is contained in:
Jon Staab
2025-09-09 09:54:08 -07:00
parent 69bd6d0e70
commit fc6a1a3819
22 changed files with 592 additions and 310 deletions
+17 -11
View File
@@ -14,8 +14,10 @@ import {
THREAD,
ZAP_GOAL,
EVENT_TIME,
getPubkeyTagValues,
} from "@welshman/util"
import {
ensureUnwrapped,
makeChatId,
entityLink,
decodeRelay,
@@ -74,24 +76,28 @@ export const getPrimaryNavItemIndex = ($page: Page) => {
}
export const goToEvent = async (event: TrustedEvent, options: Record<string, any> = {}) => {
if (event.kind === DIRECT_MESSAGE || event.kind === DIRECT_MESSAGE_FILE) {
await scrollToEvent(event.id)
}
const unwrapped = await ensureUnwrapped(event)
const urls = Array.from(tracker.getRelays(event.id))
const path = await getEventPath(event, urls)
if (unwrapped) {
const urls = Array.from(tracker.getRelays(unwrapped.id))
const path = await getEventPath(unwrapped, urls)
if (path.includes("://")) {
window.open(path)
} else {
goto(path, options)
if (path.includes("://")) {
window.open(path)
} else {
goto(path, options)
await sleep(300)
await scrollToEvent(event.id)
await sleep(300)
await scrollToEvent(unwrapped.id)
}
}
}
export const getEventPath = async (event: TrustedEvent, urls: string[]) => {
if (event.kind === DIRECT_MESSAGE || event.kind === DIRECT_MESSAGE_FILE) {
return makeChatPath([event.pubkey, ...getPubkeyTagValues(event.tags)])
}
const room = getTagValue(ROOM, event.tags)
if (urls.length > 0) {