From da64b464944ccbe9c7a0abfaea328deeff5d9a9d Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Mon, 17 Aug 2026 08:55:54 -0700 Subject: [PATCH] Show notification badges on thread items --- src/app/components/ThreadBoardItem.svelte | 22 ++++++++++++++-------- src/app/notifications.ts | 5 ++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/app/components/ThreadBoardItem.svelte b/src/app/components/ThreadBoardItem.svelte index 74265a5b..7871d80f 100644 --- a/src/app/components/ThreadBoardItem.svelte +++ b/src/app/components/ThreadBoardItem.svelte @@ -3,9 +3,12 @@ import {formatTimestamp, max} from "@welshman/lib" import type {TrustedEvent} from "@welshman/util" import {COMMENT, tagSpec, tagValue} from "@welshman/util" + import {fade} from "@lib/transition" + import Link from '@lib/components/Link.svelte' import ProfileCircle from "@app/components/ProfileCircle.svelte" import ProfileName from "@app/components/ProfileName.svelte" import {deriveEventsForUrl} from "@app/repository" + import {notifications} from "@app/notifications" import {makeThreadPath} from "@app/routes" type Props = { @@ -22,15 +25,15 @@ const lastActive = $derived(max([...$replies, event].map(e => e.created_at))) const title = tagValue(tagSpec("title"), event.tags) const path = makeThreadPath(url, event.id) + const onClick = () => goto(path) + // notification={$notifications.has(path)} - const goToThread = () => goto(path) {#if mobile} - + {:else} + onclick={onClick} + class="hover:bg-surface-less cursor-pointer border-b border-solid border-line text-sm transition-colors"> + {#if $notifications.has(path)} +
+ {/if} {title || "Untitled thread"} diff --git a/src/app/notifications.ts b/src/app/notifications.ts index cf7bc9b6..55b84f4e 100644 --- a/src/app/notifications.ts +++ b/src/app/notifications.ts @@ -304,7 +304,10 @@ export const allNotifications = derived( for (const [path, {listPath, latestEvent}] of latestEventByContentPath(url, events)) { if (hasNotification(path, latestEvent)) { paths.add(path) - paths.add(listPath) + + if (hasNotification(listPath, latestEvent)) { + paths.add(listPath) + } if (hasNotification(spacePath, latestEvent)) { paths.add(spacePath)