Add classified listings

This commit is contained in:
Jon Staab
2026-02-03 11:00:13 -08:00
parent 1da6833c71
commit 119c09d730
25 changed files with 816 additions and 28 deletions
+26
View File
@@ -40,6 +40,7 @@ import {
ZAP_GOAL,
EVENT_TIME,
THREAD,
CLASSIFIED,
COMMENT,
DELETE,
getTagValue,
@@ -56,6 +57,7 @@ import {
makeChatPath,
makeGoalPath,
makeThreadPath,
makeClassifiedPath,
makeCalendarPath,
makeSpaceChatPath,
makeRoomPath,
@@ -106,12 +108,14 @@ export const setChecked = (key: string) => checked.update(state => ({...state, [
const goalCommentFilters = [{kinds: [COMMENT], "#K": [String(ZAP_GOAL)]}]
const threadCommentFilters = [{kinds: [COMMENT], "#K": [String(THREAD)]}]
const classifiedCommentFilters = [{kinds: [COMMENT], "#K": [String(CLASSIFIED)]}]
const calendarCommentFilters = [{kinds: [COMMENT], "#K": [String(EVENT_TIME)]}]
const messageFilters = [{kinds: MESSAGE_KINDS}]
const dmFilters = [{kinds: DM_KINDS}]
const allFilters = flatten([
goalCommentFilters,
threadCommentFilters,
classifiedCommentFilters,
calendarCommentFilters,
messageFilters,
dmFilters,
@@ -129,6 +133,7 @@ export const notifications = derived(
relaysByUrl,
deriveEventsByIdByUrl({tracker, repository, filters: goalCommentFilters}),
deriveEventsByIdByUrl({tracker, repository, filters: threadCommentFilters}),
deriveEventsByIdByUrl({tracker, repository, filters: classifiedCommentFilters}),
deriveEventsByIdByUrl({tracker, repository, filters: calendarCommentFilters}),
deriveEventsByIdByUrl({tracker, repository, filters: messageFilters}),
],
@@ -143,6 +148,7 @@ export const notifications = derived(
$relaysByUrl,
goalCommentsByUrl,
threadCommentsByUrl,
classifiedCommentsByUrl,
calendarCommentsByUrl,
messagesByUrl,
]) => {
@@ -181,10 +187,12 @@ export const notifications = derived(
const spacePathMobile = spacePath + ":mobile"
const goalPath = makeGoalPath(url)
const threadPath = makeThreadPath(url)
const classifiedPath = makeClassifiedPath(url)
const calendarPath = makeCalendarPath(url)
const messagesPath = makeSpaceChatPath(url)
const goalComments = sortEventsDesc(goalCommentsByUrl.get(url)?.values() || [])
const threadComments = sortEventsDesc(threadCommentsByUrl.get(url)?.values() || [])
const classifiedComments = sortEventsDesc(classifiedCommentsByUrl.get(url)?.values() || [])
const calendarComments = sortEventsDesc(calendarCommentsByUrl.get(url)?.values() || [])
const messages = sortEventsDesc(messagesByUrl.get(url)?.values() || [])
@@ -224,6 +232,24 @@ export const notifications = derived(
}
}
const commentsByClassifiedId = groupBy(
e => getTagValue("E", e.tags),
classifiedComments.filter(spec({kind: COMMENT})),
)
for (const [classifiedId, [comment]] of commentsByClassifiedId.entries()) {
const classifiedItemPath = makeClassifiedPath(url, classifiedId)
if (hasNotification(classifiedPath, comment)) {
paths.add(spacePathMobile)
paths.add(classifiedPath)
}
if (hasNotification(classifiedItemPath, comment)) {
paths.add(classifiedItemPath)
}
}
const commentsByEventId = groupBy(
e => getTagValue("E", e.tags),
calendarComments.filter(spec({kind: COMMENT})),